37#include "legacymatrix2d.h"
52 _dofCount = std::min(ndofs, MaximumJoints);
66 int ndofs_ok = std::min(ndofs, MaximumJoints);
67 double jnts[MaximumJoints];
69 for (
int i=0; i < ndofs_ok; i++)
78 if (column >= Matrix2D_GetDimension(mat2d, 2))
84 ndofs = Matrix2D_GetDimension(mat2d, 1);
88 double *ptr = Matrix2D_GetColumn(mat2d, column);
105 for (
int i = 0; i < MaximumJoints; i++)
113#ifdef ROBODK_API_FLOATS
125double Joints::Compare(
const Joints &other)
const
127 double sum_diff = 0.0;
147 if (new_length >= 0 && new_length <
_dofCount)
195QString Joints::ToString(
const QString &separator,
int precision)
const
202 values.append(separator);
204 values.append(QString::number(
_joints[i],
'f', precision));
209bool Joints::FromString(
const QString &str)
211 const QLatin1Char separator(
',');
214 s.replace(QLatin1Char(
';'), separator);
215 s.replace(QLatin1Char(
'\t'), separator);
217#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
218 const QString::SplitBehavior behavior = QString::SkipEmptyParts;
220 const Qt::SplitBehavior behavior = Qt::SkipEmptyParts;
223 QStringList jointList = s.split(separator, behavior);
224 _dofCount = qMin(jointList.length(), MaximumJoints);
227 _joints[i] = jointList[i].trimmed().toDouble();
The Joints class represents a joint position of a robot (robot axes).
int GetValues(double *joints)
GetValues.
float _jointsFloat[MaximumJoints]
joint values (floats, used to return a copy as a float pointer)
int Length() const
Number of joint axes of the robot (or degrees of freedom)
double _joints[MaximumJoints]
joint values (doubles, used to store the joint values)
const double * Values() const
Joint values.
bool Valid()
Check if the joints are valid. For example, when we request the Inverse kinematics and there is no so...
int _dofCount
number of degrees of freedom
const double * ValuesD() const
Joint values.
void setLength(int new_length)
Set the length of the array (only shrinking the array is allowed)
const float * ValuesF() const
Joint values.
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...
The Matrix2D struct represents a variable size 2D matrix.