20 template <
size_t NJOINTS,
typename SCALAR =
double>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32 typedef Eigen::Matrix<SCALAR, NJOINTS, 1>
Position;
33 typedef Eigen::Matrix<SCALAR, NJOINTS, 1>
Velocity;
60 inline bool operator<(const JointState<NJOINTS, SCALAR>& rhs)
const 62 return (this->array() < rhs.array()).isConstant(1);
67 return (this->array() > rhs.array()).isConstant(1);
83 assert(i < NJOINTS &&
"Invalid joint index");
89 assert(i < NJOINTS &&
"Invalid joint index");
97 assert(lowerLimitVec.size() == NJOINTS &&
"Wrong limit dimensions");
98 for (
size_t i = 0;
i < NJOINTS; ++
i)
104 if (std::abs(k_lower) <= std::abs(k_upper))
109 else if (k_upper != 0)
115 template <
typename T>
118 assert(lowerLimit.size() == NJOINTS && upperLimit.size() == NJOINTS &&
"Wrong limit dimensions");
119 for (
size_t i = 0;
i < NJOINTS;
i++)
138 assert(i < NJOINTS &&
"Invalid joint index");
139 return state_(NJOINTS + i);
144 assert(i < NJOINTS &&
"Invalid joint index");
145 return state_(NJOINTS + i);
149 template <
typename T>
152 assert(limit.size() == NJOINTS &&
"Wrong limit dimension");
153 for (
size_t i = 0;
i < NJOINTS; ++
i)
NDOFS
Definition: JointState.h:26
Eigen::VectorBlock< const joint_state_vector_t, NJOINTS > JointPositionBlockConst
Definition: JointState.h:36
JointState< NJOINTS, SCALAR > operator-(const JointState< NJOINTS, SCALAR > &rhs) const
Definition: JointState.h:46
const joint_state_vector_t & toImplementation() const
Definition: JointState.h:161
bool operator!=(const JointState< NJOINTS, SCALAR > &rhs) const
Definition: JointState.h:41
joint state and joint velocity
Definition: JointState.h:21
const SCALAR & getVelocity(size_t i) const
Definition: JointState.h:142
Eigen::VectorBlock< joint_state_vector_t, NJOINTS > JointPositionBlock
Definition: JointState.h:35
joint_state_vector_t state_
Definition: JointState.h:169
bool isApprox(const JointState< NJOINTS, SCALAR > &rhs, const SCALAR &tol=1e-10)
Definition: JointState.h:70
bool operator==(const JointState &rhs) const
Definition: JointState.h:40
CppAD::AD< CppAD::cg::CG< double > > SCALAR
bool checkVelocityLimits(T limit)
check joint velocity limits
Definition: JointState.h:150
Eigen::Matrix< SCALAR, NJOINTS, 1 > Position
Definition: JointState.h:32
JointPositionBlock getVelocities()
get joint velocity
Definition: JointState.h:131
Eigen::Matrix< SCALAR, NJOINTS, 1 > Velocity
Definition: JointState.h:33
JointState< NJOINTS, SCALAR > operator*(const SCALAR &scalar) const
Definition: JointState.h:51
JointState(const joint_state_vector_t &state)
Definition: JointState.h:39
SCALAR & getVelocity(size_t i)
Definition: JointState.h:136
bool operator>(const JointState< NJOINTS, SCALAR > &rhs) const
Definition: JointState.h:65
void toUniquePosition(T lowerLimitVec, double tolerance=0.0)
normalize the joint state to be in the range [lowerLimitVec, lowerLimitVec + 2pi) ...
Definition: JointState.h:95
JointState()
Definition: JointState.h:38
const SCALAR & getPosition(size_t i) const
Definition: JointState.h:87
JointState< NJOINTS, SCALAR > operator/(const SCALAR &scalar) const
Definition: JointState.h:55
SCALAR & getPosition(size_t i)
Definition: JointState.h:81
JointState< NJOINTS, SCALAR > operator+(const JointState< NJOINTS, SCALAR > &rhs) const
Definition: JointState.h:42
joint_state_vector_t & toImplementation()
Definition: JointState.h:159
void setZero()
set states to zero
Definition: JointState.h:164
Eigen::Matrix< SCALAR, 2 *NJOINTS, 1 > joint_state_vector_t
Definition: JointState.h:31
const double tolerance
Definition: JointStateTest.cpp:15
JointPositionBlock getPositions()
get joint state
Definition: JointState.h:76
bool checkPositionLimits(const T lowerLimit, const T upperLimit, const double tolerance=0.0)
check joint position limits assuming limits and joint position are in the same range e...
Definition: JointState.h:116
const JointPositionBlockConst getVelocities() const
get constant joint velocity
Definition: JointState.h:134
const JointPositionBlockConst getPositions() const
get constant joint state
Definition: JointState.h:79
void setRandom()
Definition: JointState.h:166