Skip to content

Commit 0ea2e03

Browse files
committed
Fix velocity in world aligned frame
1 parent 0497429 commit 0ea2e03

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/inverse-dynamics/kinodynamics-id.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ void KinodynamicsID::setTarget(
133133
postureTask_->setReference(samplePosture_);
134134

135135
// Base task
136-
tsid::math::SE3ToVector(data_handler_.getBaseFramePose(), sampleBase_.pos);
137-
sampleBase_.setDerivative(v_target.head<6>());
138-
sampleBase_.setSecondDerivative(a_target.head<6>());
139-
baseTask_->setReference(sampleBase_);
136+
const pinocchio::SE3 oMb{data_handler_.getBaseFramePose()};
137+
const pinocchio::SE3 oMb_rotation(oMb.rotation(), Eigen::Vector3d::Zero());
138+
const pinocchio::Motion v_world_aligned{oMb_rotation.act(pinocchio::Motion(v_target.head<6>()))};
139+
const pinocchio::Motion a_world_aligned{oMb_rotation.act(pinocchio::Motion(a_target.head<6>()))};
140+
baseTask_->setReference(oMb, v_world_aligned, a_world_aligned);
140141

141142
// Foot contacts
142143
for (std::size_t foot_nb = 0; foot_nb < model_handler_.getFeetNb(); foot_nb++)

0 commit comments

Comments
 (0)