I am currently trying to implement feedback linearization and for that, I was looking to compute Coriolis and gravitational terms,mass matrix, Jacobian and Jacobian Derivative.
In Drake I found functions for mass matrix
plant.CalcMassMatrix(*plant_context,*M)
I can also calculate the gravity term by using the
Eigen::VectorXd G = plant.CalcGravityGeneralizedForces(*plant_context).
However, I am not sure if there is a command to calculate Coriolis term or better jointly gravitational and Coriolis term together.
I can think of an alternative by
plant.CalcMassMatrix(*plant_context, M);
h = plant_.CalcGravityGeneralizedForces(*plant_context);
multibody::MultibodyForces<double> external_forces(plant_);
external_forces.SetZero();
C = plant_.CalcInverseDynamics(*plant_context, ZeroQddot, external_forces);
For Jacobian, I did the following
end_effector_link_ = &plant_.GetBodyByName("ee_name");
/* End-effector frame E */
const multibody::Frame<double>& frame_E = (plant_.get_body(end_effector_link_->index())).body_frame();
const multibody::Frame<double>& frame_W = plant_.world_frame();
Eigen::MatrixXd p_EoEi_E(3, 1);
p_EoEi_E.col(0) << 0.0, 0.0, 0.00;
const int num_positions = plant_.num_positions();
MatrixXd Jq(3, num_positions);
plant_.CalcJacobianTranslationalVelocity(*plant_context,
multibody::JacobianWrtVariable::kQDot,
frame_E,
p_EoEi_E,
frame_W,
frame_W,
&Jq);
However, I was not able to find any update regarding jacobian derivative. I tried looking autodiffxd as mentioned in very old question but it do not provide enough information.
Any lead will be highly appreciated.
terminate called after throwing an instance of 'drake::internal::assertion_error' what(): Failure at multibody/tree/multibody_tree.cc:1766 in CalcBiasTranslationalAcceleration(): condition 'with_respect_to == JacobianWrtVariable::kV' failed. Aborted (core dumped)
– Murt Mar 11 '21 at 04:26