-
Notifications
You must be signed in to change notification settings - Fork 6
Add Inverse dynamics class using TSID #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… compensate for base position task)
…sate for base pos)
…erence and performance (if needed)
This PR is (almost) ready for review. The only thing left is to wait for a new release of TSID (hopefully coming soon) in order to have the fix I made regarding adding and removing rigid contacts. Here is a overview of the proposed changes :
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First draft of review, pointing some mistakes (mainly wrong signedness for int)
Also pointing bugs in test and examples
return a; | ||
} | ||
|
||
void setTarget_CentroidalID( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a _ dash here? It breaks naming conventions, isn't it?
t = step * dt_mpc + sub_step * dt_simu | ||
|
||
delay = sub_step / float(N_simu) * dt_mpc | ||
xs_interp = interpolator.interpolateLinear(delay, dt_mpc, xss) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to use interpolateState to correctly interpolate the configuration, which is defined on a Lie group.
t = step * dt_mpc + sub_step * dt_simu | ||
|
||
delay = sub_step / float(N_simu) * dt_mpc | ||
xs_interp = interpolator.interpolateLinear(delay, dt_mpc, xss) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment: use interpolateState
private: | ||
std::shared_ptr<tsid::tasks::TaskComEquality> comTask_; | ||
std::vector<tsid::tasks::TaskSE3Equality> trackingTasks_; | ||
tsid::trajectories::TrajectorySample sampleCom_; // TODO: no need to store it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the TODO?
const Settings settings_; | ||
|
||
private: | ||
std::shared_ptr<tsid::tasks::TaskComEquality> comTask_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use a shared_ptr for comTask but not for the trackingTasks? I am in favor of handling std::shared_ptr for all tsid tasks.
Motion v_ref = Motion::Zero(); | ||
int i = 0; | ||
for (auto const & name : model_handler_.getFeetNames()) | ||
for (int foot_nb = 0; foot_nb < model_handler_.getFeetNb(); foot_nb++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to size_t foot_nb
data_handler_->updateInternalData(model_handler.getReferenceState(), true); | ||
std::map<std::string, Eigen::Vector3d> starting_poses; | ||
for (auto const & name : ocp_handler_->getModelHandler().getFeetNames()) | ||
for (int foot_nb = 0; foot_nb < model_handler.getFeetNb(); foot_nb++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to size_t foot_nb
if (contact_state[i]) | ||
{ | ||
contact_forces.segment((long)i * 3, 3) = mc_data->constraint_datas_[force_id].contact_force.linear(); | ||
contact_forces.row(i) = mc_data->constraint_datas_[force_id].contact_force.linear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contact_forces.row((long)i)
else | ||
{ | ||
contact_forces.segment((long)i * 3, 3).setZero(); | ||
contact_forces.row(i).setZero(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contact_forces.row((long)i)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails on my machine with the error Assertion `last_solution_.status == tsid::solvers::HQPStatus::HQP_STATUS_OPTIMAL' failed
This PR is still in progress, here is my todo list before asking for any review. Skip this comment to have a clearer summary of this PR.
setTarget
,solve
) should be templated on the vector type, and useconst Eigen::Ref<VectorType> &
sampleBase
,samplePosture
andposeBase
do not require to be kept as member variablefoot_forces
should be better typed than a flattened list, probablyMatrixtype<3, -1>
Should interpolator be templated to account for matrices now ?RobotModelHandler
should avec methods to extract confguration and velocity from the stategetConfiguration
getVelocity
Do a global search of.head(nq)
.tail(nv)
and replace when appropriateUpdateInternalData
KinodynamicsID
,KinodynamidsID::Settings
getFootPose
Should the data handler keep a copy of the state ?(for later PR)getFootPose
should take the foot index as argument, not the name (more effcient solution by default)ID should also give the q and v after interpollation, to feed forward to the robot(returns acceleration already, for later PR)Add Angular Momentum task--> Not needed for now (maybe for centroidal)Which sample value & derivative to set ?Add unit testDouble check that Com task value, derivative is good--> Not needed for now (maybe for centroidal)How to test derivative (in unittests ?) -> Speed of convergence ??Compute task second derivative ?? --> is it worth ? Test it !