Skip to content

Commit

Permalink
paint zero moment point in twix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikRe committed May 22, 2024
1 parent b1757c1 commit 05c76eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/twix/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "twix"
version = "0.4.2"
version = "0.5.0"
edition.workspace = true
license.workspace = true
homepage.workspace = true
Expand Down
12 changes: 12 additions & 0 deletions tools/twix/src/panels/map/layers/walking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub struct Walking {
step_plan: ValueBuffer,
center_of_mass: ValueBuffer,
robot_to_walk: ValueBuffer,
zero_moment_point: ValueBuffer,
}

impl Layer<Ground> for Walking {
Expand All @@ -51,6 +52,8 @@ impl Layer<Ground> for Walking {
let robot_to_walk = nao.subscribe_output(
CyclerOutput::from_str("Control.additional.walking.robot_to_walk").unwrap(),
);
let zero_moment_point =
nao.subscribe_output(CyclerOutput::from_str("Control.main.zero_moment_point").unwrap());
Self {
robot_to_ground,
robot_kinematics,
Expand All @@ -59,6 +62,7 @@ impl Layer<Ground> for Walking {
step_plan,
center_of_mass,
robot_to_walk,
zero_moment_point,
}
}

Expand All @@ -75,6 +79,7 @@ impl Layer<Ground> for Walking {
let center_of_mass: Point3<Robot> = self.center_of_mass.require_latest()?;
let center_of_mass_in_ground = robot_to_ground * center_of_mass;
let robot_to_walk: Isometry3<Robot, Walk> = self.robot_to_walk.require_latest()?;
let zero_moment_point: Point3<Ground> = self.zero_moment_point.require_latest()?;

paint_actuated_feet(
painter,
Expand Down Expand Up @@ -121,6 +126,13 @@ impl Layer<Ground> for Walking {
Stroke::new(0.001, Color32::BLACK),
);

painter.circle(
zero_moment_point.xy(),
0.01,
Color32::GRAY,
Stroke::new(0.001, Color32::BLACK),
);

paint_step_plan(painter, step_plan);
Ok(())
}
Expand Down

0 comments on commit 05c76eb

Please sign in to comment.