187 Eigen::MatrixXd Icut = Eigen::MatrixXd::Identity(varDofs, varDofs).bottomRows(nIDofs);
189 fullJacobian = Eigen::MatrixXd::Zero(2*nIDofs, varDofs);
190 fullJacobian.topRows(nIDofs) = -Icut;
191 fullJacobian.bottomRows(nIDofs) = Icut;
214 int nIDofs = gpos.size();
217 Eigen::VectorXd minDdqTotal = 2 * (
jointLowerLimits - gpos - hpos * gvel)/(hpos*hpos);
234 for (
int i=0; i<nIDofs; i++)
239 if ((0 <= tmax) && (tmax <=
hpos))
242 if (maxDdqTotal(i) >= ddqlim)
244 maxDdqTotal(i) = ddqlim;
247 if ((0 <= tmin) && (tmin <= hpos))
250 if (minDdqTotal(i) <= ddqlim)
252 minDdqTotal(i) = ddqlim;
257 fullb.head(nIDofs) = maxDdqTotal;
258 fullb.tail(nIDofs) = - minDdqTotal;
302 , pimpl(new
Pimpl(model))
329 computeFullb(pimpl->_model.getJointPositions(), pimpl->_model.getJointVelocities(),
_b);
357 , _dynamicEquation(dynamicEquation)
377 , pimpl(new
Pimpl(model, dynamicEquation))
382 computeFullJacobian(pimpl->_model.nbDofs(), pimpl->_model.nbInternalDofs(), pimpl->_fullJacobian);
400 _jacobian = - pimpl->_fullJacobian * pimpl->_dynamicEquation.getInertiaMatrixInverseJchiT();
411 Eigen::VectorXd _fullb(
_b.size());
412 computeFullb(pimpl->_model.getJointPositions(), pimpl->_model.getJointVelocities(), _fullb);
415 _b = _fullb - pimpl->_fullJacobian * pimpl->_dynamicEquation.getInertiaMatrixInverseLinNonLinGrav();
425 void ReducedJointLimitFunction::doUpdateInputSizeBegin()
435 void ReducedJointLimitFunction::doUpdateInputSizeEnd()
437 computeFullJacobian(pimpl->_model.nbDofs(), pimpl->_model.nbInternalDofs(), pimpl->_fullJacobian);
455 , _is_connected(false)
464 , _is_connected(false)
489 return _lowerLimits(i);
494 return _upperLimits(i);
506 _lowerLimits = lowerLimits;
507 _upperLimits = upperLimits;
514 _lowerLimits = newLowerLimits;
521 _upperLimits = newUpperLimits;
528 _lowerLimits(i) = newLowerLimit;
529 _upperLimits(i) = newUpperLimit;
531 _jointLimitFunction->
setJointLimit(i, newLowerLimit, newUpperLimit);
535 _lowerLimits(i) = newLowerLimit;
542 _upperLimits(i) = newUpperLimit;
551 if (useReducedProblem)
552 f = createReducedJointLimitFunction(_model, dynamicEquation);
554 f = createFullJointLimitFunction(_model);
557 _is_connected =
true;
566 _is_connected =
false;
573 return _jointLimitFunction;
579 return _jointLimitFunction;
Create a linear function that represents the joint limit function for the reduced formalism...
ReducedJointLimitFunction(const Model &model, const FullDynamicEquationFunction &dynamicEquation)
void setJointUpperLimit(int i, double newUpperLimit)
virtual void updateJacobian() const
double getJointUpperLimit(int i) const
Eigen::VectorXd jointUpperLimits
void setJointLowerLimit(int i, double newLowerLimit)
void setJointLimit(int i, double newLowerLimit, double newUpperLimit)
JointLimitFunction(const Model &m, Variable &var)
virtual const Eigen::VectorXd & getJointUpperLimits() const =0
double getJointLowerLimit(int i) const
Define joint limit constraint for wOcra controller.
Eigen::VectorXd jointLowerLimits
double getHorizonOfPrediction() const
void setJointLimits(const Eigen::VectorXd &lowerLimits, const Eigen::VectorXd &upperLimits)
Constraint< LinearFunction > LinearConstraint
void setHorizonOfPrediction(double newHpos)
void setJointUpperLimits(const Eigen::VectorXd &newUpperLimits)
double getJointUpperLimit(int i) const
const Eigen::VectorXd & getJointUpperLimits() const
const Eigen::VectorXd & getJointLowerLimits() const
Eigen::MatrixXd _fullJacobian
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
boost::shared_ptr< Constraint< LinearFunction > > _constraint
Create a linear function that represents the joint limit function.
Create a linear function that represents the joint limit function for the full formalism.
void computeFullb(const Eigen::VectorXd &gpos, const Eigen::VectorXd &gvel, Eigen::VectorXd &fullb) const
double getJointLowerLimit(int i) const
void setJointLowerLimit(int i, double newLowerLimit)
double getHorizonOfPrediction() const
FullJointLimitFunction(const Model &model)
void computeFullJacobian(int varDofs, int nIDofs, Eigen::MatrixXd &fullJacobian) const
void invalidateb(int timestamp)
This class represents a variable in a mathematical sense.
Create a linear function that represents the dynamic equation of motion.
Pimpl(const Model &model)
virtual void disconnectFromController()
virtual void updateb() const
JointLimitConstraint(const Model &model, double hpos=.2)
virtual void updateb() const
~FullJointLimitFunction()
void setHorizonOfPrediction(double newHpos)
virtual void connectToController(const FullDynamicEquationFunction &dynamicEquation, bool useReducedProblem)
Variable & getAccelerationVariable() const
const Eigen::VectorXd & getJointLowerLimits() const
~ReducedJointLimitFunction()
void setJointUpperLimits(const Eigen::VectorXd &newUpperLimits)
void setJointLimits(const Eigen::VectorXd &lowerLimits, const Eigen::VectorXd &upperLimits)
const FullDynamicEquationFunction & _dynamicEquation
void setJointLowerLimits(const Eigen::VectorXd &newLowerLimits)
void setJointLimit(int i, double newLowerLimit, double newUpperLimit)
virtual const Eigen::VectorXd & getJointLowerLimits() const =0
const Eigen::VectorXd & getJointUpperLimits() const
void setJointUpperLimit(int i, double newUpperLimit)
Pimpl(const Model &model, const FullDynamicEquationFunction &dynamicEquation)
void setJointLowerLimits(const Eigen::VectorXd &newLowerLimits)