Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Define four points of your circle on a coordinate system.

Image RemovedImage Added

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:

Image RemovedImage Added

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.

...

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.

Run the example

  1. Compile your code.
  2. Upload it in the LCC.
  3. Select vehicle 4 (simulated mode).
  4. Hit "Deploy". You will see a trail which builds and erases from point to point. This is your trajectory. Now move the simulated vehicle close to the trajectory by dragging it to a close point to the circle trajectory. A second trail will be drawn which is the trajectory for your vehicle to get the circle trajectory.
  5. Once the vehicle is on the circle trajectory it will drive continously in endless loop.
  6. To end the program hit "Kill".

...