-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Currently, the activation state works setting to zero the _A matrix and storing the old value in _A_last_active. The algorithm supposes that the user computes the _A matrix at each task->update(), which is then given to _A_last_active, and then set to zero:
OpenSoT/include/OpenSoT/Task.h
Lines 380 to 388 in 4329964
| for(typename std::list< ConstraintPtr >::iterator i = this->getConstraints().begin(); | |
| i != this->getConstraints().end(); ++i) (*i)->update(x); | |
| this->_update(x); | |
| if(!_is_active){ | |
| _A_last_active = _A; | |
| _A.setZero(_A.rows(), _A.cols()); | |
| return; | |
| } |
Problems may arise if the task start non active and the user forgets to compute the _A matrix in the update function, as it is happening in the CentauroAnkleSteering task:
OpenSoT/src/tasks/velocity/CentauroAnkleSteering.cpp
Lines 371 to 388 in 4329964
| void CentauroAnkleSteering::_update(const Eigen::VectorXd& x) | |
| { | |
| // get robot state | |
| _model->getJointPosition(_q); | |
| // compute wheel desired velocity | |
| Eigen::Vector6d wheel_vel; | |
| _model->getVelocityTwist(_steering.getWheelName(), wheel_vel); | |
| double q_steering = _steering.computeSteeringAngle(wheel_vel.head<3>()); | |
| double q_current = _q(_steering_dof_idx); | |
| double dq = _lambda*(q_steering - q_current); | |
| dq = std::min(std::max(dq, -_max_steering_dq), _max_steering_dq); | |
| _b(0) = dq; | |
| } |
In this case, the _A matrix keeps being a zero matrix even after setting the activation state as Enabled. We should fix this behaviour to avoid future similar bugs. @alaurenzi @EnricoMingo