diff --git a/CustomRobots/drone_assets/worlds/labyrinth_escape_harmonic.world b/CustomRobots/drone_assets/worlds/labyrinth_escape_harmonic.world new file mode 100644 index 000000000..825759105 --- /dev/null +++ b/CustomRobots/drone_assets/worlds/labyrinth_escape_harmonic.world @@ -0,0 +1,122 @@ + + + + + 0.004 + 1.0 + + + + + + + + + ogre2 + + + + + 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 + + + + + -4.70385 10.895 16.2659 -0 0.921795 -1.12701 + + + + + + model://arrow + arrow_1 + -18 -8.5 0.1 0 0 0 + + + model://arrow + arrow_2 + -5.5 -8.5 0.1 0 0 0 + + + model://arrow + arrow_3 + 7 -8.5 0.1 0 0 1.57 + + + model://arrow + arrow_4 + 7 3 0.1 0 0 1.57 + + + model://arrow + arrow_5 + 7 14.5 0.1 0 0 3.14 + + + model://arrow + arrow_6 + 2.5 14.5 0.1 0 0 3.14 + + + model://arrow + arrow_7 + 2.5 7.5 0.1 0 0 3.14 + + + model://arrow + arrow_8 + -3 7.5 0.1 0 0 1.57 + + + model://arrow + arrow_9 + -3 20.5 0.1 0 0 3.14 + + + model://arrow + arrow_10 + -13 20.5 0.1 0 0 3.14 + + + + model://simple_labyrinth_green + + + + + model://grass_plane + + + + + logo + model://logoJdeRobot + -26.0 0.0 0.0 0.0 0.0 0.0 + + + + model://quadrotor_dual_cam + drone0 + -18 -8.5 0.3 0 0 0 + + + + \ No newline at end of file diff --git a/Launchers/labyrinth_escape.launch.py b/Launchers/labyrinth_escape.launch.py new file mode 100644 index 000000000..690cd2ca4 --- /dev/null +++ b/Launchers/labyrinth_escape.launch.py @@ -0,0 +1,81 @@ +"""Entry point for the Labyrinth Escape exercise.""" + +import os + +from ament_index_python.packages import get_package_share_directory + +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription +from launch.conditions import IfCondition +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node + + +def generate_launch_description(): + """Generate the launch description for labyrinth escape simulation.""" + custom_robots_share = get_package_share_directory("custom_robots") + # same bridges file as rescue_people exercise + bridges_path = os.path.join(custom_robots_share, "bridges", "rescue_people.yaml") + world_path = os.path.join( + custom_robots_share, "worlds", "labyrinth_escape_harmonic.world" + ) + + # YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE # + declare_use_simulator_cmd = DeclareLaunchArgument( + name="use_simulator", + default_value="True", + description="Whether to start the simulator", + ) + + # Start Gazebo server + gzsim = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + [ + os.path.join(get_package_share_directory("jderobot_drones"), "launch"), + "/gz_sim.launch.py", + ] + ), + condition=IfCondition(LaunchConfiguration("use_simulator")), + launch_arguments={ + "namespace": "drone0", + "bridges_file": bridges_path, + "world_file": world_path, + }.items(), + ) + + as2 = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + [ + os.path.join(get_package_share_directory("jderobot_drones"), "launch"), + "/as2_default_gazebo_sim.launch.py", + ] + ), + launch_arguments={ + "namespace": "drone0", + }.items(), + ) + + start_gazebo_frontal_image_bridge_cmd = Node( + package="ros_gz_image", + executable="image_bridge", + arguments=["/drone0/frontal_cam/image_raw"], + output="screen", + ) + + start_gazebo_ventral_image_bridge_cmd = Node( + package="ros_gz_image", + executable="image_bridge", + arguments=["/drone0/ventral_cam/image_raw"], + output="screen", + ) + + # Create the launch description and populate + ld = LaunchDescription() + ld.add_action(declare_use_simulator_cmd) + ld.add_action(gzsim) + ld.add_action(as2) + ld.add_action(start_gazebo_frontal_image_bridge_cmd) + ld.add_action(start_gazebo_ventral_image_bridge_cmd) + + return ld