diff --git a/README.md b/README.md index 48bc12d..ab8e593 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,20 @@ source install/setup.bash ``` ### 2. Spawning the Simulation (Gazebo) -To start the Gazebo Fortress simulator, spawn the integrated robot, and spin up joint controllers: -```bash -ros2 launch panther_piper_description simulation.launch.py -``` +You can choose which environment map to spawn using the `world` argument: + +- **Map 1: Office & 79m² Lab Layout (Default)**: + ```bash + ros2 launch panther_piper_description simulation.launch.py world:=office_lab.sdf + ``` +- **Map 2: Outdoor Forest Map (Trees, Boulders & Off-Road Terrain)**: + ```bash + ros2 launch panther_piper_description simulation.launch.py world:=forest.sdf + ``` +- **Empty World**: + ```bash + ros2 launch panther_piper_description simulation.launch.py world:=empty.sdf + ``` ### 3. Release the E-Stop (Required to Move Panther UGV Base) By default, the Panther base simulation spawns with the E-Stop triggered (`e_stop: true`). To release it and enable wheel drive motors: diff --git a/panther_piper_description/CMakeLists.txt b/panther_piper_description/CMakeLists.txt index cf5f4a5..07e548f 100644 --- a/panther_piper_description/CMakeLists.txt +++ b/panther_piper_description/CMakeLists.txt @@ -8,6 +8,7 @@ install(DIRECTORY launch urdf rviz + worlds DESTINATION share/${PROJECT_NAME} ) diff --git a/panther_piper_description/launch/simulation.launch.py b/panther_piper_description/launch/simulation.launch.py index 2d5d7fa..2f24ae6 100644 --- a/panther_piper_description/launch/simulation.launch.py +++ b/panther_piper_description/launch/simulation.launch.py @@ -3,7 +3,7 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, SetEnvironmentVariable from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import Command, LaunchConfiguration +from launch.substitutions import Command, LaunchConfiguration, PathJoinSubstitution from launch_ros.actions import Node def generate_launch_description(): @@ -12,6 +12,12 @@ def generate_launch_description(): xacro_file = os.path.join(pkg_path, 'urdf', 'panther_piper.urdf.xacro') controller_config = os.path.join(pkg_path, 'config', 'controllers.yaml') + declare_world_cmd = DeclareLaunchArgument( + 'world', + default_value='office_lab.sdf', + description='World file to load: office_lab.sdf, forest.sdf, or empty.sdf' + ) + # Set Gazebo resource path to find meshes of all packages ament_prefix_path = os.environ.get('AMENT_PREFIX_PATH', '') resource_paths = [] @@ -52,12 +58,19 @@ def generate_launch_description(): }] ) - # Launch Gazebo + # Construct world path + world_path = PathJoinSubstitution([ + pkg_path, + 'worlds', + LaunchConfiguration('world') + ]) + + # Launch Gazebo with selected world gz_sim_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py') ), - launch_arguments={'gz_args': '-r empty.sdf'}.items(), + launch_arguments={'gz_args': Command(['echo -r ', world_path])}.items(), ) # Spawn Robot @@ -65,7 +78,7 @@ def generate_launch_description(): package='ros_gz_sim', executable='create', name='spawn_robot', - arguments=['-name', 'panther_piper', '-topic', 'robot_description'], + arguments=['-name', 'panther_piper', '-topic', 'robot_description', '-z', '0.1'], output='screen', parameters=[{'use_sim_time': True}] ) @@ -121,6 +134,7 @@ def generate_launch_description(): ) return LaunchDescription([ + declare_world_cmd, set_gz_resource_path, set_ign_resource_path, robot_state_publisher_node, diff --git a/panther_piper_description/worlds/forest.sdf b/panther_piper_description/worlds/forest.sdf new file mode 100644 index 0000000..ce2e343 --- /dev/null +++ b/panther_piper_description/worlds/forest.sdf @@ -0,0 +1,216 @@ + + + + + + 0.001 + 1.0 + + + + + + + + + + true + 0 0 20 0 0 0 + 1.0 0.98 0.9 1 + 0.4 0.4 0.4 1 + + 1000 + 0.9 + 0.01 + 0.001 + + -0.5 0.3 -0.8 + + + + + true + + + + + 0 0 1 + 50 50 + + + + + + + 0 0 1 + 50 50 + + + + 0.2 0.5 0.2 1 + 0.2 0.5 0.2 1 + 0.05 0.05 0.05 1 + + + + + + + + true + 0 0 0.001 0 0 0 + + + + + + + 0.45 0.35 0.2 1 + 0.45 0.35 0.2 1 + + + + + + + + + + + + + + true + -4.0 5.0 0 0 0 0 + + + 0.35 0.2 0.1 10.35 0.2 0.1 1 + + + 0.1 0.4 0.15 10.1 0.4 0.15 1 + + + + + + true + 5.0 6.0 0 0 0 0 + + + 0.35 0.2 0.1 10.35 0.2 0.1 1 + + + 0.12 0.45 0.12 10.12 0.45 0.12 1 + + + + + + true + -6.5 -3.0 0 0 0 0 + + + 0.35 0.2 0.1 10.35 0.2 0.1 1 + + + 0.08 0.38 0.1 10.08 0.38 0.1 1 + + + + + + true + 6.0 -4.5 0 0 0 0 + + + 0.35 0.2 0.1 10.35 0.2 0.1 1 + + + 0.15 0.48 0.15 10.15 0.48 0.15 1 + + + + + + true + -3.5 12.0 0 0 0 0 + 0.35 0.2 0.1 1 + 0.1 0.42 0.12 1 + + + + + true + 4.5 13.5 0 0 0 0 + 0.35 0.2 0.1 1 + 0.12 0.45 0.12 1 + + + + + true + -8.0 -10.0 0 0 0 0 + 0.35 0.2 0.1 1 + 0.08 0.35 0.1 1 + + + + + true + 8.5 -11.0 0 0 0 0 + 0.35 0.2 0.1 1 + 0.14 0.46 0.14 1 + + + + + true + -1.5 8.0 0.2 0 1.57 0.4 + + + + + 0.3 0.18 0.08 10.3 0.18 0.08 1 + + + + + + + true + 2.5 3.0 0.3 0.2 0.4 0.8 + + + + + 0.4 0.4 0.42 10.4 0.4 0.42 1 + + + + + + true + -2.8 -4.0 0.35 -0.3 0.1 1.2 + + + + + 0.38 0.38 0.4 10.38 0.38 0.4 1 + + + + + + true + 3.2 -7.0 0.25 0.1 -0.2 0.3 + + + + + 0.42 0.42 0.44 10.42 0.42 0.44 1 + + + + + + diff --git a/panther_piper_description/worlds/office_lab.sdf b/panther_piper_description/worlds/office_lab.sdf new file mode 100644 index 0000000..80dabeb --- /dev/null +++ b/panther_piper_description/worlds/office_lab.sdf @@ -0,0 +1,333 @@ + + + + + + 0.001 + 1.0 + + + + + + + + + + true + 0 0 12 0 0 0 + 0.9 0.9 0.9 1 + 0.3 0.3 0.3 1 + + 1000 + 0.9 + 0.01 + 0.001 + + -0.4 0.2 -0.9 + + + + + true + + + + + 0 0 1 + 40 30 + + + + + + + 0 0 1 + 40 30 + + + + 0.75 0.75 0.75 1 + 0.75 0.75 0.75 1 + 0.1 0.1 0.1 1 + + + + + + + + + + true + + + + + + 0 4.0 1.4 0 0 0 + + + + 0.85 0.85 0.82 10.85 0.85 0.82 1 + + + + + + -11.0 0.0 1.4 0 0 0 + + + + 0.85 0.85 0.82 10.85 0.85 0.82 1 + + + + + + 11.0 0.0 1.4 0 0 0 + + + + 0.85 0.85 0.82 10.85 0.85 0.82 1 + + + + + + -6.0 -4.0 1.4 0 0 0 + + + + 0.85 0.85 0.82 10.85 0.85 0.82 1 + + + + 5.0 -4.0 1.4 0 0 0 + + + + 0.85 0.85 0.82 10.85 0.85 0.82 1 + + + + + + + + + + + 0.0 2.6 1.4 0 0 0 + + + + 0.7 0.7 0.75 10.7 0.7 0.75 1 + + + + 0.0 -1.1 1.4 0 0 0 + + + + 0.7 0.7 0.75 10.7 0.7 0.75 1 + + + + + + + -9.2 -2.2 1.4 0 0 0 + + + + 0.8 0.8 0.8 10.8 0.8 0.8 1 + + + + + + -5.5 -2.2 1.4 0 0 0 + + + + 0.8 0.8 0.8 10.8 0.8 0.8 1 + + + + + + -1.8 -2.2 1.4 0 0 0 + + + + 0.8 0.8 0.8 10.8 0.8 0.8 1 + + + + + + 5.5 -2.2 1.4 0 0 0 + + + + 0.8 0.8 0.8 10.8 0.8 0.8 1 + + + + + + + -7.5 0.9 1.4 0 0 0 + + + + 0.8 0.8 0.8 10.8 0.8 0.8 1 + + + + + + -3.8 0.9 1.4 0 0 0 + + + + 0.8 0.8 0.8 10.8 0.8 0.8 1 + + + + + + + + + + -9.2 -3.1 1.4 0 0 0 + + + + 0.75 0.75 0.7 10.75 0.75 0.7 1 + + + + + + 1.0 -3.1 1.4 0 0 0 + + + + 0.75 0.75 0.7 10.75 0.75 0.7 1 + + + + + + 7.5 -3.1 1.4 0 0 0 + + + + 0.75 0.75 0.7 10.75 0.75 0.7 1 + + + + 9.2 -2.2 1.4 0 0 0 + + + + 0.75 0.75 0.7 10.75 0.75 0.7 1 + + + + + + + + + + + + true + 5.0 1.0 0.4 0 0 0 + + + + + + 0.2 0.4 0.6 1 + 0.2 0.4 0.6 1 + + + + + + + + true + 8.5 2.5 0.4 0 0 0 + + + + + + 0.3 0.3 0.3 1 + 0.3 0.3 0.3 1 + + + + + + + + + 5.0 1.0 0.85 0 0 0 + + 0.1 + + + + 0.9 0.1 0.1 10.9 0.1 0.1 1 + + + + + + + 5.3 0.9 0.85 0 0 0 + + 0.1 + + + + 0.1 0.3 0.9 10.1 0.3 0.9 1 + + + + + + + true + -9.2 1.5 0.38 0 0 0 + + + + + 0.6 0.4 0.2 10.6 0.4 0.2 1 + + + + + + + true + -5.5 1.5 0.38 0 0 0 + + + + + 0.6 0.4 0.2 10.6 0.4 0.2 1 + + + + + +