Skip to content

Commit 99248f9

Browse files
author
earlaud
committed
Minor change to remove hardcoded base name from go2
1 parent aced2a6 commit 99248f9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/simple-mpc/inverse-dynamics.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace simple_mpc
3030
static Settings Default()
3131
{
3232
return {};
33-
} // Work-around c++ bug to have a default constructor
33+
} // Work-around c++ bug to have a default constructor of nested class
3434
};
3535

3636
KinodynamicsID(const simple_mpc::RobotModelHandler & model_handler, const Settings settings = Settings::Default())
@@ -69,7 +69,8 @@ namespace simple_mpc
6969
samplePosture_ = tsid::trajectories::TrajectorySample(robot_.nq_actuated(), robot_.na());
7070

7171
// Add the base task
72-
baseTask_ = std::make_shared<tsid::tasks::TaskSE3Equality>("task-base", robot_, "root_joint");
72+
baseTask_ =
73+
std::make_shared<tsid::tasks::TaskSE3Equality>("task-base", robot_, model_handler_.getBaseFrameName());
7374
baseTask_->Kp(settings_.kp_base * Eigen::VectorXd::Ones(6));
7475
baseTask_->Kd(2.0 * baseTask_->Kp().cwiseSqrt());
7576
baseTask_->setReference(pose_base_);

include/simple-mpc/robot-handler.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ namespace simple_mpc
135135
return base_id_;
136136
}
137137

138+
std::string getBaseFrameName() const
139+
{
140+
return model_.frames[base_id_].name;
141+
}
142+
138143
FrameIndex getFootId(const std::string & foot_name) const
139144
{
140145
return feet_ids_.at(getFootNb(foot_name));

0 commit comments

Comments
 (0)