From 4245900fb66a48397241c9ecc5771c51578e3449 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Thu, 14 Oct 2021 13:11:51 +0900 Subject: [PATCH 1/8] Add simulator_launch package (#459) * Add simulator_launch package * add argument * fix depend order * add argument * move dummy_perception_publisher * add arg for dummy_perception_publisher * Update simulator_launch/launch/simulator.launch.xml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> --- launch/simulator_launch/CMakeLists.txt | 14 ++++++++++++ launch/simulator_launch/README.md | 11 ++++++++++ .../launch/simulator.launch.xml | 20 +++++++++++++++++ launch/simulator_launch/package.xml | 22 +++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 launch/simulator_launch/CMakeLists.txt create mode 100644 launch/simulator_launch/README.md create mode 100644 launch/simulator_launch/launch/simulator.launch.xml create mode 100644 launch/simulator_launch/package.xml diff --git a/launch/simulator_launch/CMakeLists.txt b/launch/simulator_launch/CMakeLists.txt new file mode 100644 index 0000000000000..bbabec7ab1e8d --- /dev/null +++ b/launch/simulator_launch/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.5) +project(simulator_launch) + +find_package(ament_cmake_auto REQUIRED) +ament_auto_find_build_dependencies() + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + +ament_auto_package(INSTALL_TO_SHARE + launch +) diff --git a/launch/simulator_launch/README.md b/launch/simulator_launch/README.md new file mode 100644 index 0000000000000..4864936a286de --- /dev/null +++ b/launch/simulator_launch/README.md @@ -0,0 +1,11 @@ +# simulator_launch + +## Package Dependencies + +Please see `` in `package.xml`. + +## Usage + +```xml + +``` diff --git a/launch/simulator_launch/launch/simulator.launch.xml b/launch/simulator_launch/launch/simulator.launch.xml new file mode 100644 index 0000000000000..507a7fd95206b --- /dev/null +++ b/launch/simulator_launch/launch/simulator.launch.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/launch/simulator_launch/package.xml b/launch/simulator_launch/package.xml new file mode 100644 index 0000000000000..9ef9700a31cdd --- /dev/null +++ b/launch/simulator_launch/package.xml @@ -0,0 +1,22 @@ + + + + simulator_launch + 0.1.0 + The simulator_launch package + + Keisuke Shima + Apache License 2.0 + + ament_cmake_auto + + dummy_perception_publisher + fault_injection + + ament_lint_auto + ament_lint_common + + + ament_cmake + + From 4f6dccac180ab274588d3eb747f7f83967ef9372 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Thu, 28 Oct 2021 20:12:54 +0900 Subject: [PATCH 2/8] Move simple_planning_simulator to simulator_launch (#462) * move simple_planning_simulator * add simulation arg to logging_simulator.launch * delete unused argument * add arguments for logging simulation * change default value * update README * add default value to simulator arg * restore vehicle_simulation arg --- launch/simulator_launch/README.md | 4 +++ .../launch/simulator.launch.xml | 25 ++++++++++++++++--- launch/simulator_launch/package.xml | 1 + .../simulator_launch.drawio.svg | 4 +++ 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 launch/simulator_launch/simulator_launch.drawio.svg diff --git a/launch/simulator_launch/README.md b/launch/simulator_launch/README.md index 4864936a286de..d52b6c16a6c78 100644 --- a/launch/simulator_launch/README.md +++ b/launch/simulator_launch/README.md @@ -1,5 +1,9 @@ # simulator_launch +## Structure + +![simulator_launch](./simulator_launch.drawio.svg) + ## Package Dependencies Please see `` in `package.xml`. diff --git a/launch/simulator_launch/launch/simulator.launch.xml b/launch/simulator_launch/launch/simulator.launch.xml index 507a7fd95206b..b89b46970b11d 100644 --- a/launch/simulator_launch/launch/simulator.launch.xml +++ b/launch/simulator_launch/launch/simulator.launch.xml @@ -1,8 +1,14 @@ - - - - + + + + + + + + + + @@ -17,4 +23,15 @@ + + + + + + + + + + + diff --git a/launch/simulator_launch/package.xml b/launch/simulator_launch/package.xml index 9ef9700a31cdd..324c411cd8d29 100644 --- a/launch/simulator_launch/package.xml +++ b/launch/simulator_launch/package.xml @@ -12,6 +12,7 @@ dummy_perception_publisher fault_injection + simple_planning_simulator ament_lint_auto ament_lint_common diff --git a/launch/simulator_launch/simulator_launch.drawio.svg b/launch/simulator_launch/simulator_launch.drawio.svg new file mode 100644 index 0000000000000..d86b068066ab5 --- /dev/null +++ b/launch/simulator_launch/simulator_launch.drawio.svg @@ -0,0 +1,4 @@ + + + +
simulator.launch.xml

package: simulator_launch
simulator.launch.xml...
fault_injection.launch.xml

package: fault_injection
fault_injection.launch.xm...
simple_planning_simulator.launch.xml

package: simple_planning_simulator
simple_planning_simulator.launch.xml...
True
True
$(var vehicle_simulation)
$(var vehicle_simulation)
launch name

package: package name
launch name...
ex:
ex:
node name

package: package name
node name...
$(var scenario_simulation)
$(var scenario_simulation)
False
False
other name

package: package name
other name...
True
True
$(var scenario_simulation)
$(var scenario_simulation)
False
False
dummy_perception_publisher.launch.xml

package: dummy_perception_publisher
dummy_perception_publisher.launch.xml...
Viewer does not support full SVG 1.1
\ No newline at end of file From e049080397a1026e3c45a1307ce49ed7f8aea6b7 Mon Sep 17 00:00:00 2001 From: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Date: Mon, 1 Nov 2021 12:49:44 +0900 Subject: [PATCH 3/8] Fix/revert initial engage state (#484) * Fix args Signed-off-by: Kenji Miyake * Add initial_engage_state to vehicle.launch.xml Signed-off-by: Kenji Miyake * Update vehicle.launch.xml --- launch/simulator_launch/launch/simulator.launch.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/launch/simulator_launch/launch/simulator.launch.xml b/launch/simulator_launch/launch/simulator.launch.xml index b89b46970b11d..0253d8d094e12 100644 --- a/launch/simulator_launch/launch/simulator.launch.xml +++ b/launch/simulator_launch/launch/simulator.launch.xml @@ -7,9 +7,10 @@ - + + From d5117b6d43c04ae89ca4d56a2bae359a055f3d9a Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Tue, 2 Nov 2021 19:37:45 +0900 Subject: [PATCH 4/8] Change formatter to black (#488) * Update pre-commit settings * Apply Black * Replace ament_lint_common with autoware_lint_common * Update build_depends.repos * Fix build_depends --- launch/simulator_launch/package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/simulator_launch/package.xml b/launch/simulator_launch/package.xml index 324c411cd8d29..03d415a7a8eac 100644 --- a/launch/simulator_launch/package.xml +++ b/launch/simulator_launch/package.xml @@ -15,7 +15,7 @@ simple_planning_simulator ament_lint_auto - ament_lint_common + autoware_lint_common ament_cmake From d4ef32f9ced32485998509ebcbfc87c823192481 Mon Sep 17 00:00:00 2001 From: tkimura4 Date: Mon, 15 Nov 2021 15:11:04 +0900 Subject: [PATCH 5/8] Auto/fix launch (#110) * fix namespace * remove dynamic_object_visualization * fix rviz --- launch/simulator_launch/launch/simulator.launch.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/simulator_launch/launch/simulator.launch.xml b/launch/simulator_launch/launch/simulator.launch.xml index 0253d8d094e12..82a9ec8d5df2f 100644 --- a/launch/simulator_launch/launch/simulator.launch.xml +++ b/launch/simulator_launch/launch/simulator.launch.xml @@ -28,7 +28,7 @@ - + From 800a57464399390b9193a77ad6d1d4b15a865412 Mon Sep 17 00:00:00 2001 From: "tomoya.kimura" Date: Mon, 13 Dec 2021 15:40:05 +0900 Subject: [PATCH 6/8] add default vehicle param file Signed-off-by: tomoya.kimura --- launch/simulator_launch/README.md | 7 +- .../launch/simulator.launch.xml | 4 +- .../simple_planning_simulator.launch.py | 124 ++++++++++++------ 3 files changed, 91 insertions(+), 44 deletions(-) diff --git a/launch/simulator_launch/README.md b/launch/simulator_launch/README.md index d52b6c16a6c78..1dbfa0967eb1d 100644 --- a/launch/simulator_launch/README.md +++ b/launch/simulator_launch/README.md @@ -11,5 +11,10 @@ Please see `` in `package.xml`. ## Usage ```xml - + + + + ``` + +The simultor model used in simple_plannings_simulator is loaded from "config/simulator_model.param.yaml" in the "`VEHICLE_MODEL`_description" package. \ No newline at end of file diff --git a/launch/simulator_launch/launch/simulator.launch.xml b/launch/simulator_launch/launch/simulator.launch.xml index 82a9ec8d5df2f..0bec3d13b6a35 100644 --- a/launch/simulator_launch/launch/simulator.launch.xml +++ b/launch/simulator_launch/launch/simulator.launch.xml @@ -1,4 +1,5 @@ + @@ -29,7 +30,8 @@ - + + diff --git a/simulator/simple_planning_simulator/launch/simple_planning_simulator.launch.py b/simulator/simple_planning_simulator/launch/simple_planning_simulator.launch.py index 3c46303bc6bd7..18593745a58da 100644 --- a/simulator/simple_planning_simulator/launch/simple_planning_simulator.launch.py +++ b/simulator/simple_planning_simulator/launch/simple_planning_simulator.launch.py @@ -12,53 +12,49 @@ # See the License for the specific language governing permissions and # limitations under the License. -import ament_index_python -import launch -import launch_ros.actions +import os +from ament_index_python.packages import get_package_share_directory +import launch from launch.actions import DeclareLaunchArgument +from launch.actions import GroupAction +from launch.actions import IncludeLaunchDescription +from launch.actions import OpaqueFunction +from launch.actions import SetLaunchConfiguration +from launch.conditions import IfCondition +from launch.conditions import UnlessCondition from launch.substitutions import LaunchConfiguration -from ament_index_python import get_package_share_directory - -import os - - -def generate_launch_description(): +from launch_ros.actions import ComposableNodeContainer +from launch_ros.actions import LoadComposableNodes +from launch_ros.actions import Node +from launch_ros.descriptions import ComposableNode +from launch_ros.substitutions import FindPackageShare +import yaml - default_vehicle_characteristics_param = os.path.join( - get_package_share_directory('simple_planning_simulator'), - 'param/vehicle_characteristics.param.yaml') +def launch_setup(context, *args, **kwargs): + # vehicle information param path + vehicle_info_param_path = LaunchConfiguration("vehicle_info_param_file").perform(context) + with open(vehicle_info_param_path, "r") as f: + vehicle_info_param = yaml.safe_load(f)["/**"]["ros__parameters"] - vehicle_characteristics_param = DeclareLaunchArgument( - 'vehicle_characteristics_param_file', - default_value=default_vehicle_characteristics_param, - description='Path to config file for vehicle characteristics' - ) - - default_vehicle_info_param = os.path.join( - get_package_share_directory('vehicle_info_util'), - 'config/vehicle_info.param.yaml') + vehicle_characteristics_param_path = LaunchConfiguration("vehicle_characteristics_param_file").perform(context) + with open(vehicle_characteristics_param_path, "r") as f: + vehicle_characteristics_param = yaml.safe_load(f)["/**"]["ros__parameters"] - vehicle_info_param = DeclareLaunchArgument( - 'vehicle_info_param_file', - default_value=default_vehicle_info_param, - description='Path to config file for vehicle information' - ) + simultor_model_param_path = LaunchConfiguration("simulator_model_param_file").perform(context) + with open(simultor_model_param_path, "r") as f: + simulator_model_param = yaml.safe_load(f)["/**"]["ros__parameters"] - simple_planning_simulator_node = launch_ros.actions.Node( + simple_planning_simulator_node = Node( package='simple_planning_simulator', executable='simple_planning_simulator_exe', name='simple_planning_simulator', namespace='simulation', output='screen', parameters=[ - "{}/param/simple_planning_simulator_default.param.yaml".format( - ament_index_python.get_package_share_directory( - "simple_planning_simulator" - ) - ), - LaunchConfiguration('vehicle_characteristics_param_file'), - LaunchConfiguration('vehicle_info_param_file') + vehicle_info_param, + vehicle_characteristics_param, + simulator_model_param, ], remappings=[ ('input/ackermann_control_command', '/control/command/control_cmd'), @@ -77,17 +73,61 @@ def generate_launch_description(): ] ) - map_to_odom_tf_publisher = launch_ros.actions.Node( + map_to_odom_tf_publisher = Node( package='tf2_ros', executable='static_transform_publisher', name='static_map_to_odom_tf_publisher', output='screen', arguments=['0.0', '0.0', '0.0', '0', '0', '0', 'map', 'odom']) - ld = launch.LaunchDescription([ - vehicle_characteristics_param, - vehicle_info_param, - simple_planning_simulator_node, - map_to_odom_tf_publisher - ]) - return ld + group = GroupAction( + [ + simple_planning_simulator_node, + map_to_odom_tf_publisher + ] + ) + + return [group] + + +def generate_launch_description(): + launch_arguments = [] + + def add_launch_arg(name: str, default_value=None, description=None): + launch_arguments.append( + DeclareLaunchArgument(name, default_value=default_value, description=description) + ) + + add_launch_arg( + "vehicle_info_param_file", + [ + FindPackageShare("vehicle_info_util"), + "/config/vehicle_info.param.yaml", + ], + "path to the parameter file of vehicle information", + ) + + add_launch_arg( + "vehicle_characteristics_param_file", + [ + FindPackageShare("simple_planning_simulator"), + "/param/vehicle_characteristics.param.yaml", + ], + "path to config file for vehicle characteristics", + ) + + add_launch_arg( + "simulator_model_param_file", + [ + FindPackageShare("simple_planning_simulator"), + "/param/simple_planning_simulator_default.param.yaml", + ], + "path to config file for simulator_model", + ) + + + + return launch.LaunchDescription( + launch_arguments + + [OpaqueFunction(function=launch_setup)] + ) From e778eccc75570dc785dc01f0d3be447b40bfc029 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Dec 2021 06:41:20 +0000 Subject: [PATCH 7/8] ci(pre-commit): autofix --- launch/simulator_launch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/simulator_launch/README.md b/launch/simulator_launch/README.md index 1dbfa0967eb1d..097176b57cc98 100644 --- a/launch/simulator_launch/README.md +++ b/launch/simulator_launch/README.md @@ -17,4 +17,4 @@ Please see `` in `package.xml`. ``` -The simultor model used in simple_plannings_simulator is loaded from "config/simulator_model.param.yaml" in the "`VEHICLE_MODEL`_description" package. \ No newline at end of file +The simultor model used in simple_plannings_simulator is loaded from "config/simulator_model.param.yaml" in the "`VEHICLE_MODEL`\_description" package. From 754c19b95abafe3eb96e5aafbdb42021857cbca1 Mon Sep 17 00:00:00 2001 From: "tomoya.kimura" Date: Mon, 13 Dec 2021 18:37:39 +0900 Subject: [PATCH 8/8] fix typo Signed-off-by: tomoya.kimura --- launch/simulator_launch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/simulator_launch/README.md b/launch/simulator_launch/README.md index 1dbfa0967eb1d..05106991d4dea 100644 --- a/launch/simulator_launch/README.md +++ b/launch/simulator_launch/README.md @@ -17,4 +17,4 @@ Please see `` in `package.xml`. ``` -The simultor model used in simple_plannings_simulator is loaded from "config/simulator_model.param.yaml" in the "`VEHICLE_MODEL`_description" package. \ No newline at end of file +The simulator model used in simple_planning_simulator is loaded from "config/simulator_model.param.yaml" in the "`VEHICLE_MODEL`_description" package. \ No newline at end of file