You find the source code for our examples in the software-folder:
https://github.com/embedded-software-laboratory/cpm_lab/tree/master/high_level_controller/examples/cpp/basic_circle
https://github.com/embedded-software-laboratory/cpm_lab/tree/master/high_level_controller/examples/matlab/basic_circle
The vehicle will drive in a basic circle with a radius of 1m. The center of the circle will be in the center of the map, but the circle will not be connected to the map.
Define the ID of the vehicle you want to drive (In the case of the example it is ID "4").
Initialize a DDS Writer for the RTI DDS Service to ensure that position and speed will be sent to the simulation and the vehicle.
Define four points of your circle on a coordinate system.
Define the speed vector of the vehicle for each point for the entire trajectory. When you define v_x and v_y remember that vges = sqrt(vx^2 +vy^2) (as it is a vector). You use this vector to define the direction for your vehicle, so where it has to steer next. Always assign at least a small value to both vectors to ensure the correct direction. Remember that your are defining a physical system, so avoid sharp edges.
Draw the vecotrs on each point of your trajectory:
Now implement your points and speed values using the predefined vetors trajectory_px and trajectory_py for your points of the trajectory and trajectory_vx and trajectory_vy for the speed at each point. The speed is given in m/s. Set the center of the circle to the center of the map at x =2,25m and y= 2m.
For the segment duration keep in mind that speed, time and waylength have to fit. Verify your speed/way/duration with vges =ssegment/tsegmentduration.
All data are sent to the vehicle using the writer-function from the beginning in the form of
{point_x_position;
point_y_position;
velocity_x_direction;
velocity_y_direction;
timestamp;
}
where each value is a scalar.
hlc_" + vehicle_id
, where the latter is the ID of the vehicle the HLC is responsible for