ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
9 #include <argos3/core/utility/logging/argos_log.h>
10 #include <argos3/core/utility/configuration/argos_configuration.h>
41 for(CPointMass3DModel::TMap::iterator it = m_tPhysicsModels.begin();
42 it != m_tPhysicsModels.end(); ++it) {
52 for(CPointMass3DModel::TMap::iterator it = m_tPhysicsModels.begin();
53 it != m_tPhysicsModels.end(); ++it) {
56 m_tPhysicsModels.clear();
64 for(CPointMass3DModel::TMap::iterator it = m_tPhysicsModels.begin();
65 it != m_tPhysicsModels.end(); ++it) {
66 it->second->UpdateFromEntityStatus();
70 for(CPointMass3DModel::TMap::iterator it = m_tPhysicsModels.begin();
71 it != m_tPhysicsModels.end(); ++it) {
76 for(CPointMass3DModel::TMap::iterator it = m_tPhysicsModels.begin();
77 it != m_tPhysicsModels.end(); ++it) {
78 it->second->UpdateEntityStatus();
86 return m_tPhysicsModels.size();
94 CallEntityOperation<CPointMass3DOperationAddEntity, CPointMass3DEngine, SOperationOutcome>
96 return cOutcome.
Value;
104 CallEntityOperation<CPointMass3DOperationRemoveEntity, CPointMass3DEngine, SOperationOutcome>
106 return cOutcome.
Value;
133 const CRay3& c_ray)
const {
135 for(CPointMass3DModel::TMap::const_iterator it = m_tPhysicsModels.begin();
136 it != m_tPhysicsModels.end();
138 if(it->second->CheckIntersectionWithRay(fTOnRay, c_ray)) {
141 &it->second->GetEmbodiedEntity(),
152 m_tPhysicsModels[str_id] = &c_model;
159 CPointMass3DModel::TMap::iterator it = m_tPhysicsModels.find(str_id);
160 if(it != m_tPhysicsModels.end()) {
162 m_tPhysicsModels.erase(it);
165 THROW_ARGOSEXCEPTION(
"PointMass3D model id \"" << str_id <<
"\" not found in point-mass 3D engine \"" <<
GetId() <<
"\"");
174 "Carlo Pinciroli [ilpincy@gmail.com]",
176 "A 3D point-mass physics engine.",
177 "This physics engine is a 3D point-mass engine.\n\n"
178 "REQUIRED XML CONFIGURATION\n\n"
179 " <physics_engines>\n"
181 " <pointmass3d id=\"pm3d\" />\n"
183 " </physics_engines>\n\n"
184 "The 'id' attribute is necessary and must be unique among the physics engines.\n"
185 "If two engines share the same id, initialization aborts.\n\n"
186 "OPTIONAL XML CONFIGURATION\n\n"
187 "None for the time being.\n\n"
const std::string & GetId() const
Returns the id of this physics engine.
virtual bool IsPointContained(const CVector3 &c_point)
Returns true if the given point is contained in this physics engine.
virtual size_t GetNumPhysicsModels()
virtual ~CPointMass3DEngine()
The namespace containing all the ARGoS related code.
virtual bool IsEntityTransferNeeded() const
UInt32 GetIterations() const
Returns the number of iterations per simulation clock tick.
virtual void TransferEntities()
Executes the transfer of entities to other engines.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual void CheckIntersectionWithRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const
Check which objects in this engine intersect the given ray.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
virtual bool RemoveEntity(CEntity &c_entity)
Removes an entity from the physics engine.
virtual void Destroy()
Undoes whatever was done by Init().
void GetNodeAttributeOrDefault(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer, const T &t_default)
Returns the value of a node's attribute, or the passed default value.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
virtual bool AddEntity(CEntity &c_entity)
Adds an entity to the physics engine.
Type to use as return value for operation outcome.
void RemovePhysicsModel(const std::string &str_id)
REGISTER_PHYSICS_ENGINE(CDynamics2DEngine, "dynamics2d", "Carlo Pinciroli [ilpincy@gmail.com]", "1.0", "A 2D dynamics physics engine.", "This physics engine is a 2D dynamics engine based on the Chipmunk library\n" "(http://code.google.com/p/chipmunk-physics).\n\n" "REQUIRED XML CONFIGURATION\n\n" " <physics_engines>\n" " ...\n" " <dynamics2d id=\"dyn2d\" />\n" " ...\n" " </physics_engines>\n\n" "The 'id' attribute is necessary and must be unique among the physics engines.\n" "It is used in the subsequent section <arena_physics> to assign entities to\n" "physics engines. If two engines share the same id, initialization aborts.\n\n" "OPTIONAL XML CONFIGURATION\n\n" "The plane of the physics engine can be translated on the Z axis, to simulate\n" "for example hovering objects, such as flying robots. To translate the plane\n" "2m up the Z axis, use the 'elevation' attribute as follows:\n\n" " <physics_engines>\n" " ...\n" " <dynamics2d id=\"dyn2d\"\n" " elevation=\"2.0\" />\n" " ...\n" " </physics_engines>\n\n" "When not specified, the elevation is zero, which means that the plane\n" "corresponds to the XY plane.\n", "Under development")
std::vector< SEmbodiedEntityIntersectionItem > TEmbodiedEntityIntersectionData
void AddPhysicsModel(const std::string &str_id, CPointMass3DModel &c_model)
virtual void Reset()
Resets the resource.
float Real
Collects all ARGoS code.