12 "prismatic",
"revolute",
"continuous"};
16 for (
unsigned int i = 0; i <=
TYPE_MAX; ++i)
18 return static_cast<Type>(i);
25 if (type <= TYPE_MAX && type >= 0)
84 for (
unsigned int i = 0; i <
n -
top_; ++i)
99 for (
unsigned int i = 0; i <
n; i++)
106 for (
unsigned int i = 0; i <
n -
top_ && ret; ++i)
107 ret &= (q[i] <=
upper[i]) && (q[i] >=
lower[i]);
116 const Eigen::Ref<const Eigen::VectorXd> &b)
const 118 double d = (a.head(
n -
top_) - b.head(
n -
top_)).norm();
126 const Eigen::Ref<const Eigen::VectorXd> &to,
double t,
127 Eigen::Ref<Eigen::VectorXd> state)
const 129 for (
unsigned int i = 0; i <
n -
top_; ++i)
130 state[i] = from[i] + (to[i] - from[i]) * t;
134 const unsigned int i =
n - 1;
135 double diff = to[i] - from[i];
137 state[i] = from[i] + diff * t;
140 double &v = state[i];
143 v = from[i] - diff * t;
153 Eigen::VectorXd nlower(
n);
154 Eigen::VectorXd nupper(
n);
156 nlower.head(
n - 1) =
lower;
157 nupper.head(
n - 1) =
upper;
std::pair< Eigen::VectorXd, Eigen::VectorXd > getBounds() const
Get the bounds for this joint. For continuous joints, [-pi, pi] is returned.
static const std::string TYPE_STRINGS[]
String representation of joint type.
bool inBounds(const Eigen::Ref< const Eigen::VectorXd > &q) const
Checks if joint limits are satisfied for a joint configuration.
Revolute joint, rotates. Uses Euclidean metric.
void setRandom(Eigen::Ref< Eigen::VectorXd > q) const
sets the Joint at a random state respecting the limits.
Joint(const std::string &name, Type type, const Eigen::VectorXd &lower, const Eigen::VectorXd &upper)
Constructor. Takes in name of joint (the frame this joint is associated with, normally) and the joint...
static const std::string & typeToString(const Type &type)
Converts a joint type into its string representation.
double uniformReal(double lower, double upper)
Return a uniform random number between lower and upper.
Prismatic joint, extends along X-axis.
Revolute joint, rotates. Continuous rotation, uses SO(2) metric.
void enforceBounds(Eigen::Ref< Eigen::VectorXd > q) const
Enforces joint limits on a joint configuration.
const unsigned int top_
Top index for internal computations.
const Eigen::VectorXd upper
Upper limits of this frame's joint value (closed).
Fixed joint, just a rigid transformation.
const Eigen::VectorXd lower
Lower limits of this frame's joint value (closed).
Floating joint, free movement in SE(2). Continuous rotation, uses SE(2) metric.
std::string printDebug() const
Print debug information about this frame.
void interpolate(const Eigen::Ref< const Eigen::VectorXd > &from, const Eigen::Ref< const Eigen::VectorXd > &to, double t, Eigen::Ref< Eigen::VectorXd > state) const
Interpolate between two joint configurations.
static const unsigned int TYPE_MAX
Maximum value a joint type can have.
const std::vector< KDL::Joint > joints
Underlying KDL joints.
static Type stringToType(const std::string &joint)
Try to convert a string into a joint type. Not case-sensitive.
Translating joint, free X- and Y-axis movement.
const bool fixed
Is this joint fixed?
std::string printVector(const Eigen::VectorXd &v, unsigned int precision=4)
Returns a string of a vector's contents.
std::string format(const std::string &fmt, Args &&... args)
const bool continuous
Is this a continuous type joint?
const Type type
Type of joint.
const unsigned int n
Number of joints.
double distance(const Eigen::Ref< const Eigen::VectorXd > &a, const Eigen::Ref< const Eigen::VectorXd > &b) const
Measures distance between two joint configurations.
Floating joint, free movement in SE(2). Uses Euclidean metric.
double angleDistance(double v1, double v2)
Return the minimum distance between two angles (wrapping from -pi to pi).
T emplace_back(T... args)