Merge pull request #583 from pollen-robotics/gamepad-dpad-remap

pad: D-pad left is head + move, right body + head, down move
This commit is contained in:
Coralie
2026-11-13 11:17:35 +08:00
committed by GitHub
7 changed files with 74 additions and 74 deletions
+5 -5
View File
@@ -758,10 +758,10 @@ the thumb:
| **Y** | the excited emotion |
| **X** | nothing — free for a skill of your own (`robotctl pad bind`, e.g. `x kick_left`) |
| **RT / LT** | mouth (either trigger) — RT also quacks; LT rides the "wheee" while held |
| **D-pad left** | move mode: left stick forward/back and strafe, right stick turns. The mode a pad starts in |
| **D-pad down** | move mode: left stick forward/back and strafe, right stick turns. The mode a pad starts in |
| **D-pad up** | head mode: left stick head yaw and pitch, right stick neck pitch and head roll. The body holds still |
| **D-pad right** | head + move: left stick forward/back and turn, right stick looks around (head yaw and pitch). With `[pad_imu_head_control] enabled` and a pad that has an IMU, the pad's tilt poses the head instead and the sticks keep the move mapping — see below |
| **D-pad down** | body + head: left stick up/down rises and crouches, left/right leans the body sideways; right stick looks around (head yaw and pitch). The body does not walk |
| **D-pad left** | head + move: left stick forward/back and turn, right stick looks around (head yaw and pitch). With `[pad_imu_head_control] enabled` and a pad that has an IMU, the pad's tilt poses the head instead and the sticks keep the move mapping — see below |
| **D-pad right** | body + head: left stick up/down rises and crouches, left/right leans the body sideways; right stick looks around (head yaw and pitch). The body does not walk |
| **Start**, press | first press: torque on and a 2 s ramp — to the seat if the robot is sitting (or nearly), to the home pose otherwise. Second press: the robot is measured again — seated, the sitstand policy settles it into its seat for ~2 s, rises, and then walks; anything else, the policy walks straight away. The journal says what it saw each time. After that a press toggles the policy: stopping it returns the robot to its home pose, stiff (a seated robot stays seated) |
| **Start**, held 1.5 s | home pose, motors stiff, policy off — the "put everything back" button, from anywhere. Sitting, it stays seated, stiff: A stands it up after the next Start |
| **Select**, held 2 s | rest (`robot.rest`), at once, without waiting for the release — the robot sitting down says the two seconds are up: a driving robot sits, eases into the rest pose, then torque goes off and every servo reboots — also the way back from a tripped overload without pulling the battery. A robot not driving is rebooted where it is. Start stands it up again |
@@ -782,8 +782,8 @@ robot; the journal says how long to hold it.
sudo robotctl configure # Controller-IMU head control → enabled
```
head + move (D-pad right) hands the head to the pad — tilt it and the head tilts, turn it and the
head turns — while the sticks go on driving the body exactly as in move mode. Press D-pad right
head + move (D-pad left) hands the head to the pad — tilt it and the head tilts, turn it and the
head turns — while the sticks go on driving the body exactly as in move mode. Press D-pad left
again and the pad drives the head **from wherever the pad is now**: its yaw is a gyro's word alone
and drifts, and re-centring on every press is how you beat the drift without a magnetometer.
`gain` in the same section is head radians per pad radian, 1 by default. On an Xbox pad, or with
+2 -2
View File
@@ -127,8 +127,8 @@ monitor is not open: `padd` reads the IMU node only while somebody is subscribed
while it is steering the head from it, below.
The same attitude can drive the robot's head. `sudo robotctl configure`, section *Controller-IMU
head control*, `enabled`: head + move mode (D-pad right) then hands the head to the pad's tilt
while the sticks keep driving, and pressing D-pad right again re-centres on the pad's current
head control*, `enabled`: head + move mode (D-pad left) then hands the head to the pad's tilt
while the sticks keep driving, and pressing D-pad left again re-centres on the pad's current
attitude — the [cheat sheet](cheatsheet.md#gamepad-configd) has the whole mapping. The picture
in the monitor and the head use one filter, so where the drawn pad points is where the head goes.
+6 -6
View File
@@ -13,15 +13,15 @@ use crate::hold::{FLASHLIGHT_TAP, HOME_HOLD, HoldAction, HoldButton, REST_HOLD,
/// degrees of freedom.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Mode {
/// D-pad left. Left stick walks and strafes, right stick turns.
/// D-pad down. Left stick walks and strafes, right stick turns.
Drive,
/// D-pad up. All four axes pose the head; the body holds still.
Head,
/// D-pad right. Left stick walks and turns, right stick looks around — or, with
/// D-pad left. Left stick walks and turns, right stick looks around — or, with
/// `[pad_imu_head_control]` on a pad that has an IMU, the pad's tilt poses the head and the
/// sticks keep the whole [`Mode::Drive`] mapping.
HeadDrive,
/// D-pad down. Body + head: the left stick crouches and leans the standing robot sideways,
/// D-pad right. Body + head: the left stick crouches and leans the standing robot sideways,
/// the right stick looks around. The body does not walk.
BodyPose,
}
@@ -226,9 +226,9 @@ impl Mapper {
let mut wanted_mode = None;
for (button, mode) in [
(Buttons::UP, Mode::Head),
(Buttons::RIGHT, Mode::HeadDrive),
(Buttons::LEFT, Mode::Drive),
(Buttons::DOWN, Mode::BodyPose),
(Buttons::LEFT, Mode::HeadDrive),
(Buttons::RIGHT, Mode::BodyPose),
(Buttons::DOWN, Mode::Drive),
] {
if pad.pressed.contains(button) {
wanted_mode = Some(mode);
+4 -4
View File
@@ -35,9 +35,9 @@
//! X (West) nothing, until a skill is bound there
//! RT / LT mouth (either trigger; the max wins) · RT quacks · LT rides the wheee
//! D-pad up head mode — the sticks pose the head, the body holds still
//! D-pad right head + move — left stick walks and turns, right stick looks around
//! D-pad left move — the sticks walk, strafe and turn
//! D-pad down body + head — left stick crouches and leans sideways, right stick looks around
//! D-pad left head + move — left stick walks and turns, right stick looks around
//! D-pad right body + head — left stick crouches and leans sideways, right stick looks around
//! D-pad down move — the sticks walk, strafe and turn
//! Home tap: flashlight on / off (a board with one); held does nothing
//! Start first press stands up, then toggles the policy
//! Start, 1.5 s home pose, motors stiff, policy off — a seated robot stays seated
@@ -296,7 +296,7 @@ fn main() -> std::process::ExitCode {
hz = args.hz,
roller,
"driving — A sit, B ground pick, triggers mouth; D-pad up head, \
right head + move, left move, down body + head; Start stands up then toggles the policy, \
left head + move, right body + head, down move; Start stands up then toggles the policy, \
Start (1.5s) home pose; Select (2s) rest, Select (4s) power off"
);
+2 -2
View File
@@ -351,10 +351,10 @@ impl Default for NetpadParams {
/// Controller-IMU head control: pose the head by tilting the pad.
///
/// Some pads carry an inertial unit — the "Pro Controller" Switch clones do; an Xbox pad does not.
/// With this on and such a pad connected, head + move mode (**D-pad right**) stops meaning "the
/// With this on and such a pad connected, head + move mode (**D-pad left**) stops meaning "the
/// right stick poses the head" and means "the pad's tilt poses the head": the sticks keep the
/// whole drive mapping, and turning the pad in your hands turns the robot's head. Press D-pad
/// right again and the pad drives the head **from where the pad is now** — the pad's yaw comes
/// left again and the pad drives the head **from where the pad is now** — the pad's yaw comes
/// from a gyro and drifts, and re-centring on every press is how a person beats the drift
/// without a magnetometer.
///
+3 -3
View File
@@ -148,7 +148,7 @@ macro_rules! mode_axes {
}
mode_axes! {
/// D-pad left: the left stick walks and strafes, the right stick turns. Also the sticks of
/// D-pad down: the left stick walks and strafes, the right stick turns. Also the sticks of
/// head + move while the pad's IMU has the head.
DriveAxes, "drive" {
vx: LeftY;
@@ -170,7 +170,7 @@ mode_axes! {
}
mode_axes! {
/// D-pad right, when the right stick has the head: the left stick walks and turns — no
/// D-pad left, when the right stick has the head: the left stick walks and turns — no
/// strafe, the right stick is busy — and the right stick looks around with the signs head
/// mode gives its left stick.
HeadDriveAxes, "head_drive" {
@@ -185,7 +185,7 @@ mode_axes! {
}
mode_axes! {
/// D-pad down: the left stick crouches and leans the standing robot sideways, and the right
/// D-pad right: the left stick crouches and leans the standing robot sideways, and the right
/// stick looks around as in head + move, so it means one thing wherever it poses the head.
/// No forward/back tilt: the right stick has the head. The lean keeps the old body mode's
/// sign, moved from the right stick to the left.
+52 -52
View File
@@ -798,7 +798,7 @@ pub const REGISTRY: &[Entry] = &[
feature(
"pad_imu_head_control.enabled",
Kind::Bool,
"In head + move mode (D-pad right), the pad's own IMU (Pro Controller) poses the head while the sticks drive; D-pad right again re-centres",
"In head + move mode (D-pad left), the pad's own IMU (Pro Controller) poses the head while the sticks drive; D-pad left again re-centres",
),
entry(
"pad_imu_head_control.gain",
@@ -842,47 +842,47 @@ pub const REGISTRY: &[Entry] = &[
entry(
"pad_axes.drive.vx.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Drive (D-pad left): stick axis for forward speed, or none",
"Drive (D-pad down): stick axis for forward speed, or none",
),
entry(
"pad_axes.drive.vx.invert",
Kind::Bool,
"Drive (D-pad left): reverse the forward speed stick",
"Drive (D-pad down): reverse the forward speed stick",
),
entry(
"pad_axes.drive.vx.gain",
Kind::Float,
"Drive (D-pad left): forward speed sensitivity, ≥ 0 — above 1 reaches the limit early",
"Drive (D-pad down): forward speed sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.drive.vy.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Drive (D-pad left): stick axis for strafe, or none",
"Drive (D-pad down): stick axis for strafe, or none",
),
entry(
"pad_axes.drive.vy.invert",
Kind::Bool,
"Drive (D-pad left): reverse the strafe stick",
"Drive (D-pad down): reverse the strafe stick",
),
entry(
"pad_axes.drive.vy.gain",
Kind::Float,
"Drive (D-pad left): strafe sensitivity, ≥ 0 — above 1 reaches the limit early",
"Drive (D-pad down): strafe sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.drive.vyaw.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Drive (D-pad left): stick axis for turn, or none",
"Drive (D-pad down): stick axis for turn, or none",
),
entry(
"pad_axes.drive.vyaw.invert",
Kind::Bool,
"Drive (D-pad left): reverse the turn stick",
"Drive (D-pad down): reverse the turn stick",
),
entry(
"pad_axes.drive.vyaw.gain",
Kind::Float,
"Drive (D-pad left): turn sensitivity, ≥ 0 — above 1 reaches the limit early",
"Drive (D-pad down): turn sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head.neck_pitch.source",
@@ -947,212 +947,212 @@ pub const REGISTRY: &[Entry] = &[
entry(
"pad_axes.head_drive.vx.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for forward speed, or none",
"Head + move (D-pad left): stick axis for forward speed, or none",
),
entry(
"pad_axes.head_drive.vx.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the forward speed stick",
"Head + move (D-pad left): reverse the forward speed stick",
),
entry(
"pad_axes.head_drive.vx.gain",
Kind::Float,
"Head + move (D-pad right): forward speed sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): forward speed sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head_drive.vy.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for strafe, or none",
"Head + move (D-pad left): stick axis for strafe, or none",
),
entry(
"pad_axes.head_drive.vy.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the strafe stick",
"Head + move (D-pad left): reverse the strafe stick",
),
entry(
"pad_axes.head_drive.vy.gain",
Kind::Float,
"Head + move (D-pad right): strafe sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): strafe sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head_drive.vyaw.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for turn, or none",
"Head + move (D-pad left): stick axis for turn, or none",
),
entry(
"pad_axes.head_drive.vyaw.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the turn stick",
"Head + move (D-pad left): reverse the turn stick",
),
entry(
"pad_axes.head_drive.vyaw.gain",
Kind::Float,
"Head + move (D-pad right): turn sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): turn sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head_drive.neck_pitch.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for neck pitch, or none",
"Head + move (D-pad left): stick axis for neck pitch, or none",
),
entry(
"pad_axes.head_drive.neck_pitch.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the neck pitch stick",
"Head + move (D-pad left): reverse the neck pitch stick",
),
entry(
"pad_axes.head_drive.neck_pitch.gain",
Kind::Float,
"Head + move (D-pad right): neck pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): neck pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head_drive.head_pitch.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for head pitch, or none",
"Head + move (D-pad left): stick axis for head pitch, or none",
),
entry(
"pad_axes.head_drive.head_pitch.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the head pitch stick",
"Head + move (D-pad left): reverse the head pitch stick",
),
entry(
"pad_axes.head_drive.head_pitch.gain",
Kind::Float,
"Head + move (D-pad right): head pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): head pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head_drive.head_yaw.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for head yaw, or none",
"Head + move (D-pad left): stick axis for head yaw, or none",
),
entry(
"pad_axes.head_drive.head_yaw.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the head yaw stick",
"Head + move (D-pad left): reverse the head yaw stick",
),
entry(
"pad_axes.head_drive.head_yaw.gain",
Kind::Float,
"Head + move (D-pad right): head yaw sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): head yaw sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.head_drive.head_roll.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Head + move (D-pad right): stick axis for head roll, or none",
"Head + move (D-pad left): stick axis for head roll, or none",
),
entry(
"pad_axes.head_drive.head_roll.invert",
Kind::Bool,
"Head + move (D-pad right): reverse the head roll stick",
"Head + move (D-pad left): reverse the head roll stick",
),
entry(
"pad_axes.head_drive.head_roll.gain",
Kind::Float,
"Head + move (D-pad right): head roll sensitivity, ≥ 0 — above 1 reaches the limit early",
"Head + move (D-pad left): head roll sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.z.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for body height, or none",
"Body + head (D-pad right): stick axis for body height, or none",
),
entry(
"pad_axes.body_pose.z.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the body height stick",
"Body + head (D-pad right): reverse the body height stick",
),
entry(
"pad_axes.body_pose.z.gain",
Kind::Float,
"Body + head (D-pad down): body height sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): body height sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.pitch.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for body pitch, or none",
"Body + head (D-pad right): stick axis for body pitch, or none",
),
entry(
"pad_axes.body_pose.pitch.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the body pitch stick",
"Body + head (D-pad right): reverse the body pitch stick",
),
entry(
"pad_axes.body_pose.pitch.gain",
Kind::Float,
"Body + head (D-pad down): body pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): body pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.roll.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for body roll, or none",
"Body + head (D-pad right): stick axis for body roll, or none",
),
entry(
"pad_axes.body_pose.roll.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the body roll stick",
"Body + head (D-pad right): reverse the body roll stick",
),
entry(
"pad_axes.body_pose.roll.gain",
Kind::Float,
"Body + head (D-pad down): body roll sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): body roll sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.neck_pitch.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for neck pitch, or none",
"Body + head (D-pad right): stick axis for neck pitch, or none",
),
entry(
"pad_axes.body_pose.neck_pitch.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the neck pitch stick",
"Body + head (D-pad right): reverse the neck pitch stick",
),
entry(
"pad_axes.body_pose.neck_pitch.gain",
Kind::Float,
"Body + head (D-pad down): neck pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): neck pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.head_pitch.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for head pitch, or none",
"Body + head (D-pad right): stick axis for head pitch, or none",
),
entry(
"pad_axes.body_pose.head_pitch.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the head pitch stick",
"Body + head (D-pad right): reverse the head pitch stick",
),
entry(
"pad_axes.body_pose.head_pitch.gain",
Kind::Float,
"Body + head (D-pad down): head pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): head pitch sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.head_yaw.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for head yaw, or none",
"Body + head (D-pad right): stick axis for head yaw, or none",
),
entry(
"pad_axes.body_pose.head_yaw.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the head yaw stick",
"Body + head (D-pad right): reverse the head yaw stick",
),
entry(
"pad_axes.body_pose.head_yaw.gain",
Kind::Float,
"Body + head (D-pad down): head yaw sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): head yaw sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_axes.body_pose.head_roll.source",
Kind::Choice(crate::pad_axes::AXIS_SOURCES),
"Body + head (D-pad down): stick axis for head roll, or none",
"Body + head (D-pad right): stick axis for head roll, or none",
),
entry(
"pad_axes.body_pose.head_roll.invert",
Kind::Bool,
"Body + head (D-pad down): reverse the head roll stick",
"Body + head (D-pad right): reverse the head roll stick",
),
entry(
"pad_axes.body_pose.head_roll.gain",
Kind::Float,
"Body + head (D-pad down): head roll sensitivity, ≥ 0 — above 1 reaches the limit early",
"Body + head (D-pad right): head roll sensitivity, ≥ 0 — above 1 reaches the limit early",
),
entry(
"pad_head.neck_pitch_max",