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

The declaration of the JointManager class. More...

#include <JointManager.h>

Public Member Functions

 JointManager (interfaces::ControlCenter *c)
 Initialization of a new JointManager. More...
 
virtual ~JointManager ()
 
virtual unsigned long addJoint (interfaces::JointData *jointS, bool reload=false)
 Add a joint to the joint pool of the simulation. More...
 
virtual int getJointCount ()
 Returns the number of joints added to the simulation. More...
 
virtual void editJoint (interfaces::JointData *jointS)
 Change a Joint. More...
 
virtual void getListJoints (std::vector< interfaces::core_objects_exchange > *jointList)
 Fills a list of core_object_exchange objects with joint informations. More...
 
virtual void getJointExchange (unsigned long id, interfaces::core_objects_exchange *obj)
 Fills one core_object_exchange object with joint information of the joint with the given id. More...
 
virtual const interfaces::JointData getFullJoint (unsigned long index)
 get the full struct of a joint for editing purposes. More...
 
virtual void removeJoint (unsigned long index)
 Removes the joint with the given id. More...
 
virtual void removeJointByIDs (unsigned long id1, unsigned long id2)
 removes the joint connecting the two nodes with the given ids More...
 
virtual SimJointgetSimJoint (unsigned long id)
 Returns a pointer to the SimJoint Object. More...
 
virtual std::vector< SimJoint * > getSimJoints (void)
 Return a copy of the SimJointVector;. More...
 
virtual void reattacheJoints (unsigned long node_id)
 Reattaches the joints that are connected to the node with id node_id. More...
 
virtual void reloadJoints (void)
 Reloads all joints in the simulation. More...
 
virtual void updateJoints (interfaces::sReal calc_ms)
 Update the Joint values from the physics. More...
 
virtual void clearAllJoints (bool clear_all=false)
 Removes all joints from the simulation to clear the world. More...
 
virtual void setReloadJointOffset (unsigned long id, interfaces::sReal offset)
 Set a new joint offset for reloading a joint. More...
 
virtual void setReloadJointAxis (unsigned long id, const utils::Vector &axis)
 Set a new axis for reloading a joint. More...
 
virtual void scaleReloadJoints (interfaces::sReal x, interfaces::sReal y, interfaces::sReal z)
 
virtual void setJointTorque (unsigned long id, interfaces::sReal torque)
 
virtual void changeStepSize (void)
 
virtual void setReloadAnchor (unsigned long id, const utils::Vector &anchor)
 
virtual void setSDParams (unsigned long id, interfaces::JointData *sJoint)
 
virtual void setVelocity (unsigned long id, interfaces::sReal velocity)
 sets the velocity of the first axis of the joint More...
 
virtual void setVelocity2 (unsigned long id, interfaces::sReal velocity)
 sets the velocity of the second axis of the joint More...
 
virtual void setForceLimit (unsigned long id, interfaces::sReal max_force, bool first_axis=1)
 
virtual unsigned long getID (const std::string &joint_name) const
 Retrieve the id of a joint by name. More...
 
virtual bool getDataBrokerNames (unsigned long id, std::string *groupName, std::string *dataName) const
 Retrieves the groupName and dataName under which the joint with the specified id publishes its data in the DataBroker. More...
 
virtual void setOfflineValue (unsigned long id, interfaces::sReal value)
 
virtual interfaces::sReal getLowStop (unsigned long id) const
 
virtual interfaces::sReal getHighStop (unsigned long id) const
 
virtual interfaces::sReal getLowStop2 (unsigned long id) const
 
virtual interfaces::sReal getHighStop2 (unsigned long id) const
 
virtual void setLowStop (unsigned long id, interfaces::sReal lowStop)
 
virtual void setHighStop (unsigned long id, interfaces::sReal highStop)
 
virtual void setLowStop2 (unsigned long id, interfaces::sReal lowStop2)
 
virtual void setHighStop2 (unsigned long id, interfaces::sReal highStop2)
 
virtual void edit (interfaces::JointId id, const std::string &key, const std::string &value)
 
- Public Member Functions inherited from mars::interfaces::JointManagerInterface
virtual ~JointManagerInterface ()
 

Private Member Functions

interfaces::JointManagerInterfacegetJointInterface (unsigned long node_id)
 
std::list< interfaces::JointData >::iterator getReloadJoint (unsigned long id)
 

Private Attributes

unsigned long next_joint_id
 
std::map< unsigned long, SimJoint * > simJoints
 
std::list< interfaces::JointDatasimJointsReload
 
interfaces::ControlCentercontrol
 
utils::Mutex iMutex
 

Detailed Description

The declaration of the JointManager class.

Definition at line 48 of file JointManager.h.

Constructor & Destructor Documentation

◆ JointManager()

mars::sim::JointManager::JointManager ( interfaces::ControlCenter c)

Initialization of a new JointManager.

pre:

  • a pointer to a ControlCenter is needed post:
  • next_node_id should be initialized to one

Definition at line 61 of file JointManager.cpp.

◆ ~JointManager()

virtual mars::sim::JointManager::~JointManager ( )
inlinevirtual

