Privacy
An open-source, flexible 3D physical simulation framework
mars::sim::SimEntity Class Reference

#include <SimEntity.h>

Public Member Functions

 SimEntity (const std::string &name)
 
 SimEntity (const configmaps::ConfigMap &parameters)
 
 SimEntity (interfaces::ControlCenter *c, const std::string &name)
 
 SimEntity (interfaces::ControlCenter *c, const configmaps::ConfigMap &parameters)
 
void appendConfig (const configmaps::ConfigMap &parameters)
 
void removeEntity ()
 
void addNode (unsigned long nodeId, const std::string &name)
 
void addJoint (long unsigned int jointId, const std::string &name)
 
void addMotor (unsigned long motorId, const std::string &name)
 
void addController (unsigned long controllerId)
 
void addSensor (unsigned long sensorId, const std::string &name)
 
bool select (unsigned long nodeId)
 notify the robot that a node has been selected the robot will check if the node belongs to it More...
 
bool deSelect (unsigned long nodeId)
 notify the robot that a node has been deselected the robot will check if the node belongs to it More...
 
std::string getName ()
 
bool isSelected ()
 
bool belongsToRobot (unsigned long nodeId)
 
unsigned long getNode (const std::string &name)
 returns the id of the node with the given name with the current implementation this is slow More...
 
std::string getNode (unsigned long id)
 
unsigned long getMotor (const std::string &name)
 returns the id of the motor with the given name with the current implementation this is slow O(n) More...
 
std::string getMotor (long unsigned int id)
 
std::vector< unsigned long > getControllerList ()
 
unsigned long getJoint (const std::string &name)
 
std::string getJoint (unsigned long id)
 
const configmaps::ConfigMap getConfig ()
 
void setInitialPose (bool reset=false)
 
interfaces::sReal getEntityMass ()
 
utils::Vector getEntityCOM ()
 
void printNodes ()
 
void printMotors ()
 
void printControllers ()
 

Private Attributes

std::string name
 
interfaces::ControlCentercontrol
 
configmaps::ConfigMap config
 
std::map< unsigned long, std::string > nodeIds
 
std::map< unsigned long, std::string > motorIds
 
std::vector< unsigned long > controllerIds
 
std::map< unsigned long, std::string > sensorIds
 
std::map< unsigned long, std::string > jointIds
 
std::set< unsigned long > selectedNodes
 
bool selected
 

Detailed Description

Definition at line 46 of file SimEntity.h.

Constructor & Destructor Documentation

◆ SimEntity() [1/4]

mars::sim::SimEntity::SimEntity ( const std::string &  name)

Definition at line 39 of file SimEntity.cpp.

◆ SimEntity() [2/4]

mars::sim::SimEntity::SimEntity ( const configmaps::ConfigMap parameters)

Definition at line 43 of file SimEntity.cpp.

◆ SimEntity() [3/4]

mars::sim::SimEntity::SimEntity ( interfaces::ControlCenter c,
const std::string &  name 
)

Definition at line 49 of file SimEntity.cpp.

◆ SimEntity() [4/4]

mars::sim::SimEntity::SimEntity ( interfaces::ControlCenter c,
const configmaps::ConfigMap parameters 
)

Definition at line 54 of file SimEntity.cpp.

Member Function Documentation

◆ addController()

void mars::sim::SimEntity::addController ( unsigned long  controllerId)

Definition at line 82 of file SimEntity.cpp.

◆ addJoint()

void mars::sim::SimEntity::addJoint ( long unsigned int  jointId,
const std::string &  name 
)

Definition at line 86 of file SimEntity.cpp.

◆ addMotor()

void mars::sim::SimEntity::addMotor ( unsigned long  motorId,
const std::string &  name 
)

Definition at line 78 of file SimEntity.cpp.

◆ addNode()

void mars::sim::SimEntity::addNode ( unsigned long  nodeId,
const std::string &  name 
)

Definition at line 74 of file SimEntity.cpp.

◆ addSensor()

void mars::sim::SimEntity::addSensor ( unsigned long  sensorId,
const std::string &  name 
)

Definition at line 90 of file SimEntity.cpp.

◆ appendConfig()

void mars::sim::SimEntity::appendConfig ( const configmaps::ConfigMap parameters)

Definition at line 61 of file SimEntity.cpp.

◆ belongsToRobot()

bool mars::sim::SimEntity::belongsToRobot ( unsigned long  nodeId)

◆ deSelect()

