ARGoS  3
A parallel, multi-engine simulator for swarm robotics
pointmass3d_model.cpp
Go to the documentation of this file.
1 #include "pointmass3d_model.h"
2 #include <argos3/core/simulator/entity/embodied_entity.h>
3 
4 namespace argos {
5 
6  /****************************************/
7  /****************************************/
8 
10  CEmbodiedEntity& c_entity) :
11  CPhysicsModel(c_engine, c_entity),
12  m_cPM3DEngine(c_engine) {
13  /* Register the origin anchor update method */
14  RegisterAnchorMethod(GetEmbodiedEntity().GetOriginAnchor(),
16  /* Set initial position */
18  }
19 
20  /****************************************/
21  /****************************************/
22 
28  }
29 
30  /****************************************/
31  /****************************************/
32 
33  void CPointMass3DModel::MoveTo(const CVector3& c_position,
34  const CQuaternion& c_orientation) {
35  m_cPosition = c_position;
37  }
38 
39  /****************************************/
40  /****************************************/
41 
43  /* Go through other objects and check if the BB intersect */
44  for(std::map<std::string, CPointMass3DModel*>::const_iterator it = GetPM3DEngine().GetPhysicsModels().begin();
45  it != GetPM3DEngine().GetPhysicsModels().end(); ++it) {
46  if((it->second != this) &&
47  GetBoundingBox().Intersects(it->second->GetBoundingBox()))
48  return true;
49  }
50  return false;
51  }
52 
53  /****************************************/
54  /****************************************/
55 
57  s_anchor.Position = m_cPosition;
58  }
59 
60  /****************************************/
61  /****************************************/
62 
63 }
argos::CEmbodiedEntity::GetOriginAnchor
const SAnchor & GetOriginAnchor() const
Returns a const reference to the origin anchor associated to this entity.
Definition: embodied_entity.h:119
argos::CPointMass3DEngine::GetPhysicsModels
std::map< std::string, CPointMass3DModel * > & GetPhysicsModels()
Definition: pointmass3d_engine.h:52
argos::CPointMass3DModel::Reset
virtual void Reset()
Definition: pointmass3d_model.cpp:23
argos::CPhysicsModel::CalculateBoundingBox
virtual void CalculateBoundingBox()=0
Calculates the axis-aligned box that contains the entire physics model.
argos::CPointMass3DModel::IsCollidingWithSomething
virtual bool IsCollidingWithSomething() const
Returns true if this model is colliding with another model.
Definition: pointmass3d_model.cpp:42
argos
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
argos::CVector3
A 3D vector class.
Definition: vector3.h:29
argos::CPhysicsModel::UpdateEntityStatus
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
Definition: physics_model.cpp:55
argos::SBoundingBox::Intersects
bool Intersects(const SBoundingBox &s_bb) const
Definition: physics_model.h:91
argos::CEmbodiedEntity
This entity is a link to a body in the physics engine.
Definition: embodied_entity.h:48
argos::CPhysicsModel
Definition: physics_model.h:102
pointmass3d_model.h
argos::CQuaternion
Definition: quaternion.h:14
argos::SAnchor
An anchor related to the body of an entity.
Definition: physics_model.h:38
argos::CPhysicsModel::RegisterAnchorMethod
void RegisterAnchorMethod(const SAnchor &s_anchor, void(MODEL::*pt_method)(SAnchor &))
Registers an anchor method.
Definition: physics_model.h:325
argos::CPointMass3DModel::MoveTo
virtual void MoveTo(const CVector3 &c_position, const CQuaternion &c_orientation)
Definition: pointmass3d_model.cpp:33
argos::CPointMass3DModel::m_cAcceleration
CVector3 m_cAcceleration
The acceleration of this model in the engine.
Definition: pointmass3d_model.h:80
argos::CPointMass3DModel::m_cVelocity
CVector3 m_cVelocity
The linear velocity of this model in the engine.
Definition: pointmass3d_model.h:77
argos::CPhysicsModel::GetBoundingBox
const SBoundingBox & GetBoundingBox() const
Returns an axis-aligned box that contains the physics model.
Definition: physics_model.h:198
argos::CPointMass3DModel::m_cPosition
CVector3 m_cPosition
The position of the model in this engine.
Definition: pointmass3d_model.h:74
argos::CPointMass3DEngine
Definition: pointmass3d_engine.h:22
argos::CPointMass3DModel::UpdateOriginAnchor
virtual void UpdateOriginAnchor(SAnchor &s_anchor)
Updates the origin anchor associated to the embodied entity.
Definition: pointmass3d_model.cpp:56
argos::CPointMass3DModel::CPointMass3DModel
CPointMass3DModel(CPointMass3DEngine &c_engine, CEmbodiedEntity &c_entity)
Definition: pointmass3d_model.cpp:9
argos::SAnchor::Position
CVector3 Position
The position of the anchor wrt the global coordinate system.
Definition: physics_model.h:51
argos::CPointMass3DModel::GetPM3DEngine
CPointMass3DEngine & GetPM3DEngine()
Returns a reference to the physics engine controlling this model.
Definition: pointmass3d_model.h:56
argos::CPhysicsModel::GetEmbodiedEntity
CEmbodiedEntity & GetEmbodiedEntity()
Returns the embodied entity associated to this physics model.
Definition: physics_model.h:133