Definition at line 51 of file JointManager.h.

Member Function Documentation

◆ addJoint()

unsigned long mars::sim::JointManager::addJoint ( interfaces::JointData jointS,
bool  reload = false 
)
virtual

Add a joint to the joint pool of the simulation.

It is very important to assure the serialization between the threads to have the desired results.

pre:

Implements mars::interfaces::JointManagerInterface.

Definition at line 66 of file JointManager.cpp.

◆ changeStepSize()

void mars::sim::JointManager::changeStepSize ( void  )
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 326 of file JointManager.cpp.

◆ clearAllJoints()

void mars::sim::JointManager::clearAllJoints ( bool  clear_all = false)
virtual

Removes all joints from the simulation to clear the world.

Implements mars::interfaces::JointManagerInterface.

Definition at line 268 of file JointManager.cpp.

◆ edit()

void mars::sim::JointManager::edit ( interfaces::JointId  id,
const std::string &  key,
const std::string &  value 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 466 of file JointManager.cpp.

◆ editJoint()

void mars::sim::JointManager::editJoint ( interfaces::JointData jointS)
virtual

Change a Joint.

The simulation must be updated in here.

Implements mars::interfaces::JointManagerInterface.

Definition at line 141 of file JointManager.cpp.

◆ getDataBrokerNames()

bool mars::sim::JointManager::getDataBrokerNames ( unsigned long  id,
std::string *  groupName,
std::string *  dataName 
) const
virtual

Retrieves the groupName and dataName under which the joint with the specified id publishes its data in the DataBroker.

Returns
true if the names were successfully retrieved. false if no joint with the given id exists.

Implements mars::interfaces::JointManagerInterface.

Definition at line 390 of file JointManager.cpp.

◆ getFullJoint()

const JointData mars::sim::JointManager::getFullJoint ( unsigned long  index)
virtual

get the full struct of a joint for editing purposes.

Exceptions
std::runtime_errorif the joint cannot be found

Implements mars::interfaces::JointManagerInterface.

Definition at line 177 of file JointManager.cpp.

◆ getHighStop()

sReal mars::sim::JointManager::getHighStop ( unsigned long  id) const
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 415 of file JointManager.cpp.

◆ getHighStop2()

sReal mars::sim::JointManager::getHighStop2 ( unsigned long  id) const
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 429 of file JointManager.cpp.

◆ getID()

unsigned long mars::sim::JointManager::getID ( const std::string &  joint_name) const
virtual

Retrieve the id of a joint by name.

Parameters
joint_nameName of the joint to get the id for
Returns
Id of the joint if it exists, otherwise 0

Implements mars::interfaces::JointManagerInterface.

Definition at line 379 of file JointManager.cpp.

◆ getJointCount()

int mars::sim::JointManager::getJointCount ( )
virtual

Returns the number of joints added to the simulation.

Implements mars::interfaces::JointManagerInterface.

Definition at line 136 of file JointManager.cpp.

◆ getJointExchange()

void mars::sim::JointManager::getJointExchange ( unsigned long  id,
interfaces::core_objects_exchange obj 
)
virtual

Fills one core_object_exchange object with joint information of the joint with the given id.

Implements mars::interfaces::JointManagerInterface.

Definition at line 166 of file JointManager.cpp.

◆ getJointInterface()

interfaces::JointManagerInterface* mars::sim::JointManager::getJointInterface ( unsigned long  node_id)
private

◆ getListJoints()

void mars::sim::JointManager::getListJoints ( std::vector< interfaces::core_objects_exchange > *  jointList)
virtual

Fills a list of core_object_exchange objects with joint informations.

Implements mars::interfaces::JointManagerInterface.

Definition at line 155 of file JointManager.cpp.

◆ getLowStop()

sReal mars::sim::JointManager::getLowStop ( unsigned long  id) const
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 408 of file JointManager.cpp.

◆ getLowStop2()

sReal mars::sim::JointManager::getLowStop2 ( unsigned long  id) const
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 422 of file JointManager.cpp.

◆ getReloadJoint()

std::list< JointData >::iterator mars::sim::JointManager::getReloadJoint ( unsigned long  id)
private

Definition at line 283 of file JointManager.cpp.

◆ getSimJoint()

SimJoint * mars::sim::JointManager::getSimJoint ( unsigned long  id)
virtual

Returns a pointer to the SimJoint Object.

Implements mars::interfaces::JointManagerInterface.

Definition at line 222 of file JointManager.cpp.

◆ getSimJoints()

std::vector< SimJoint * > mars::sim::JointManager::getSimJoints ( void  )
virtual

Return a copy of the SimJointVector;.

Implements mars::interfaces::JointManagerInterface.

Definition at line 232 of file JointManager.cpp.

◆ reattacheJoints()

void mars::sim::JointManager::reattacheJoints ( unsigned long  node_id)
virtual

Reattaches the joints that are connected to the node with id node_id.

Implements mars::interfaces::JointManagerInterface.

Definition at line 242 of file JointManager.cpp.

◆ reloadJoints()

void mars::sim::JointManager::reloadJoints ( void  )
virtual

Reloads all joints in the simulation.

Implements mars::interfaces::JointManagerInterface.

Definition at line 253 of file JointManager.cpp.

◆ removeJoint()

void mars::sim::JointManager::removeJoint ( unsigned long  id)
virtual

Removes the joint with the given id.

Implements mars::interfaces::JointManagerInterface.

Definition at line 189 of file JointManager.cpp.

◆ removeJointByIDs()

void mars::sim::JointManager::removeJointByIDs ( unsigned long  id1,
unsigned long  id2 
)
virtual

removes the joint connecting the two nodes with the given ids

Parameters
id1the id of one of the nodes attached to the joint to be removed
id2the id of the other node attached to the joint to be removed

Implements mars::interfaces::JointManagerInterface.

Definition at line 206 of file JointManager.cpp.

◆ scaleReloadJoints()

void mars::sim::JointManager::scaleReloadJoints ( interfaces::sReal  x,
interfaces::sReal  y,
interfaces::sReal  z 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 306 of file JointManager.cpp.

◆ setForceLimit()

void mars::sim::JointManager::setForceLimit ( unsigned long  id,
interfaces::sReal  max_force,
bool  first_axis = 1 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 366 of file JointManager.cpp.

◆ setHighStop()

void mars::sim::JointManager::setHighStop ( unsigned long  id,
interfaces::sReal  highStop 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 443 of file JointManager.cpp.

◆ setHighStop2()

void mars::sim::JointManager::setHighStop2 ( unsigned long  id,
interfaces::sReal  highStop2 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 457 of file JointManager.cpp.

◆ setJointTorque()

void mars::sim::JointManager::setJointTorque ( unsigned long  id,
interfaces::sReal  torque 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 318 of file JointManager.cpp.

◆ setLowStop()

void mars::sim::JointManager::setLowStop ( unsigned long  id,
interfaces::sReal  lowStop 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 436 of file JointManager.cpp.

◆ setLowStop2()

void mars::sim::JointManager::setLowStop2 ( unsigned long  id,
interfaces::sReal  lowStop2 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 450 of file JointManager.cpp.

◆ setOfflineValue()

void mars::sim::JointManager::setOfflineValue ( unsigned long  id,
interfaces::sReal  value 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 400 of file JointManager.cpp.

◆ setReloadAnchor()

void mars::sim::JointManager::setReloadAnchor ( unsigned long  id,
const utils::Vector anchor 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 334 of file JointManager.cpp.

◆ setReloadJointAxis()

void mars::sim::JointManager::setReloadJointAxis ( unsigned long  id,
const utils::Vector axis 
)
virtual

Set a new axis for reloading a joint.

Implements mars::interfaces::JointManagerInterface.

Definition at line 298 of file JointManager.cpp.

◆ setReloadJointOffset()

void mars::sim::JointManager::setReloadJointOffset ( unsigned long  id,
interfaces::sReal  offset 
)
virtual

Set a new joint offset for reloading a joint.

Implements mars::interfaces::JointManagerInterface.

Definition at line 291 of file JointManager.cpp.

◆ setSDParams()

void mars::sim::JointManager::setSDParams ( unsigned long  id,
interfaces::JointData sJoint 
)
virtual

Implements mars::interfaces::JointManagerInterface.

Definition at line 342 of file JointManager.cpp.

◆ setVelocity()

void mars::sim::JointManager::setVelocity ( unsigned long  id,
interfaces::sReal  velocity 
)
virtual

sets the velocity of the first axis of the joint

Parameters
idthe id of the joint whos velocity should be set
thenew velocity

Implements mars::interfaces::JointManagerInterface.

Definition at line 350 of file JointManager.cpp.

◆ setVelocity2()

void mars::sim::JointManager::setVelocity2 ( unsigned long  id,
interfaces::sReal  velocity 
)
virtual

sets the velocity of the second axis of the joint

Parameters
idthe id of the joint whos velocity should be set
thenew velocity If the joint has no second axis the behaviour is undefined.

Implements mars::interfaces::JointManagerInterface.

Definition at line 358 of file JointManager.cpp.

◆ updateJoints()

void mars::sim::JointManager::updateJoints ( interfaces::sReal  calc_ms)
virtual

Update the Joint values from the physics.

Implements mars::interfaces::JointManagerInterface.

Definition at line 260 of file JointManager.cpp.

Member Data Documentation

◆ control

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

Definition at line 99 of file JointManager.h.

◆ iMutex

utils::Mutex mars::sim::JointManager::iMutex
mutableprivate

Definition at line 100 of file JointManager.h.

◆ next_joint_id

unsigned long mars::sim::JointManager::next_joint_id
private

Definition at line 96 of file JointManager.h.

◆ simJoints

std::map<unsigned long, SimJoint*> mars::sim::JointManager::simJoints
private

Definition at line 97 of file JointManager.h.

◆ simJointsReload

std::list<interfaces::JointData> mars::sim::JointManager::simJointsReload
private

Definition at line 98 of file JointManager.h.


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