The package provides the following classes:
-
RaceTrackHandler: Loads the configuration of a Racetrack (e.g. Monza) from config-Files (and overwrites). Provides you with the desired track and raceline and additional Information of the track e.g.:
- geodetic_origin
- sim_start_pos
- initial_heading
-
Track: Provides access to track data and various functions to calculate accelerations, rotations, etc. based on the track.
-
Raceline: Provides access to raceline data
If you have a track instance (see above) those functions should not be required. These are a implementation detail of the Track.
- rotation.hpp: Provides functions to calc/convert angles on the track
- acceleration.hpp: Provides functions to calc/convert accelerations on the track
CMakeLists.txt
find_package(track_handler_cpp REQUIRED)
ament_target_dependencies(${YOUR_TARKGET} PUBLIC track_handler_cpp)package.xml
<depend>track_handler_cpp</depend>The recommended way to get a track is via a RaceTrackHandler. This will automatically load the right track from configuration/overwrites.
#include "track_handler_cpp/race_track_handler.hpp"
auto raceTrackHandler = tam::common::RaceTrackHandler::from_pkg_config();This RaceTrackHandler provides you with additional information on the Track:
raceTrackHandler->get_geo_origin();
raceTrackHandler->get_sim_start_pos();
raceTrackHandler->get_initial_heading();
raceTrackHandler->get_track_name();
...To get a track use the following method of the RaceTrackHandler, and store the returned Track in your code.
std::unique_ptr<tam::common::Track> track = raceTrackHandler->create_track();
std::unique_ptr<tam::common::Track> pit = raceTrackHandler->create_pitlane();To get a raceline use the following method of the RaceTrackHandler, and store the returned Raceline in your code.
std::unique_ptr<tam::common::Raceline> track = raceTrackHandler->create_raceline();To use the pybind of the track_handler:
In the pathon script:
from track_handler_py import RaceTrackHandler, Track, RacelineConstructing the Track/Raceline via
auto raceTrackHandler = tam::common::RaceTrackHandler::from_pkg_config();handles the parameters and configuration for you.
Default parameters for different Tracks are stored in config/ and should be provided in the shown format. All Parameters/Files provided in config_overwrite/ will overwrite the default parameters.
You can specify the following Parameters:
- Racetrack (config.yml): Allows to specify the racetrack (e.g. Monza)
- Track Config (e.g. Monza/config.yml): Allows to specify individual parameters for racetracks
- Raceline Files (e.g. Monza/raceline/): Dump Raceline-Files here (Raceline files include all required track information)
To overwrite the track configuration inside the container (e.g. from tam_launch), mount a local folder to the config_overwrite/ folder inside the container:
YOUR_MODULE:
image: gitlab.lrz.de:5005/tam/<YOUR_MODULE>:<YOUR_TAG>
network_mode: "host"
volumes:
- "./<LOCAL_FOLDER>:/dev_ws/install/track_handler_cpp/share/track_handler_cpp/config_overwriteFor tam_launch:
YOUR_MODULE:
image: gitlab.lrz.de:5005/tam/<YOUR_MODULE>:<YOUR_TAG>
network_mode: "host"
volumes:
- "./config/track_handler:/dev_ws/install/track_handler_cpp/share/track_handler_cpp/config_overwriteThe provided track data follows the ENU (East, North, Up) convention for cartesian coordinate systems. And is a right-handed coordinate system.
- x-axis: East
- y-axis: North
- z-axis: Up
- heading=0 means driving east. The heading increases counter clockwise.
For an Example on how to plot the whole track/raceline data see: test_plot.cpp
To run test_plot.cpp:
colcon build --packages-up-to track_handler_cpp && . install/setup.bash && ros2 run track_handler_cpp test_plot