Skip to content

Commit

Permalink
Add a parameter to control the arm posture during foot/hand stand in …
Browse files Browse the repository at this point in the history
…quadruped flat task.

PiperOrigin-RevId: 693656096
Change-Id: Ibfed9043aae12ffa27a1a317e4e10ec119e2732a
  • Loading branch information
thowell authored and copybara-github committed Nov 6, 2024
1 parent abb3a11 commit 8dcb9d2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
22 changes: 14 additions & 8 deletions mjpc/tasks/quadruped/quadruped.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,21 @@ void QuadrupedFlat::ResidualFn::Residual(const mjModel* model,
if (current_mode_ == kModeBiped) {
// loosen the "hands" in Biped mode
bool handstand = ReinterpretAsInt(parameters_[biped_type_param_id_]);
double arm_posture = parameters_[arm_posture_param_id_];
if (handstand) {
residual[counter + 4] *= 0.03;
residual[counter + 5] *= 0.03;
residual[counter + 10] *= 0.03;
residual[counter + 11] *= 0.03;
residual[counter + 6] *= arm_posture;
residual[counter + 7] *= arm_posture;
residual[counter + 8] *= arm_posture;
residual[counter + 9] *= arm_posture;
residual[counter + 10] *= arm_posture;
residual[counter + 11] *= arm_posture;
} else {
residual[counter + 1] *= 0.03;
residual[counter + 2] *= 0.03;
residual[counter + 7] *= 0.03;
residual[counter + 8] *= 0.03;
residual[counter + 0] *= arm_posture;
residual[counter + 1] *= arm_posture;
residual[counter + 2] *= arm_posture;
residual[counter + 3] *= arm_posture;
residual[counter + 4] *= arm_posture;
residual[counter + 5] *= arm_posture;
}
}
counter += model->nu;
Expand Down Expand Up @@ -521,6 +526,7 @@ void QuadrupedFlat::ResetLocked(const mjModel* model) {
residual_.cadence_param_id_ = ParameterIndex(model, "Cadence");
residual_.amplitude_param_id_ = ParameterIndex(model, "Amplitude");
residual_.duty_param_id_ = ParameterIndex(model, "Duty ratio");
residual_.arm_posture_param_id_ = ParameterIndex(model, "Arm posture");
residual_.balance_cost_id_ = CostTermByName(model, "Balance");
residual_.upright_cost_id_ = CostTermByName(model, "Upright");
residual_.height_cost_id_ = CostTermByName(model, "Height");
Expand Down
1 change: 1 addition & 0 deletions mjpc/tasks/quadruped/quadruped.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class QuadrupedFlat : public Task {
int cadence_param_id_ = -1;
int amplitude_param_id_ = -1;
int duty_param_id_ = -1;
int arm_posture_param_id_ = -1;
int upright_cost_id_ = -1;
int balance_cost_id_ = -1;
int height_cost_id_ = -1;
Expand Down
1 change: 1 addition & 0 deletions mjpc/tasks/quadruped/task_flat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<numeric name="residual_select_Biped type" data="0"/>
<text name="residual_list_Biped type" data="Foot Stand|Hand Stand"/>
<numeric name="residual_Heading" data="0 -3.14 3.14" />
<numeric name="residual_Arm posture" data=".03 0 1"/>

<!-- estimator -->
<numeric name="estimator" data="0" />
Expand Down

0 comments on commit 8dcb9d2

Please sign in to comment.