Interface Reference
This page describes the messages, topics, coordinate frames, units and timing a motion planner works with. See Your First Motion Planner for a complete example and Vehicle Limits and Simulation for what the vehicles can physically do.
Frames and Units
All positions, speeds and angles are SI units at lab scale: meters, meters per second and radians. One lab meter corresponds to 18 meters of the real-world map, see Lanelet2 Maps.
All poses are in the
mapframe. Its origin is a corner of the lab track; x and y span about 4.5 m x 4.0 m on the lab maps. The vehicle controller ignores commands whoseheader.frame_idis notmap.The yaw angle is measured counter-clockwise from the x axis. Messages carry it as quaternion; for a planar pose
z = sin(yaw / 2)andw = cos(yaw / 2).The pose of a vehicle is the center of the vehicle.
Times are ROS times (
builtin_interfaces/Time) of the lab clock. The vehicles synchronize their clocks with the central workstation.
Warning
For a life-size display in RViz and Lichtblick, the TF frames vehicle_<id> and the map markers are scaled by 18.
The messages themselves are always in lab meters. Do not use TF to transform lab data; use the poses in the
messages directly.
Topics of a Motion Planner
The planner runs in ROS_DOMAIN_ID=1. All topics are in the /planner namespace:
Topic |
Type |
Description |
|---|---|---|
|
|
States of all deployed vehicles, every planner period while the experiment runs. |
|
|
The map, published once with transient local durability. |
|
|
Coordination between bridge and planner. |
|
|
Commands of the planner, one per vehicle and period. Use a reliable publisher. |
The lab domain (ROS_DOMAIN_ID=21) contains the same data per vehicle, for example to observe an experiment:
/lab/vehicle_<id>/vehicleState, /lab/vehicle_<id>/vehicleObservation, /lab/vehicle_<id>/command,
/lab/map and /lab/system_trigger.
Messages
VehicleStateList
Field |
Description |
|---|---|
|
Lab time when the bridge sent the list. Use it as the reference time of your planning step. |
|
One |
VehicleState
The current state of a vehicle, estimated by its vehicle controller from the IPS, the odometer and the IMU.
Field |
Description |
|---|---|
|
ID of the vehicle, 1 to 20. |
|
Time at which the state was valid. |
|
Position and orientation in the |
|
Speed in m/s, positive when driving forward. |
|
Yaw rate measured by the IMU. |
|
IMU acceleration forward (x), left (y) and up (z). |
|
Time since the last IPS observation, stored as duration. The vehicle stops path and trajectory commands if it exceeds 3 s. |
|
Driven distance in m. |
|
Battery voltage in V and the measured motor current. |
|
Actuator outputs of the current control cycle, see |
VehicleCommand
The command for one vehicle. The type selects how the vehicle controller follows it, see
Understanding the Vehicle Controller.
Field |
Description |
|---|---|
|
ID of the vehicle the command is for. Must be set. |
|
|
|
|
|
Time from which the command is applied, see Timing. |
|
|
|
Target speed in m/s for |
|
Target curvature in 1/m for |
|
List of |
PathPoint
Field |
Description |
|---|---|
|
Position and heading of the point. Always required. |
|
|
|
|
|
|
Command Types
PATH_TRACKINGThe vehicle follows a geometric path at the constant speed
speed. The controller interpolates the path with cubic Hermite splines overdistanceand steers with a Stanley controller. Requirements:at least 4 points, with strictly increasing
distance,the path must continue for at least two points beyond the point closest to the vehicle, so send a path that reaches well beyond the distance the vehicle drives in one period,
the headings of the points should match the direction of the path.
This is the easiest type to start with.
TRAJECTORYThe vehicle follows a path in space and time. Every point has a
timeand aspeed; the controller interpolates between the points over time and tracks the position with a model predictive controller. Requirements, checked every 20 ms:at least 2 points, sorted by
time,the first point must lie before now + 0.11 s,
the last point must lie at least 0.36 s in the future.
If a requirement is violated or the controller cannot follow the trajectory, it logs a warning and the vehicle rolls out without throttle. Send trajectories that reach several periods into the future so a delayed command does not stop the vehicle.
SPEED_CURVATUREThe vehicle drives with the given
speedandcurvature. Useful for simple reactive controllers. Curvatures above about 4.1 1/m saturate the steering.DIRECTSets the actuators directly:
motor_throttlein [-1, 1] (positive forward; values within ±0.05 brake on the real vehicle) andsteering_servoin [-1, 1] (positive to the left). There is no speed control and no safety check besides the stop mechanisms. Used by manual control.
SystemTrigger
Type |
Meaning |
|---|---|
|
The experiment starts. Sent by the control flow and forwarded by the bridge. |
|
Stop all vehicles. Sent by the control flow or the bridge; a planner may send it on a fatal error. |
|
A component is ready. A planner sends one per vehicle with |
|
Ask the map server to publish the map again. |
|
The bridge asks all components whether they are ready. Sent every period until ready. |
|
Used by the IPS to control the vehicle LEDs. |
The bridge only forwards triggers whose source_id starts with planner from the planner domain and with lab
from the lab domain.
Timing
The vehicle controllers run every 20 ms. The IPS measures the vehicles at 50 Hz.
The bridge sends the vehicle states every planner period (default 400 ms, chosen when deploying). Your planner should answer within one period.
A command is applied from its
valid_after_stampon. Each vehicle keeps a queue of received commands and, every 20 ms, applies the newest command whosevalid_after_stamphas passed. Set it to thestampof the state list plus a small lead time, e.g. 40 to 60 ms, to compensate the network latency. An unsetvalid_after_stamp(0) applies the command immediately and breaks the evaluation.A command stays active until it is replaced. There is no timeout for old commands, so a vehicle keeps following its last path or trajectory if your planner stops sending.
After a
STOPthe vehicle stays in stop mode for at least 1 s and until a new command becomes valid.The bridge stops the experiment if the state of a deployed vehicle is older than 1 s.