From e2c8bce31bb081407df7ade1d1f9a18d7750baa3 Mon Sep 17 00:00:00 2001 From: Franco Cipollone Date: Mon, 22 Apr 2024 17:27:50 -0300 Subject: [PATCH] Allows multi world seleciton. Signed-off-by: Franco Cipollone --- README.md | 2 + andino_gz/launch/andino_gz.launch.py | 11 +- andino_gz/worlds/empty.sdf | 210 +++++++++++++++++++++++++++ 3 files changed, 217 insertions(+), 6 deletions(-) create mode 100644 andino_gz/worlds/empty.sdf diff --git a/README.md b/README.md index c1ef91e..95f4464 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ Once the package is built and sourced, you can start a simulation. ros2 launch andino_gz andino_gz.launch.py ``` +_Note: You can use `--world_name` flag to indicate other [world](andino_gz/worlds/) to use. (For example: `depot.sdf`(default), `empty.sdf`)_ + If you'd like to work from ROS you can launch the ros bridge via: ```sh diff --git a/andino_gz/launch/andino_gz.launch.py b/andino_gz/launch/andino_gz.launch.py index dc2a564..74220e8 100644 --- a/andino_gz/launch/andino_gz.launch.py +++ b/andino_gz/launch/andino_gz.launch.py @@ -6,7 +6,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.actions import Node import xacro @@ -16,12 +16,10 @@ def generate_launch_description(): rviz_arg = DeclareLaunchArgument('rviz', default_value='false', description='Start RViz.') jsp_gui_arg = DeclareLaunchArgument('jsp_gui', default_value='false', description='Run joint state publisher gui node.') + world_name_arg = DeclareLaunchArgument('world_name', default_value='depot.sdf', description='Name of the world to load.') - world_name = 'depot.sdf' - world_path = os.path.join(pkg_andino_gz, 'worlds', world_name) - - # Uncomment the following line to use the empty world - # world_path = '-r empty.sdf' + world_name = LaunchConfiguration('world_name') + world_path = PathJoinSubstitution([pkg_andino_gz, 'worlds', world_name]) # Gazebo Sim gazebo = IncludeLaunchDescription( @@ -69,6 +67,7 @@ def generate_launch_description(): # Arguments and Nodes jsp_gui_arg, rviz_arg, + world_name_arg, gazebo, spawn_robot_and_rsp, jsp_gui, diff --git a/andino_gz/worlds/empty.sdf b/andino_gz/worlds/empty.sdf new file mode 100644 index 0000000..c5c3118 --- /dev/null +++ b/andino_gz/worlds/empty.sdf @@ -0,0 +1,210 @@ + + + + + 0.01 + 1 + + + + + + ogre2 + + + + 1 1 1 1 + 0.8 0.8 0.8 1.0 + 1 + 1 + + + + + + + + 3D View + false + docked + + + ogre2 + scene + 0.4 0.4 0.4 + 0.8 0.8 0.8 + -0.7 0.7 0.7 0 0.3 -0.3 + + + + + + World control + false + false + 72 + 121 + 1 + + floating + + + + + + + true + true + true + + + + + + + World stats + false + false + 110 + 290 + 1 + + floating + + + + + + + true + true + true + true + + + + + + + false + 0 + 0 + 250 + 50 + floating + false + #666666 + + + + + + + false + 250 + 0 + 150 + 50 + floating + false + #666666 + + + + + + + false + 0 + 50 + 250 + 50 + floating + false + #777777 + + + + + + + false + 250 + 50 + 50 + 50 + floating + false + #777777 + + + + + + + docked_collapsed + + + + + + + docked_collapsed + + + + + + + docked_collapsed + + /model/andino/cmd_vel + + + + + + docked + + + + + + + true + 0 0 10 0 0 0 + 0.8 0.8 0.8 1 + 0.2 0.2 0.2 1 + + 1000 + 0.9 + 0.01 + 0.001 + + -0.5 0.1 -0.9 + + + + 1 + + + + + 0 0 1 + 10 10 + + + + + + + + + + + + 0 0 0 0 0 0 + + + +