Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Port planning_sim_launcher to ROS2 #2

Draft
wants to merge 2 commits into
base: ros2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions CMakeLists.txt

This file was deleted.

16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ See [https://github.com/tier4/AutowareArchitectureProposal#how-to-setup](https:/

## 2. Usage

(2020/07/01 last modified)
(2020/11/23 last modified)

### 2.1 Get Sample Scenario

Expand Down Expand Up @@ -66,22 +66,12 @@ Note that the Map path must be rewritten when sharing a scenario with multiple u

#### (3) Execute

##### (a) Terminal A

``` shell
source /opt/ros/melodic/setup.bash
source /path/to/AutowareArchitectureProposal/install/setup.bash

rosrun planning_simulator_launcher scenario_roslaunch_server.py
```

#### (b) Terminal B

``` shell
source /opt/ros/melodic/setup.bash
source /opt/ros/foxy/setup.bash
source /path/to/AutowareArchitectureProposal/install/setup.bash

rosrun planning_simulator_launcher launch.py --timeout=180 && rosrun planning_simulator_launcher show_result.py ./scenario/generated ./scenario/log
ros2 run planning_simulator_launcher launch.py --timeout=180 && ros2 run planning_simulator_launcher show_result.py ./scenario/generated ./scenario/log
```
Command-line arguments of script `python show_result.py` is depends on the path you written in `scenario_database.json`.
1st argument is path to your directory your scenarios placed on + `/generated`.
Expand Down
4 changes: 2 additions & 2 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

print('\x1B[1;31mThis script has been deprecated.\x1B[0m')
print('\x1B[1;31mPlease use the following command.\x1B[0m')
print('\x1B[1;32m> rosrun planning_simulator_launcher launch.py\x1B[0m')
print('\x1B[1;32m> ros2 run planning_simulator_launcher launch.py\x1B[0m')

import os
import sys

os.system('rosrun planning_simulator_launcher launch.py ' + ' '.join(sys.argv[1:]))
os.system('ros2 run planning_simulator_launcher launch.py ' + ' '.join(sys.argv[1:]))
9 changes: 3 additions & 6 deletions launch/default.launch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
<arg name="vehicle_model" default="lexus"/> <!-- PROJECT REPOSITORY EDIT HERE! -->
<arg name="rviz" default="true"/>

<arg name="log_output_dir"/>
<arg name="scenario_id"/>
<arg name="scenario_path"/>
<arg name="scenario_runner_output" default="screen"/>

<include file="$(find planning_simulator_launcher)/launch/scenario_launcher.launch" pass_all_args="true"/>
<include file="$(find-pkg-share planning_simulator_launcher)/launch/scenario_launcher.launch" pass_all_args="true">
<param from="$eval($(find-pkg-share($var(vehicle_model) + '_description')+'/config/vehicle_info.yaml" />
</include>
</launch>
56 changes: 9 additions & 47 deletions launch/scenario_launcher.launch
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,31 @@
<arg name="vehicle_model"/>
<arg name="rviz" default="true"/>
<arg name="use_object_recognition" default="true"/>

<!-- Parameters for Scenario Runner -->
<arg name="log_output_dir"/>
<arg name="scenario_id"/>
<arg name="scenario_path"/>
<arg name="scenario_runner_output" default="screen"/>
<arg name="initial_engage_state" />

<!-- Simulation Clock -->
<arg name="use_sim_time" default="false"/>
<param name="/use_sim_time" value="$(arg use_sim_time)"/>

<!-- Planning Simulator -->
<include file="$(find autoware_launch)/launch/planning_simulator.launch">
<include file="$(find-pkg-share autoware_launch)/launch/planning_simulator.launch">
<!-- planning_simulator.launch's essential parameters -->
<arg name="map_path" value="$(arg map_path)"/>
<arg name="sensor_model" value="$(arg sensor_model)"/>
<arg name="vehicle_model" value="$(arg vehicle_model)"/>
<arg name="map_path" value="$(var map_path)"/>
<arg name="sensor_model" value="$(var sensor_model)"/>
<arg name="vehicle_model" value="$(var vehicle_model)"/>

<!-- planning_simulator.launch's optional parameters -->
<arg name="rviz" value="$(arg rviz)"/>
<arg name="rviz_args" value="-d $(find scenario_api)/rviz/planning_simulator.rviz"/>
<arg name="rviz" value="$(var rviz)"/>
<arg name="rviz_args" value="-d $(find-pkg-share scenario_api)/rviz/planning_simulator.rviz"/>

<!-- simple_planning_simulator.launch's optional parameters -->
<arg name="initial_engage_state" value="false"/>

<!-- dummy_perception_publisher.launch's optional parameters -->
<arg name="perception/enable_detection_failure" value="false" />
<arg name="perception/enable_object_recognition" value="$(arg use_object_recognition)" />
<arg name="perception/enable_object_recognition" value="$(var use_object_recognition)" />
<arg name="sensing/visible_range" value="1000" />
</include>

<include file="$(find npc_simulator)/launch/npc_simulator.launch">
<arg name="initial_engage_state" value="false"/>
</include>

<!-- Scenario Runner -->
<node pkg="scenario_runner" type="scenario_runner_node" name="scenario_runner_node" output="$(arg scenario_runner_output)">
<param name="camera_frame_id" value="camera5/camera_optical_link"/> <!-- base link of front camera -->
<param name="log_output_path" value="$(arg log_output_dir)/$(arg scenario_id).json"/>
<param name="scenario_id" value="$(arg scenario_id)"/>
<param name="scenario_path" value="$(arg scenario_path)"/>
<remap from="~input/autoware_state" to="/autoware/state"/>
<remap from="~input/pointcloud" to="/sensing/lidar/no_ground/pointcloud"/>
<remap from="~input/route" to="/planning/mission_planning/route"/>
<remap from="~input/signal_command" to="/vehicle/status/turn_signal"/>
<remap from="~input/vectormap" to="/map/vector_map"/>
<remap from="~input/vehicle_twist" to="/vehicle/status/twist"/>
<remap from="~output/autoware_engage" to="/autoware/engage"/>
<remap from="~output/check_point" to="/planning/mission_planning/checkpoint"/>
<remap from="~output/goal_point" to="/planning/mission_planning/goal"/>
<remap from="~output/initial_velocity" to="/initialtwist"/>
<remap from="~output/lane_change_permission" to="/planning/scenario_planning/lane_driving/lane_change_approval"/>
<remap from="~output/limit_velocity" to="/planning/scenario_planning/max_velocity"/>
<remap from="~output/npc_simulator_engage" to="/simulation/npc_simulator/engage"/>
<remap from="~output/object_info" to="/simulation/npc_simulator/object_info"/>
<remap from="~output/simulator_engage" to="/vehicle/engage"/>
<remap from="~output/start_point" to="/initialpose"/>
<remap from="~output/traffic_detection_result" to="/perception/traffic_light_recognition/traffic_light_states"/>
<remap from="~rosparam/add_simulator_noise" to="/simple_planning_simulator/add_measurement_noise"/> <!-- rosparam: add simulator noise or not -->
<remap from="~rosparam/max_velocity" to="/planning/scenario_planning/motion_velocity_optimizer/max_velocity"/> <!-- rosparam: max velocity -->
<remap from="~rosparam/simulator_pos_noise" to="/simple_planning_simulator/pos_noise_stddev"/> <!-- rosparam: std of simulator pos noise -->
</node>

<!-- Recording -->
<node pkg="rosbag" type="record" name="rosbag_recorder" output="screen" respawn="false" respawn_delay="0" args="record --lz4 -a -O $(arg log_output_dir)/$(arg scenario_id).bag"/>
<node pkg="rosbag" exec="record" name="rosbag_recorder" output="screen" respawn="false" respawn_delay="0" args="record --lz4 -a -O $(var log_dir)/$(var scenario_id).bag"/>
</launch>
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>planning_simulator_launcher</name>
<version>0.0.1</version>
<version>0.0.0</version>
<description>The planning_simulator_launcher package</description>

<maintainer email="[email protected]">Masaya Kataoka</maintainer>
Expand Down
Loading