PhysiCar ROS 2¶
examples/physicar-ros.ipynb is a runnable tour of the robot's two programming
interfaces: its ROS 2 topics and its local Web API. Every sensor gets read, every
control gets published, every endpoint gets called — one cell at a time. The other
examples are wrappers around what this notebook shows; run it first and none of them will
look like magic.
Inside the notebook¶
| Section | What you run |
|---|---|
| 1. ROS 2 Interfaces | rclpy setup, then every sensor topic — camera, battery, IMU, odometry, LiDAR — and every control topic: /cmd_vel, /speed, /steering, camera pan/tilt |
| 2. Web API | the same robot over HTTP: sensor queries (with streaming), control — including duration driving and the WebSocket dead-man switch — and audio playback |
Run it¶
- In the workspace file explorer, open
examples/physicar-ros.ipynb. - Pick the Python 3 (PhysiCar AI) kernel when asked.
- Run the setup cell of a section first; after that, jump to whatever interests you.
It runs the same in the simulator and on a real kit — that is the point: the topics and endpoints are identical, so this notebook is the Sim2Real contract.
Worth noticing¶
wait_for_message— receive one message without spinning a node; the pattern that makes ROS 2 pleasant in a notebook.- Sensor QoS — the LiDAR publishes best-effort; subscribe with
qos_profile_sensor_dataor you receive nothing. - The watchdog — a plain
/speedcommand expires after about a second. A robot that stops hearing from you is a robot that stops. POST /speedwithduration— the server holds the speed, stops at the end, and only then answers. One request, one complete and safe maneuver.- Units — speed in m/s;
/steeringin radians, ±0.35 (≈±20°); camera pan/tilt ±30°. - Audio —
POST /audio/playtakes a URL, a file path, or raw base64; in the simulator the sound plays in the browser viewer.
🛠 Mission: using only Web API calls, drive a (rounded) square: four
POST /speed requests with duration, a POST /steering between each.
Learn more
Topics and nodes, gently → ROS2 basics. Full topic list → ROS2 interface reference. Full endpoint list → Web API.