Skip to content

Commit

Permalink
Improve robot example
Browse files Browse the repository at this point in the history
  • Loading branch information
fdevinc committed Jul 8, 2024
1 parent 9755681 commit 1349ba3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions example/rbd/robot.example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ int main() {

/*************** Generate derivatives. ***************/
// Implement autodiff function that computes the centroidal momentum of the robot.
UNGAR_LOG(
info,
"Generating the autodiff function to compute the centroidal momentum of the robot...");
UNGAR_LOG(info,
"Generating an autodiff function to compute the centroidal momentum of the robot...");
auto functionImpl = [&](const VectorXad& qvUnderlying, VectorXad& y) -> void {
Robot<ad_scalar_t> robotAD{urdfFilename};
const auto qv_ = MakeMVariableLazyMap(qvUnderlying, vs::qv);
Expand All @@ -157,8 +156,8 @@ int main() {
UNGAR_LOG(
info, "Ground truth:\n{}", robot.Get(qs::centroidal_momentum).toVector_impl().transpose());
UNGAR_LOG(info,
"Autodiff Jacobian (6 rightmost columns):\n{}",
function.Jacobian(qv).toDense().rightCols(6_idx));
"Autodiff Jacobian (6 leftmost columns):\n{}",
function.Jacobian(qv).toDense().leftCols(6_idx));

return 0;
}

0 comments on commit 1349ba3

Please sign in to comment.