31 #define _USE_MATH_DEFINES 36 #include <Rcs_typedef.h> 37 #include <Rcs_joint.h> 51 return RcsJoint_isRotation(joint) && joint->q_min == -M_PI && joint->q_max == M_PI;
55 graph(graph), wrapJointAngle(wrapJointAngle)
57 joint = RcsGraph_getJointByName(graph, jointName);
59 std::ostringstream os;
60 os <<
"Unable to find joint " << jointName <<
" in graph.";
61 throw std::invalid_argument(os.str());
63 if (wrapJointAngle && !RcsJoint_isRotation(
joint)) {
64 std::ostringstream os;
65 os <<
"Joint " << jointName <<
" is not a rotation joint, so we cannot wrap the joint angle.";
66 throw std::invalid_argument(os.str());
102 q = Math_fmodAngle(q);
105 *velocity =
graph->q_dot->ele[
joint->jointIndex];
111 *minState =
joint->q_min;
112 *maxState =
joint->q_max;
113 *maxVelocity =
joint->speedLimit;
118 return {
joint->name};
124 RCSGRAPH_TRAVERSE_JOINTS(graph) {
133 RCSGRAPH_TRAVERSE_JOINTS(graph) {
134 if (!JNT->constrained) {
virtual unsigned int getVelocityDim() const
OMJointStatePositions(RcsGraph *graph, const char *jointName, bool wrapJointAngle)
static ObservationModel * observeUnconstrainedJoints(RcsGraph *graph)
virtual std::vector< std::string > getStateNames() const
static bool defaultWrapJointAngle(RcsJoint *joint)
static ObservationModel * observeAllJoints(RcsGraph *graph)
virtual unsigned int getStateDim() const
virtual void computeObservation(double *state, double *velocity, const MatNd *currentAction, double dt) const
virtual void getLimits(double *minState, double *maxState, double *maxVelocity) const
OMJointState(RcsGraph *graph, const char *jointName, bool wrapJointAngle)
virtual unsigned int getVelocityDim() const