base
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
base::JointState Struct Reference

#include <JointState.hpp>

Public Types

enum  MODE {
  POSITION, SPEED, EFFORT, RAW,
  ACCELERATION, UNSET
}
 

Public Member Functions

 JointState ()
 
bool hasPosition () const
 
bool hasSpeed () const
 
bool hasEffort () const
 
bool hasRaw () const
 
bool hasAcceleration () const
 
bool isPosition () const
 
bool isSpeed () const
 
bool isEffort () const
 
bool isRaw () const
 
bool isAcceleration () const
 
double getField (int mode) const
 
void setField (int mode, double value)
 
MODE getMode () const
 

Static Public Member Functions

static JointState Position (double value)
 
static JointState Speed (float value)
 
static JointState Effort (float value)
 
static JointState Raw (float value)
 
static JointState Acceleration (float value)
 

Public Attributes

double position
 
float speed
 
float effort
 
float raw
 
float acceleration
 

Detailed Description

Representation of the state of a given joint

The joint does not have to necessarily be actuated. This type is also used as inputs to controller, in which case the setpoints should be tested with the has* and is* predicates (e.g. hasPosition(), ...)

The values given in such structures can only be interpreted when associated with kinematics data. In Rock, see the control/robot_model package for more information.

Member Enumeration Documentation

◆ MODE

Enumerator
POSITION 
SPEED 
EFFORT 
RAW 
ACCELERATION 
UNSET 

Constructor & Destructor Documentation

◆ JointState()

base::JointState::JointState ( )
inline

Member Function Documentation

◆ Acceleration()

JointState base::JointState::Acceleration ( float  value)
static

Returns a JointState object with the acceleration field set to the given value

◆ Effort()

JointState base::JointState::Effort ( float  value)
static

Returns a JointState object with the effort field set to the given value

◆ getField()

double base::JointState::getField ( int  mode) const

Returns the field that matches the given mode

See also
MODE

◆ getMode()

JointState::MODE base::JointState::getMode ( ) const

Returns the mode of this JointState

The mode is defined only if the structure has only one field set. runtime_error is thrown if this is called with more than one field set.

See also
MODE

◆ hasAcceleration()

bool base::JointState::hasAcceleration ( ) const

Tests whether the acceleration field is set

◆ hasEffort()

bool base::JointState::hasEffort ( ) const

Tests whether the effort field is set

◆ hasPosition()

bool base::JointState::hasPosition ( ) const

Tests whether the position field is set

◆ hasRaw()

bool base::JointState::hasRaw ( ) const

Tests whether the raw field is set

◆ hasSpeed()

bool base::JointState::hasSpeed ( ) const

Tests whether the speed field is set

◆ isAcceleration()

bool base::JointState::isAcceleration ( ) const

Tests whether the acceleration field is the only field set

This is commonly used in controllers to test whether this data structure is a valid command for said controller (e.g. a hardware driver that is controlled in acceleration would throw if isAcceleration() returns false)

◆ isEffort()

bool base::JointState::isEffort ( ) const

Tests whether the effort field is the only field set

This is commonly used in controllers to test whether this data structure is a valid command for said controller (e.g. a torque controller would throw if isEffort() returns false)

◆ isPosition()

bool base::JointState::isPosition ( ) const

Tests whether the position field is the only field set

This is commonly used in controllers to test whether this data structure is a valid command for said controller (e.g. a position controller would throw if isPosition() returns false)

◆ isRaw()

bool base::JointState::isRaw ( ) const

Tests whether the raw field is the only field set

This is commonly used in controllers to test whether this data structure is a valid command for said controller (e.g. a hardware driver that is controlled in PWM would throw if isRaw() returns false)

◆ isSpeed()

bool base::JointState::isSpeed ( ) const

Tests whether the speed field is the only field set

This is commonly used in controllers to test whether this data structure is a valid command for said controller (e.g. a speed controller would throw if isSpeed() returns false)

◆ Position()

JointState base::JointState::Position ( double  value)
static

Returns a JointState object with the position field set to the given value

◆ Raw()

JointState base::JointState::Raw ( float  value)
static

Returns a JointState object with the raw field set to the given value

◆ setField()

void base::JointState::setField ( int  mode,
double  value 
)

Sets the given field to the given value

See also
MODE

◆ Speed()

JointState base::JointState::Speed ( float  value)
static

Returns a JointState object with the speed field set to the given value

Member Data Documentation

◆ acceleration

float base::JointState::acceleration

Acceleration in radians per square second for angular actuators, in m/ss for linear ones

◆ effort

float base::JointState::effort

Torque in N.m for angular joints and N for linear ones

◆ position

double base::JointState::position

Current position of the actuator, in radians for angular joints, in m for linear ones

For angular joints that can move more than 360 degrees, this accumulates the movement since initialization

If the joint is an angular joint whose motion is constrained to less than one full turn, the value should be in [-PI, PI]. base::Angle could be used to manipulate it before setting it in this structure

If the joint is an unconstrained angular joint (e.g. a wheel joint), the range is [-inf, inf]

◆ raw

float base::JointState::raw

Raw command to/from the actuator, if this is an actuated joint. It is commonly a PWM value in [0,1]

◆ speed

float base::JointState::speed

Speed in radians per second for angular actuators, in m/s for linear ones

This is an instantaneous speed. It means that, considering two consecutive JointState samples, (position1 - position0)/(time1 - * time0).toSeconds() is not necessarily equal to 'speed'


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