Implements terminal-based curses UI for interactive bench testing of SaltyBot motors via Termux. Features: - Interactive keyboard-based joystick (W/A/S/D or arrow keys) - Conservative velocity defaults: 0.1 m/s linear, 0.3 rad/s angular - Real-time velocity feedback with bar graphs - Spacebar e-stop (instantly zeros velocity) - 500ms timeout safety (sends zero velocity if idle) - Dual backend: ROS2 (/cmd_vel) or WebSocket - Graceful fallback if ROS2 unavailable Safety Features: - Conservative defaults (0.1/0.3 m/s) - E-stop button (spacebar) - 500ms timeout (sends zero if idle) - Input clamping and exponential decay - Status/warning displays Files: - motor_test_joystick.py: Main application - MOTOR_TEST_JOYSTICK.md: User documentation - INSTALL_MOTOR_TEST.md: Installation guide Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Motor Test Joystick Installation (Issue #513)
Quick setup guide for installing motor_test_joystick.py on Termux.
Prerequisites
- Android phone with Termux installed
- Python 3.9+ (installed via termux-bootstrap.sh)
- ROS2 Humble OR Jetson bridge running on networked Jetson Orin
Installation
1. Copy script to phone
# Option A: Via git
cd ~
git clone https://gitea.vayrette.com/seb/saltylab-firmware.git
# Option B: Via adb
adb push phone/motor_test_joystick.py /data/data/com.termux/files/home/
2. Make executable
chmod +x ~/saltylab-firmware/phone/motor_test_joystick.py
Quick Test
1. Start on phone (Termux)
ROS2 mode (requires Jetson ros_core running):
python3 ~/saltylab-firmware/phone/motor_test_joystick.py
WebSocket mode (if Jetson IP is 192.168.1.100):
python3 ~/saltylab-firmware/phone/motor_test_joystick.py \
--backend websocket \
--host 192.168.1.100
2. Verify on Jetson
ros2 topic echo /cmd_vel
3. Safety test
- Move joystick (W key)
- Watch /cmd_vel values change
- Press spacebar (E-stop)
- Verify velocities go to 0.0
- Press Q to quit
Configuration
Adjust velocity limits
# Conservative (default)
python3 motor_test_joystick.py # 0.1 m/s, 0.3 rad/s
# Moderate
python3 motor_test_joystick.py --linear-max 0.3 --angular-max 0.8
# Aggressive
python3 motor_test_joystick.py --linear-max 0.5 --angular-max 1.5
Change Jetson address
# Static IP
python3 motor_test_joystick.py --backend websocket --host 192.168.1.100
# mDNS hostname
python3 motor_test_joystick.py --backend websocket --host saltybot.local
# Different port
python3 motor_test_joystick.py --backend websocket --host 192.168.1.100 --port 8080
Troubleshooting
"ROS2 module not found"
→ Use WebSocket backend: --backend websocket --host <jetson-ip>
"Connection refused" (WebSocket mode)
→ Check Jetson IP, verify bridge listening on :9090
Motors not responding
- Verify e-stop status (should show "Inactive")
- Check timeout warning (>500ms = zero velocity)
- Monitor Jetson:
ros2 topic echo /cmd_vel - Verify network connectivity
Terminal display issues
- Try
resetorstty sanein Termux - Increase terminal size (pinch-zoom)
- Use external keyboard (more reliable)
Safety Checklist
- Phone connected to Jetson (WiFi/tether)
- Motors disconnected or isolated (bench testing)
- E-stop accessible (spacebar)
- Terminal window visible
- Max velocities appropriate (conservative defaults)
- Kill switch ready (Ctrl+C)
Support
- Main documentation:
MOTOR_TEST_JOYSTICK.md - Issue tracker: #513
- Termux wiki: https://wiki.termux.com/