37 double dt,
bool verbose)
39 m_constraint(name, robot.
na(), robot.
nv()),
82 m_ub = Vector::Constant(4, 1, 1e10);
83 m_lb = Vector::Constant(4, 1, -1e10);
103 for (
int i = 0;
i <
m_na;
i++) {
119 "The size of the mask vector needs to equal " +
126 for (
unsigned int i = 0;
i < m.size();
i++)
129 m(
i) == 1.0,
"Mask entries need to be either 0.0 or 1.0");
166 lower.size() ==
m_na,
167 "The size of the lower position bounds vector needs to equal " +
168 std::to_string(
m_na));
170 upper.size() ==
m_na,
171 "The size of the upper position bounds vector needs to equal " +
172 std::to_string(
m_na));
181 upper.size() ==
m_na,
182 "The size of the (absolute) velocity bounds vector needs to equal " +
183 std::to_string(
m_na));
190 upper.size() ==
m_na,
191 "The size of the (absolute) acceleration bounds vector needs to equal " +
192 std::to_string(
m_na));
217 bool impose_position_bounds,
bool impose_velocity_bounds,
218 bool impose_viability_bounds,
bool impose_acceleration_bounds) {
228 for (
int i = 0;
i <
m_na;
i++) {
231 std::cout <<
"State of joint " <<
i 232 <<
" is not viable because q[i]< qMin[i] : " << qa[
i] <<
"<" 239 std::cout <<
"State of joint " <<
i 240 <<
" is not viable because qa[i]>m_qMax[i] : " << qa[
i] <<
">" 247 std::cout <<
"State (q,dq) :(" << qa[i] <<
"," << dqa[i]
248 <<
") of joint " << i
249 <<
" is not viable because |dq|>dqMax : " << std::abs(dqa[i])
250 <<
">" <<
m_dqMax[i] << std::endl;
256 if (dqa[i] > (dqMaxViab +
m_eps)) {
258 std::cout <<
"State (q,dq,dqMaxViab) :(" << qa[i] <<
"," << dqa[i]
259 <<
"," << dqMaxViab <<
") of joint " << i
260 <<
" is not viable because dq>dqMaxViab : " << dqa[i] <<
">" 261 << dqMaxViab << std::endl;
267 if (dqa[i] < (dqMinViab +
m_eps)) {
269 std::cout <<
"State (q,dq,dqMinViab) :(" << qa[i] <<
"," << dqa[i]
270 <<
"," << dqMinViab <<
") of joint " << i
271 <<
" is not viable because dq<dqMinViab : " << dqa[i] <<
"<" 272 << dqMinViab << std::endl;
289 for (
int i = 0;
i <
m_na;
i++) {
294 }
else if (qa[i] !=
m_qMin[i]) {
298 if (verbose ==
true) {
299 std::cout <<
"WARNING qa[i]==m_qMin[i] for joint" << i << std::endl;
300 std::cout <<
"You are going to violate the position bound " << i
309 }
else if (qa[i] !=
m_qMax[i]) {
313 if (verbose ==
true) {
314 std::cout <<
"WARNING qa[i]==m_qMax[i] for joint" << i << std::endl;
315 std::cout <<
"You are going to violate the position bound " << i
343 for (
int i = 0;
i <
m_na;
i++) {
348 if (verbose ==
true) {
349 std::cout <<
"Error: state (" << qa[
i] <<
"," << dqa[
i] <<
") of joint " 350 <<
i <<
"not viable because delta is negative: " <<
m_delta_1 358 if (verbose ==
true) {
359 std::cout <<
"Error: state (" << qa[
i] <<
"," << dqa[
i] <<
") of joint " 360 <<
i <<
"not viable because delta is negative: " <<
m_delta_2 375 if (verbose ==
true) {
376 for (
int i = 0;
i <
m_na;
i++) {
378 std::cout <<
"WARNING: specified state ( < " <<
m_qa[
i] <<
" , " 411 m_ub.setConstant(4, 1, 1e10);
412 m_lb.setConstant(4, 1, -1e10);
415 for (
int i = 0;
i <
m_na;
i++) {
430 if (verbose ==
true) {
431 std::cout <<
"Conflict between pos/vel/acc bound ddqMin " <<
m_ddqLB[i]
432 <<
" ddqMax " <<
m_ddqUB[i] << std::endl;
433 std::cout <<
"ub " <<
m_ub.transpose() << std::endl;
434 std::cout <<
"lb " <<
m_lb.transpose() << std::endl;
441 if (verbose ==
true) {
442 std::cout <<
"New bounds are ddqMin " <<
m_ddqLB[i] <<
" ddqMax " const Vector & lowerBound() const
void setAccelerationBounds(ConstRefVector upper)
virtual void setMask(math::ConstRefVector mask)
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
bool m_impose_position_bounds
RobotWrapper & m_robot
Reference on the robot model.
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
const ConstraintBase & compute(const double t, ConstRefVector q, ConstRefVector v, Data &data)
const Vector & getPositionUpperBounds() const
bool m_impose_acceleration_bounds
const Vector & getVelocityBounds() const
TSID_DEPRECATED const Vector & mask() const
virtual bool setMatrix(ConstRefMatrix A)
Vector m_minus_dq_over_dt
void computeAccLimitsFromPosLimits(ConstRefVector q, ConstRefVector dq, bool verbose=true)
const Vector & getAccelerationBounds() const
bool m_impose_viability_bounds
void isStateViable(ConstRefVector q, ConstRefVector dq, bool verbose=true)
math::ConstRefVector ConstRefVector
void resize(const unsigned int r, const unsigned int c)
TaskJointPosVelAccBounds(const std::string &name, RobotWrapper &robot, double dt, bool verbose=true)
void setPositionBounds(ConstRefVector lower, ConstRefVector upper)
void setVelocityBounds(ConstRefVector upper)
const Vector & upperBound() const
ConstraintInequality m_constraint
Wrapper for a robot based on pinocchio.
void setTimeStep(double dt)
void computeAccLimitsFromViability(ConstRefVector q, ConstRefVector dq, bool verbose=true)
int dim() const
Return the dimension of the task. should be overloaded in the child class.
void computeAccLimits(ConstRefVector q, ConstRefVector dq, bool verbose=true)
const ConstraintBase & getConstraint() const
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
const Vector & getPositionLowerBounds() const
void setImposeBounds(bool impose_position_bounds, bool impose_velocity_bounds, bool impose_viability_bounds, bool impose_acceleration_bounds)
bool m_impose_velocity_bounds
void setVerbose(bool verbose)