State Machine Switching Example
Run the State Machine
Section titled “Run the State Machine”source install/setup.bashros2 run dr02_pro state_machineKeyboard Control Test
Section titled “Keyboard Control Test”After starting the state machine, use keyboard control via the terminal:
# Start the state machineros2 run dr02_pro state_machine
# Press keys in the terminal:# z - Enter ZeroPos (return to zero position)# c - Enter RLControl (RL control)# r - Enter JointDamping (joint damping)# w/s - Forward/backward (in RLControl state)# a/d - Left/right# q/e - Turn left/rightGamepad Control Test
Section titled “Gamepad Control Test”Ensure the gamepad is connected and publishing data via the /GAMEPAD_KEY topic:
# Monitor gamepad buttonsros2 topic echo /GAMEPAD_KEY
# Then press gamepad buttons:# L1 - Enter ZeroPos# L2 - Enter RLControl# R2 - Enter JointDampingNormal Exit Procedure
Section titled “Normal Exit Procedure”- Exit the SDK program in the terminal
- Switch the robot back to Idle state
- Exit developer mode via the gamepad