RobWorkProject
24.12.4-
|
A constraint is a mathematical model that constrain the movement between two arbitrary bodies in a dynamic simulation. More...
#include <Constraint.hpp>
Inherits StateData.
Classes | |
struct | Limit |
Definition of a limit for one single degree of freedom. More... | |
struct | SpringParams |
Parameters for a spring. More... | |
Public Types | |
enum | ConstraintType { Fixed , Prismatic , Revolute , Universal , Spherical , Piston , PrismaticRotoid , PrismaticUniversal , Free } |
The different constraint types. More... | |
typedef rw::core::Ptr< Constraint > | Ptr |
smart pointer type to this class | |
Public Member Functions | |
Constraint (const std::string &name, const ConstraintType &type, Body *b1, Body *b2) | |
Construct new constraint. More... | |
virtual | ~Constraint () |
Destructor. | |
ConstraintType | getType () const |
Get the type of constraint. More... | |
Body * | getBody1 () const |
Get a pointer to Body 1. More... | |
Body * | getBody2 () const |
Get a pointer to Body 2. More... | |
size_t | getDOF () const |
Get the degrees of freedom of the constraint. More... | |
size_t | getDOFLinear () const |
Get the linear degrees of freedom of the constraint. More... | |
size_t | getDOFAngular () const |
Get the angular degrees of freedom of the constraint. More... | |
rw::math::Transform3D | getTransform () const |
Get the transform of the constraint, relative to the parents body frame. More... | |
void | setTransform (const rw::math::Transform3D<> &parentTconstraint) |
Set the transform of the constraint, relative to the parents body frame. More... | |
SpringParams | getSpringParams () const |
Get the spring parameters. More... | |
void | setSpringParams (const SpringParams ¶ms) |
Set spring parameters. More... | |
Limit | getLimit (std::size_t i) const |
Get limit information. More... | |
void | setLimit (std::size_t i, const Limit &limit) |
Set limit. More... | |
Public Member Functions inherited from StateData | |
virtual | ~StateData () |
destructor | |
int | getID () const |
An integer ID for the StateData. More... | |
const std::string & | getName () const |
The name of the state data. More... | |
int | size () const |
The number of doubles allocated by this StateData in each State object. More... | |
const double * | getData (const rw::kinematics::State &state) const |
An array of length size() containing the values for the state data. More... | |
double * | getData (rw::kinematics::State &state) |
An array of length size() containing the values for the state data. More... | |
void | setData (rw::kinematics::State &state, const double *vals) const |
Assign for state data the size() of values of the array vals. More... | |
void | setData (rw::kinematics::State &state, const std::vector< double > &vals) const |
Assign for state data the size() of values of the array vals. More... | |
void | setData (rw::kinematics::State &state, const double &val) const |
Assign for state data the size() of values of the array vals. More... | |
bool | hasCache () const |
Check is state data includes a cache. More... | |
rw::core::Ptr< rw::kinematics::StateCache > | getCache (const rw::kinematics::State &state) const |
Get the cache. More... | |
rw::core::Ptr< rw::kinematics::StateCache > | getCache (rw::kinematics::State &state) |
Get the cache. . More... | |
rw::core::Ptr< rw::kinematics::StateCache > | getDefaultCache () |
Get default cache. More... | |
void | setCache (rw::core::Ptr< rw::kinematics::StateCache > cache, rw::kinematics::State &state) |
Set the cache values. More... | |
class rw::kinematics::StateStructure * | getStateStructure () |
Get the state structure. More... | |
bool | operator== (const StateData &rhs) |
Compares the state data to see if they are the same Checks the ID, name and which statetrucure they belong to. More... | |
bool | operator!= (const StateData &rhs) |
Check if not equal. More... | |
StateData (int size, const std::string &name) | |
A state with size number of doubles in the State vector. More... | |
StateData (int size, const std::string &name, rw::core::Ptr< rw::kinematics::StateCache > cache) | |
A state with size number of doubles in the State vector. More... | |
Static Public Member Functions | |
static bool | toConstraintType (const std::string &string, ConstraintType &type) |
Convert a string to a ConstraintType. More... | |
A constraint is a mathematical model that constrain the movement between two arbitrary bodies in a dynamic simulation.
For a device the Link and Joint types should be used to specify the constraints.
The Constraint type can however be used between any two bodies. For instance between two free bodies, or between a free body and a link of a device.
All functions in this class are thread-safe. Only the transform of the constraint and the spring parameters can be changed after creation of the constraint.
enum ConstraintType |
The different constraint types.
Constraint | ( | const std::string & | name, |
const ConstraintType & | type, | ||
Body * | b1, | ||
Body * | b2 | ||
) |
Construct new constraint.
name | [in] a unique name identifying the constraint. |
type | [in] the type of constraint. |
b1 | [in] the parent body to attach the constraint to. |
b2 | [in] the child body to attach the constraint to. |
size_t getDOF | ( | ) | const |
Get the degrees of freedom of the constraint.
size_t getDOFAngular | ( | ) | const |
Get the angular degrees of freedom of the constraint.
size_t getDOFLinear | ( | ) | const |
Get the linear degrees of freedom of the constraint.
Limit getLimit | ( | std::size_t | i | ) | const |
Get limit information.
i | [in] the degree of freedom to get limit information for. |
SpringParams getSpringParams | ( | ) | const |
Get the spring parameters.
rw::math::Transform3D getTransform | ( | ) | const |
Get the transform of the constraint, relative to the parents body frame.
ConstraintType getType | ( | ) | const |
Get the type of constraint.
void setLimit | ( | std::size_t | i, |
const Limit & | limit | ||
) |
Set limit.
i | [in] the degree of freedom to set limit information for. |
limit | [in] the limit information. |
void setSpringParams | ( | const SpringParams & | params | ) |
Set spring parameters.
params | [in] SpringParams structure. |
void setTransform | ( | const rw::math::Transform3D<> & | parentTconstraint | ) |
Set the transform of the constraint, relative to the parents body frame.
parentTconstraint | [in] the transform relative to the parent, \(\bf{T}_{parent}^{constraint}\). |
|
static |
Convert a string to a ConstraintType.
string | [in] the string to convert. |
type | [in/out] the result of the convertion. |