##

JointController Class Reference
Physics

A class for manipulating physics::Joint. More...

`#include <physics/physics.hh>`

## Public Member Functions

| JointController (ModelPtr _model)
| Constructor. More...
virtual | ~JointController ()
| Destructor. More...
void | AddJoint (JointPtr _joint)
| Add a joint to control. More...
std::map< std::string, double > | GetForces () const
| Get all the applied forces. More...
std::map< std::string, JointPtr > | GetJoints () const
| Get all the joints. More...
common::Time | GetLastUpdateTime () const
| Get the last time the controller was updated. More...
std::map< std::string, common::PID > | GetPositionPIDs () const
| Get all the position PID controllers. More...
std::map< std::string, double > | GetPositions () const
| Get all the position PID set points. More...
std::map< std::string, double > | GetVelocities () const
| Get all the velocity PID set points. More...
std::map< std::string, common::PID > | GetVelocityPIDs () const
| Get all the velocity PID controllers. More...
void | RemoveJoint (Joint *_joint)
| Remove a joint from control. More...
void | Reset ()
| Reset all commands. More...
bool | SetForce (const std::string &_jointName, const double _force)
| Set the applied effort for the specified joint. More...
void | SetJointPosition (const std::string &_name, double _position, int _index=0)
| Set the positions of a Joint by name. More...
void | SetJointPosition (JointPtr _joint, double _position, int _index=0)
| Set the positions of a Joint by name The position is specified in native units, which means, if you are using metric system, it's meters for SliderJoint and radians for HingeJoint, etc. More...
void | SetJointPositions (const std::map< std::string, double > &_jointPositions)
| Set the positions of a set of Joint's. More...
void | SetPositionPID (const std::string &_jointName, const common::PID &_pid)
| Set the position PID values for a joint. More...
bool | SetPositionTarget (const std::string &_jointName, const double _target)
| Set the target position for the position PID controller. More...
void | SetVelocityPID (const std::string &_jointName, const common::PID &_pid)
| Set the velocity PID values for a joint. More...
bool | SetVelocityTarget (const std::string &_jointName, const double _target)
| Set the target velocity for the velocity PID controller. More...
void | Update ()
| Update the joint control. More...

## Detailed Description

A class for manipulating physics::Joint.

## Constructor & Destructor Documentation

## JointController()

JointController | ( | ModelPtr | _model | ) |

explicit

Constructor.

Parameters

  [in] | _model | Model that uses this joint controller.

## ~JointController()

virtual ~JointController | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## AddJoint()

void AddJoint | ( | JointPtr | _joint | ) |

Add a joint to control.

Parameters

  [in] | _joint | Joint to control.

## GetForces()

std::map<std::string, double> GetForces | ( |  | ) | const

Get all the applied forces.

Returns
  A map<joint_name, force> that contains force values set by the user of the JointController.

## GetJoints()

std::map<std::string, JointPtr> GetJoints | ( |  | ) | const

Get all the joints.

Returns
  A map<joint_name, joint_ptr> to all the joints that can be controlled.

## GetLastUpdateTime()

common::Time GetLastUpdateTime | ( |  | ) | const

Get the last time the controller was updated.

Returns
  Last time the controller was updated.

## GetPositionPIDs()

std::map<std::string, common::PID> GetPositionPIDs | ( |  | ) | const

Get all the position PID controllers.

Returns
  A map<joint_name, PID> for all the position PID controllers.

## GetPositions()

std::map<std::string, double> GetPositions | ( |  | ) | const

Get all the position PID set points.

Returns
  A map<joint_name, position> that contains position values set by the user of the JointController.

## GetVelocities()

std::map<std::string, double> GetVelocities | ( |  | ) | const

Get all the velocity PID set points.

Returns
  A map<joint_name, position> that contains velocity values set by the user of the JointController.

## GetVelocityPIDs()

std::map<std::string, common::PID> GetVelocityPIDs | ( |  | ) | const

Get all the velocity PID controllers.

Returns
  A map<joint_name, PID> for all the velocity PID controllers.

## RemoveJoint()

void RemoveJoint | ( | Joint * | _joint | ) |

Remove a joint from control.

Parameters

  [in] | _joint | Joint to remove.

## Reset()

void Reset | ( |  | ) |

Reset all commands.

## SetForce()

bool SetForce | ( | const std::string & | _jointName,
|  | const double | _force
| ) |  |

Set the applied effort for the specified joint.

This force will persist across time steps.

Parameters

  [in] | _jointName | Scoped name of the joint.
  [in] | _force | Force to apply.

Returns
  False if the joint was not found.

## SetJointPosition() [1/2]

void SetJointPosition | ( | const std::string & | _name,
|  | double | _position,
|  | int | _index = `0`
| ) |  |

Set the positions of a Joint by name.

See also
  JointController::SetJointPosition(JointPtr, double)

## SetJointPosition() [2/2]

void SetJointPosition | ( | JointPtr | _joint,
|  | double | _position,
|  | int | _index = `0`
| ) |  |

Set the positions of a Joint by name The position is specified in native units, which means, if you are using metric system, it's meters for SliderJoint and radians for HingeJoint, etc.

Implementation: In order to change the position of a Joint inside a Model, this call must recursively crawl through all the connected children Link's in this Model, and update each Link Pose affected by this Joint angle update. Warning: There is no constraint satisfaction being done here, traversal through the kinematic graph has unexpected behavior if you try to set the joint position of a link inside a loop structure. Warning:

Parameters

  [in] | _joint | Joint to set.
  [in] | _position | Position of the joint.

## SetJointPositions()

void SetJointPositions | ( | const std::map< std::string, double > & | _jointPositions | ) |

Set the positions of a set of Joint's.

See also
  JointController::SetJointPosition(JointPtr, double)

## SetPositionPID()

void SetPositionPID | ( | const std::string & | _jointName,
|  | const common::PID & | _pid
| ) |  |

Set the position PID values for a joint.

Parameters

  [in] | _jointName | Scoped name of the joint.
  [in] | _pid | New position PID controller.

## SetPositionTarget()

bool SetPositionTarget | ( | const std::string & | _jointName,
|  | const double | _target
| ) |  |

Set the target position for the position PID controller.

Parameters

  [in] | _jointName | Scoped name of the joint.
  [in] | _target | Position target.

Returns
  False if the joint was not found.

## SetVelocityPID()

void SetVelocityPID | ( | const std::string & | _jointName,
|  | const common::PID & | _pid
| ) |  |

Set the velocity PID values for a joint.

Parameters

  [in] | _jointName | Scoped name of the joint.
  [in] | _pid | New velocity PID controller.

## SetVelocityTarget()

bool SetVelocityTarget | ( | const std::string & | _jointName,
|  | const double | _target
| ) |  |

Set the target velocity for the velocity PID controller.

Parameters

  [in] | _jointName | Scoped name of the joint.
  [in] | _target | Velocity target.

Returns
  False if the joint was not found.

## Update()

void Update | ( |  | ) |

Update the joint control.

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

- JointController.hh