RoboDK Plug-In Interface
tJoints Class Reference

The tJoints class represents a joint position of a robot (robot axes). More...

#include <robodktypes.h>

Public Member Functions

 tJoints (int ndofs=0)
 tJoints More...
 
 tJoints (const double *joints, int ndofs=0)
 Set joint values given a double array and the number of joint values. More...
 
 tJoints (const float *joints, int ndofs=0)
 Set joint values given a float array and the number of joint values. More...
 
 tJoints (const tJoints &jnts)
 Create a copy of an object. More...
 
 tJoints (const tMatrix2D *mat2d, int column=0, int ndofs=-1)
 Create joint values given a 2D matrix and the column selecting the desired values. More...
 
 tJoints (const QString &str)
 Convert a string to joint values. More...
 
 operator QString () const
 To String operator (use with qDebug() << tJoints;. More...
 
const double * ValuesD () const
 Joint values. More...
 
const float * ValuesF () const
 Joint values. More...
 
const double * Values () const
 Joint values. More...
 
double Compare (const tJoints &other) const
 
double * Data ()
 
int Length () const
 Number of joint axes of the robot (or degrees of freedom) More...
 
void setLength (int new_length)
 Set the length of the array (only shrinking the array is allowed) More...
 
bool Valid ()
 Check if the joints are valid. For example, when we request the Inverse kinematics and there is no solution the joints will not be valid. (for example, an invalid result after calling class: IItem::SolveIK returns a non valid joints) More...
 
int GetValues (double *joints)
 GetValues. More...
 
void SetValues (const double *joints, int ndofs=-1)
 Set the joint values in deg or mm. You can also important provide the number of degrees of freedom (6 for a 6 axis robot). More...
 
void SetValues (const float *joints, int ndofs=-1)
 Set the joint values in deg or mm (floats). You can also important provide the number of degrees of freedom (6 for a 6 axis robot). More...
 
QString ToString (const QString &separator=", ", int precision=3) const
 Retrieve a string representation of the joint values. More...
 
bool FromString (const QString &str)
 Set the joint values given a comma-separated string. Tabs and spaces are also allowed. More...
 

Public Attributes

int _nDOFs
 number of degrees of freedom More...
 
double _Values [RDK_SIZE_JOINTS_MAX]
 joint values (doubles, used to store the joint values) More...
 
float _ValuesF [RDK_SIZE_JOINTS_MAX]
 joint values (floats, used to return a copy as a float pointer) More...
 

Detailed Description

The tJoints class represents a joint position of a robot (robot axes).

Definition at line 239 of file robodktypes.h.

Constructor & Destructor Documentation

◆ tJoints() [1/6]

tJoints ( int  ndofs = 0)

tJoints

Parameters
ndofsnumber of robot joint axes or degrees of freedom

Definition at line 8 of file robodktypes.cpp.

◆ tJoints() [2/6]

tJoints ( const double *  joints,
int  ndofs = 0 
)

Set joint values given a double array and the number of joint values.

Parameters
jointsPointer to the joint values
ndofsNumber of joints

Definition at line 17 of file robodktypes.cpp.

◆ tJoints() [3/6]

tJoints ( const float *  joints,
int  ndofs = 0 
)

Set joint values given a float array and the number of joint values.

Parameters
jointsPointer to the joint values
ndofsNumber of joints

Definition at line 20 of file robodktypes.cpp.

◆ tJoints() [4/6]

tJoints ( const tJoints jnts)

Create a copy of an object.

Parameters
jnts

Definition at line 14 of file robodktypes.cpp.

◆ tJoints() [5/6]

tJoints ( const tMatrix2D mat2d,
int  column = 0,
int  ndofs = -1 
)

Create joint values given a 2D matrix and the column selecting the desired values.

Parameters
mat2d
column
ndofs

Definition at line 28 of file robodktypes.cpp.

◆ tJoints() [6/6]

tJoints ( const QString &  str)

Convert a string to joint values.

Parameters
strComma separated joint values (spaces or tabs are also accepted)

Definition at line 41 of file robodktypes.cpp.

Member Function Documentation

◆ Compare()

double Compare ( const tJoints other) const

Definition at line 65 of file robodktypes.cpp.

◆ Data()

double * Data ( )
Returns
Data same as Values. The only difference is that the array pointer is not const. This is provided for backwards compatibility.

Definition at line 73 of file robodktypes.cpp.

◆ FromString()

bool FromString ( const QString &  str)

Set the joint values given a comma-separated string. Tabs and spaces are also allowed.

Parameters
strstring. Such as "10, 20, 30, 40, 50, 60"
Returns
false if parsing the string failed. True otherwise.

Definition at line 113 of file robodktypes.cpp.

◆ GetValues()

int GetValues ( double *  joints)

GetValues.

Parameters
jointsjoint values in deg or mm
Returns
returns the number of degrees of freedom

Definition at line 95 of file robodktypes.cpp.

◆ Length()

int Length ( ) const

Number of joint axes of the robot (or degrees of freedom)

Returns

Definition at line 123 of file robodktypes.cpp.

◆ operator QString()

operator QString ( ) const
inline

To String operator (use with qDebug() << tJoints;.

Definition at line 271 of file robodktypes.h.

◆ setLength()

void setLength ( int  new_length)

Set the length of the array (only shrinking the array is allowed)

Definition at line 126 of file robodktypes.cpp.

◆ SetValues() [1/2]

void SetValues ( const double *  joints,
int  ndofs = -1 
)

Set the joint values in deg or mm. You can also important provide the number of degrees of freedom (6 for a 6 axis robot).

Parameters
jointsjoint values in deg or mm
ndofsnumber of degrees of freedom (number of axes or joints)

Definition at line 78 of file robodktypes.cpp.

◆ SetValues() [2/2]

void SetValues ( const float *  joints,
int  ndofs = -1 
)

Set the joint values in deg or mm (floats). You can also important provide the number of degrees of freedom (6 for a 6 axis robot).

Parameters
jointsjoint values in deg or mm
ndofsnumber of degrees of freedom (number of axes or joints)

Definition at line 87 of file robodktypes.cpp.

◆ ToString()

QString ToString ( const QString &  separator = ", ",
int  precision = 3 
) const

Retrieve a string representation of the joint values.

Parameters
separatorString to add between consecutive joint values
precisionNumber of decimals
Returns
string as a QString

Definition at line 101 of file robodktypes.cpp.

◆ Valid()

bool Valid ( )

Check if the joints are valid. For example, when we request the Inverse kinematics and there is no solution the joints will not be valid. (for example, an invalid result after calling class: IItem::SolveIK returns a non valid joints)

Returns
true if it has 1 degree of freedom or more

Definition at line 131 of file robodktypes.cpp.

◆ Values()

const double * Values ( ) const

Joint values.

Returns
Returns a pointer to the joint data array (doubles or floats if ROBODK_API_FLOATS is defined)

Definition at line 60 of file robodktypes.cpp.

◆ ValuesD()

const double * ValuesD ( ) const

Joint values.

Returns
Returns a pointer to the joint data array (doubles)

Definition at line 46 of file robodktypes.cpp.

◆ ValuesF()

const float * ValuesF ( ) const

Joint values.

Returns
Returns a pointer to the joint data array (floats)

Definition at line 49 of file robodktypes.cpp.

Member Data Documentation

◆ _nDOFs

int _nDOFs

number of degrees of freedom

Definition at line 340 of file robodktypes.h.

◆ _Values

double _Values[RDK_SIZE_JOINTS_MAX]

joint values (doubles, used to store the joint values)

Definition at line 343 of file robodktypes.h.

◆ _ValuesF

float _ValuesF[RDK_SIZE_JOINTS_MAX]

joint values (floats, used to return a copy as a float pointer)

Definition at line 346 of file robodktypes.h.


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