There are two ways to control CPM vehicles, direct commands and trajectory commands.
Direct Command
See https://git.rwth-aachen.de/CPM/Project/Lab/cpm_base/blob/master/dds_idl/VehicleCommandDirect.idl
The direct command uses dimensionless, uncalibrated inputs and applies them directly to the motor and servo.
motor_throttle | steering_servo | |
---|---|---|
-1.0 | Maximum reverse acceleration | Full right |
0.0 | Brake, stop | Steering roughly centered, but may have an offset |
+1.0 | Maximum forward acceleration | Full left |
struct VehicleCommandDirect { octet vehicle_id; //@key Header header; double motor_throttle; // dimensionless, in [-1, 1] double steering_servo; // dimensionless, in [-1, 1] };
Trajectory Command
The reference trajectory is defined as Cubic Hermite spline. The points defining the spline must be given as a set of five numbers [ti, px(ti), py(ti), vx(ti), vy(ti)]
, where ti
is the absolute time of the trajectory point, [px, py]
is the position vector and [vx, vy]
is the velocity vector.
The time between trajectory points t(i+1) - t(i)
is not fixed, but should be between 100 ms and 500 ms. Due to network latency and the controller structure, the trajectory points need to be created and sent ahead of time. The exact required lead time is TBD, but 1000 ms should be enough.