bool mars::sim::SimEntity::deSelect ( unsigned long  nodeId)

notify the robot that a node has been deselected the robot will check if the node belongs to it

Returns
true if the node belongs to the robot; false otherwise

◆ getConfig()

const ConfigMap mars::sim::SimEntity::getConfig ( )

Definition at line 149 of file SimEntity.cpp.

◆ getControllerList()

std::vector< unsigned long > mars::sim::SimEntity::getControllerList ( )

Definition at line 153 of file SimEntity.cpp.

◆ getEntityCOM()

utils::Vector mars::sim::SimEntity::getEntityCOM ( )

Definition at line 301 of file SimEntity.cpp.

◆ getEntityMass()

sReal mars::sim::SimEntity::getEntityMass ( )

Definition at line 289 of file SimEntity.cpp.

◆ getJoint() [1/2]

long unsigned int mars::sim::SimEntity::getJoint ( const std::string &  name)

Definition at line 135 of file SimEntity.cpp.

◆ getJoint() [2/2]

std::string mars::sim::SimEntity::getJoint ( unsigned long  id)

◆ getMotor() [1/2]

long unsigned int mars::sim::SimEntity::getMotor ( const std::string &  name)

returns the id of the motor with the given name with the current implementation this is slow O(n)

Definition at line 121 of file SimEntity.cpp.

◆ getMotor() [2/2]

std::string mars::sim::SimEntity::getMotor ( long unsigned int  id)

Definition at line 130 of file SimEntity.cpp.

◆ getName()

std::string mars::sim::SimEntity::getName ( )
inline

Definition at line 86 of file SimEntity.h.

◆ getNode() [1/2]

long unsigned int mars::sim::SimEntity::getNode ( const std::string &  name)

returns the id of the node with the given name with the current implementation this is slow

Definition at line 107 of file SimEntity.cpp.

◆ getNode() [2/2]

std::string mars::sim::SimEntity::getNode ( unsigned long  id)

◆ isSelected()

bool mars::sim::SimEntity::isSelected ( )
inline

Definition at line 91 of file SimEntity.h.

◆ printControllers()

void mars::sim::SimEntity::printControllers ( )

Definition at line 175 of file SimEntity.cpp.

◆ printMotors()

void mars::sim::SimEntity::printMotors ( )

Definition at line 166 of file SimEntity.cpp.

◆ printNodes()

void mars::sim::SimEntity::printNodes ( )

Definition at line 157 of file SimEntity.cpp.

◆ removeEntity()

void mars::sim::SimEntity::removeEntity ( )

Definition at line 66 of file SimEntity.cpp.

◆ select()

bool mars::sim::SimEntity::select ( unsigned long  nodeId)

notify the robot that a node has been selected the robot will check if the node belongs to it

Returns
true if the node belongs to the robot; false otherwise

Definition at line 94 of file SimEntity.cpp.

◆ setInitialPose()

void mars::sim::SimEntity::setInitialPose ( bool  reset = false)

Definition at line 182 of file SimEntity.cpp.

Member Data Documentation

◆ config

configmaps::ConfigMap mars::sim::SimEntity::config
private

Definition at line 136 of file SimEntity.h.

◆ control

interfaces::ControlCenter* mars::sim::SimEntity::control
private

Definition at line 135 of file SimEntity.h.

◆ controllerIds

std::vector<unsigned long> mars::sim::SimEntity::controllerIds
private

Definition at line 145 of file SimEntity.h.

◆ jointIds

std::map<unsigned long, std::string> mars::sim::SimEntity::jointIds
private

Definition at line 151 of file SimEntity.h.

◆ motorIds

std::map<unsigned long, std::string> mars::sim::SimEntity::motorIds
private

Definition at line 142 of file SimEntity.h.

◆ name

std::string mars::sim::SimEntity::name
private

Definition at line 134 of file SimEntity.h.

◆ nodeIds

std::map<unsigned long, std::string> mars::sim::SimEntity::nodeIds
private

Definition at line 139 of file SimEntity.h.

◆ selected

bool mars::sim::SimEntity::selected
private

Definition at line 157 of file SimEntity.h.

◆ selectedNodes

std::set<unsigned long> mars::sim::SimEntity::selectedNodes
private

Definition at line 154 of file SimEntity.h.

◆ sensorIds

std::map<unsigned long, std::string> mars::sim::SimEntity::sensorIds
private

Definition at line 148 of file SimEntity.h.


The documentation for this class was generated from the following files: