How to drive a simulated robot from chat
언제 쓸까: You want to test high-level robot behaviors quickly.
사전 조건
- ROS 2 (Humble/Jazzy) or ROS 1 running — Docker containers for Humble work great for quick starts
- rosbridge_suite installed + running — ros2 launch rosbridge_server rosbridge_websocket_launch.xml
- Python 3.10+ + uvx — brew install [email protected] uv
흐름
-
Connect to rosbridgeConfigure the MCP with ROSBRIDGE_URL=ws://localhost:9090 and verify connection.✓ 복사됨→ List of active topics returned
-
Move the robotPublish to /cmd_vel a Twist message moving forward at 0.2 m/s for 3 seconds, then stop.✓ 복사됨→ Robot moves in sim
-
Read a sensorSubscribe to /scan for 2 seconds and report obstacles within 1m.✓ 복사됨→ Range data summary
결과: A live robot responding to natural-language commands.
함정
- Sending too-fast velocity commands crashes/tips the robot — Rate-limit commands in your prompt; start with small velocities
- Unsafe autonomy — no geofence — Always run first in simulation (Gazebo); never wire this to a physical robot without e-stop