"This tutorial shows how [Batch Processing](https://gitlab.lrz.de/tum-cps/commonroad_io/tree/batch_processing) is used to solve for solutions to different scenarios. It is composed of \n",
"* a configuration file (.yaml format),\n",
"* some helper functions,\n",
"* and the script below to call the planer function.\n",
"\n",
"Before proceeding, you should make sure the configuration file is set correctly. Here are the explanation for each of the parameters in the configuration file:\n",
"* **input_path**: input directory of CommonRoad scenarios that you indend to solve.\n",
"* **output_path**: output directory of the solution files.\n",
"* **overwrite**: flag to determine whether the existing solution files should be overwritten.\n",
"* **timeout**: timeout time for your motion planner, unit in seconds\n",
"* **motion_planner_path**: directory where the module containing the function to execute your motion planner is located\n",
"* **motion_planner_module_name**: name of the module that contains the function to execute your motion planner\n",
"* **motion_planner_function_name**: name of the function that executes your motion planner\n",
"* **default**: parameters specified under this section will be applied to all scenarios. If you wish to specify a different paramter for specific scenarios, simply copy the section and replace 'default' with the id of your scenario.\n",
"* **vehicle_model**: model of the vehicle, valid values: **PM, KS, ST and MB**. Please refer to [Vehicle Models](https://gitlab.lrz.de/tum-cps/commonroad-vehicle-models/blob/master/vehicleModels_commonRoad.pdf) for more information.\n",
"* **vehicle_type**: type of the vehicle, valid values: **FORD_ESCORT, BMW_320i and VW_VANAGON**.\n",
"* **cost_function**: identifier of cost function. Please refer to [Cost Functions](https://gitlab.lrz.de/tum-cps/commonroad-cost-functions/blob/master/costFunctions_commonRoad.pdf) for more information.\n",
"* **planner_id**: id of the planner that is used to solve for solutions. in this example, 1 = Greedy Best First Search, 2 = A*, else = Your own planner.\n",
"* **planning_problem_idx**: planner problem index. for cooperative scenarios: 0, 1, 2, ..., otherwise: 0\n",
"* **max_tree_depth**: maximum permissible depth of the search tree\n",
"\n",
"Note: the paths can be either **relative** to this script or **absolute**.\n",
"\n",
"Simply run the following script to start batch processing. The results here is just exemplary, you will see different output as your configuration varies."
This tutorial shows how [Batch Processing](https://gitlab.lrz.de/tum-cps/commonroad_io/tree/batch_processing) is used to solve for solutions to different scenarios. It is composed of
* a configuration file (.yaml format),
* some helper functions,
* and the script below to call the planer function.
Before proceeding, you should make sure the configuration file is set correctly. Here are the explanation for each of the parameters in the configuration file:
***input_path**: input directory of CommonRoad scenarios that you indend to solve.
***output_path**: output directory of the solution files.
***overwrite**: flag to determine whether the existing solution files should be overwritten.
***timeout**: timeout time for your motion planner, unit in seconds
***motion_planner_path**: directory where the module containing the function to execute your motion planner is located
***motion_planner_module_name**: name of the module that contains the function to execute your motion planner
***motion_planner_function_name**: name of the function that executes your motion planner
***default**: parameters specified under this section will be applied to all scenarios. If you wish to specify a different paramter for specific scenarios, simply copy the section and replace 'default' with the id of your scenario.
***vehicle_model**: model of the vehicle, valid values: **PM, KS, ST and MB**. Please refer to [Vehicle Models](https://gitlab.lrz.de/tum-cps/commonroad-vehicle-models/blob/master/vehicleModels_commonRoad.pdf) for more information.
***vehicle_type**: type of the vehicle, valid values: **FORD_ESCORT, BMW_320i and VW_VANAGON**.
***cost_function**: identifier of cost function. Please refer to [Cost Functions](https://gitlab.lrz.de/tum-cps/commonroad-cost-functions/blob/master/costFunctions_commonRoad.pdf) for more information.
***planner_id**: id of the planner that is used to solve for solutions. in this example, 1 = Greedy Best First Search, 2 = A*, else = Your own planner.
***planning_problem_idx**: planner problem index. for cooperative scenarios: 0, 1, 2, ..., otherwise: 0
***max_tree_depth**: maximum permissible depth of the search tree
Note: the paths can be either **relative** to this script or **absolute**.
Simply run the following script to start batch processing. The results here is just exemplary, you will see different output as your configuration varies.
"This tutorial demonstrates how are the motion primitives generated. You can find all related files in the [CommonRoad Search](https://gitlab.lrz.de/tum-cps/commonroad-search) repository, under folder GSMP/tools/motion_primitive_generator/.\n",
"\n",
"The main components are:\n",
"* **motion_primitives_config.yaml** in which the configuration is set;\n",
"* **implementation.py** in which the main functions are implemented; and\n",
"* the script below to execute the functions.\n",
"\n",
"Before proceeding, you should make sure the configuration file is set correctly, which consists of the following parameters:\n",
"* **output setting**:\n",
" * output_directory: output directory for generated motion primitives.\n",
"* **vehicle setting**:\n",
" * veh_type_id: id of vehicle type. 1: FORD_ESCORT, 2: BMW_320i, 3: VW_VANAGON\n",
"* **primitive setting**:\n",
" * T: time length of trajectory [s].\n",
" * dt_simulation: time step for forwad state simulation [s].\n",
" * velocity_sample_max: maximum sampling velocity [m/s].\n",
" * num_sample_velocity: number of velocity samples.\n",
" * steering_angle_sample_min: minimum sampling angle [rad]. Note that here we only consider steering to one side, as we will mirror the primitives afterwards.\n",
" * steering_angle_sample_max: maximum sampling angle [rad]. If set to 0, it will be assigned the maximum permissible value given by the selected vehicle parameter.\n",
" * num_sample_steering_angle: number of steering angle samples\n",
"* **sample trajectory setting**: \n",
" * num_segment_trajectory: number of segments in sample trajectories\n",
" * num_simulations: number of sample trajectories to be generated\n",
"\n",
"Note: the paths can be either **relative** to this script, or **absolute**."
"# parse configuration and generate parameter object\n",
"parameters = Parameter(configuration)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Generate motion primitives\n",
"The attributes of each of the states in a motion primitive are: x position, y position, steering angle, velocity in x direction, orientation and time step"