Configuration and Experiments¶
Single Car Experiment¶
In order to run a single car experiment, a custom folder <experiment_name> should be created inside the <root_dir>/experiments folder. The folder consists of different *.yaml files which contain the configuration of each component for this experiment.
Configuration Files¶
The following configuration files fully define an experiment:
Required
<experiment_name>/controller.yaml-> See Ros Controllers<experiment_name>/estimator.yaml-> See Ros Estimators<experiment_name>/model.yaml-> See Pacejka Model or Kinematic Model<experiment_name>/visualizer.yaml-> See Ros Visualizer
Optional
<experiment_name>/simulator.yaml-> See Ros Simulator<experiment_name>/backtracker.yaml-> See Ros Backtracker
For a full overview of all configuration parameters, check the Configuration Section
Backups¶
If the argument copy_config (default true) is set, every time an experiment is started, the used configuration files are automatically copied and saved under experiment_<YYYY_MM_DD>/<experiment_type>/<HH_MM_SS>/config.
Additionally, if the record_bag argument is set to true (default for real world), a rosbag containing ALL published topics will be recorded and saved at experiment_<YYYY_MM_DD>/<experiment_type>/<HH_MM_SS>/*.bag
Launching¶
Use the following ros commands to start an experiment for a given
# Simulation
roslaunch crs_launch sim_single_car.launch experiment_name:=<experiment_name>
# Real World
roslaunch crs_launch run_single_car.launch experiment_name:=<experiment_name>
Important launch file arguments¶
The following launch file arguments can be set by the user:
roslaunch crs_launch sim_single_car.launch \
experiment_name:=<experiment_name> \
namespace:=<namespace>\
view_rviz:=<true|false>\
use_backtracker:=<true|false>\
track_name:=<TRACK_NAME>\
record_bag:=<true|false>\
copy_config:=<true|false>\
bypass_estimator:=<true|false> # only simulation
use_velocity_control:=<true|false> # only real-world
| Argument | Description |
|---|---|
| namespace | Namespace of all the nodes. Use this to launch different cars. |
| experiment_name | Name of the experiment folder that contains all .yaml configurations of the components |
| view_rviz | If true, starts an rviz node for visualization |
| use_backtracker | If true, uses a backtracker as defined in the backtracker.yaml config to recover from crashes |
| bypass_estimator | If true, bypasses the state estimation and directly uses the gt state of the simulator |
| track_name | Name of the track that should be loaded. |
| record_bag | if true, recoard a .bag file with all topics |
| copy_config | if true, backs up all .yaml configurations on execution |
| use_velocity_control | if true, makes the cars track the MPC velocity reference instead of the throttle input |
In addition, each configuration entry can also be overwritten if, for any reason, another configuration file than the one located in the experiment folder should be used.
For example
roslaunch crs_launch sim_single_car experiment_name:="my_experiment" estimator_config:="<path_to_custom_estimator.yaml>" will use all configuration files from the experiment folder except the estimator configuration which is loaded from <path_to_custom_estimator.yaml>
The following arguments can be overwritten:
| Configuration Argument | Default |
|---|---|
| experiment_path | $(eval find('crs_launch') + '/../../experiments/' + arg('experiment_name')) |
| model_config | $(arg experiment_path)/model.yaml |
| simulator_config | $(arg experiment_path)/simulator.yaml |
| controller_config | $(arg experiment_path)/controller.yaml |
| visualizer_config | $(arg experiment_path)/visualizer.yaml |
| backtracker_config | $(arg experiment_path)/backtracker.yaml |
| estimator_config | $(arg experiment_path)/estimator.yaml |
Multi Car Experiments¶
The setup for multi car experiments are similar to the single car ones. However, depending on the number of cars and respective configurations, the sim_multi_car.launch file needs to be modified.
The following shows an example configuration and modified .launch file that can be used to launch multiple cars in simulation. The cars differ by their respective color in the visualizer and have different underlying models but otherwise use the same configurations:
experiments
└─── multi_car_experiment
├── shared_config
| ├── model.yaml
| ├── simulator.yaml
| ├── controller.yaml
| ├── backtracker.yaml
| └── estimator.yaml
├── car_1
| ├── red_car_visualizer.yaml
| └── model.yaml
└── car_2
├── blue_car_visualizer.yaml
└── model.yaml
<launch>
<arg name = "bypass_estimator" default = "false" doc = "If true, bypasses the state estimation and directly uses the gt state of the simulator "/>
<arg name = "track_name" default = "DEMO_TRACK" doc = "Name of the track that should be loaded. "/>
<!-- Start Car 1 -->
<include file="$(find crs_launch)/launch/sim_single_car.launch">
<arg name = "experiment_name" value = "multi_car_experiment/shared_config" />
<arg name = "namespace" value = "car_1" />
<arg name = "run_type" value = "sim_multi/car_1" doc = " name of backup folder that is created (experiments/sim_multi/car_1/...."/>
<arg name = "visualizer_config" value = "<experiment_dir>/multi_car_experiment/car_1/red_car_visualizer.yaml" />
<arg name = "model_config" value = "<experiment_dir>/multi_car_experiment/car_1/model.yaml" />
<arg name = "view_rviz" value = "false" />
<arg name = "bypass_estimator" value = "$(arg bypass_estimator)" />
<arg name = "track_name" value = "$(arg track_name)" />
</include>
<!-- Start Car 2 -->
<include file="$(find crs_launch)/launch/sim_single_car.launch">
<arg name = "experiment_name" value = "multi_car_experiment/shared_config" />
<arg name = "namespace" value = "car_2" />
<arg name = "run_type" value = "sim_multi/car_2" doc = " name of backup folder that is created (experiments/sim_multi/car_2/...."/>
<arg name = "visualizer_config" value = "<experiment_dir>/multi_car_experiment/car_2/blue_car_visualizer.yaml" />
<arg name = "model_config" value = "<experiment_dir>/multi_car_experiment/car_2/model.yaml" />
<arg name = "view_rviz" value = "false" />
<arg name = "bypass_estimator" value = "$(arg bypass_estimator)" />
<arg name = "track_name" value = "$(arg track_name)" />
</include>
<node pkg="rviz" name="rviz" type="rviz" args="-d $(find car_track_visualizer)/config/single_car.rviz" />
</launch>