51 double percent =
static_cast<double>(
parameters_.SafePercentage);
53 N =
scene_->GetKinematicTree().GetNumControlledJoints();
56 ThrowNamed(
"Timestep dt needs to be greater than 0");
69 ThrowNamed(
"Maximum joint velocity vector needs to be either of size 1 or N, but got " <<
parameters_.MaximumJointVelocity.rows());
74 if (
debug_)
HIGHLIGHT_NAMED(
"JointVelocityLimit",
"dt=" <<
dt_ <<
", q̇_max=" << limits_.transpose() <<
", τ=" << tau_.transpose());
85 if (phi.rows() !=
N)
ThrowNamed(
"Wrong size of phi!");
86 if (!x.isApprox(
kinematics[0].X))
ThrowNamed(
"The internal kinematics.X and passed state reference x do not match!\n x=" << std::setprecision(6) << x.transpose() <<
"\n X=" <<
kinematics[0].X.transpose() <<
"\n diff=" << (x -
kinematics[0].X).transpose());
90 for (
int i = 0; i <
N; ++i)
95 if (
debug_)
HIGHLIGHT_NAMED(
"JointVelocityLimit",
"Lower limit exceeded (joint=" << i <<
"): " << x_diff(i) <<
" < (-" <<
limits_(i) <<
"+" <<
tau_(i) <<
")");
100 if (
debug_)
HIGHLIGHT_NAMED(
"JointVelocityLimit",
"Upper limit exceeded (joint=" << i <<
"): " << x_diff(i) <<
" > (" <<
limits_(i) <<
"-" <<
tau_(i) <<
")");
107 if (jacobian.rows() !=
N || jacobian.cols() !=
N)
ThrowNamed(
"Wrong size of jacobian! " <<
N);
109 jacobian = (1 /
dt_) * Eigen::MatrixXd::Identity(
N,
N);
110 for (
int i = 0; i <
N; ++i)
112 jacobian(i, i) = 0.0;
double dt_
Timestep between subsequent time-steps (in s)
Eigen::VectorXd tau_
Joint velocity limits tolerance.
Eigen::VectorXd limits_
Joint velocity limits (absolute, in rads/s)
virtual ~JointVelocityLimit()
int TaskSpaceDim() override
Eigen::Ref< Eigen::VectorXd > VectorXdRef
void Update(Eigen::VectorXdRefConst x, Eigen::VectorXdRef phi) override
Joint Velocity Limit taskmap for time-indexed problems. Penalisations of joint velocity limit violati...
std::shared_ptr< Scene > ScenePtr
void AssignScene(ScenePtr scene) override
JointVelocityLimitInitializer parameters_
const Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
#define HIGHLIGHT_NAMED(name, x)
Eigen::Ref< Eigen::MatrixXd > MatrixXdRef
REGISTER_TASKMAP_TYPE("JointVelocityLimit", exotica::JointVelocityLimit)