diff --git a/CustomRobots/quadrotor/launch/quadrotor.launch.py b/CustomRobots/quadrotor/launch/quadrotor.launch.py index 2f555d312..85a5ede06 100644 --- a/CustomRobots/quadrotor/launch/quadrotor.launch.py +++ b/CustomRobots/quadrotor/launch/quadrotor.launch.py @@ -37,25 +37,25 @@ def launch_setup(context): # ========================= # ROBOT DESCRIPTION (URDF) # ========================= - # xacro_file = os.path.join( - # package_dir, - # "models", - # "quadrotor", - # "quadrotor.urdf.xacro", - # ) - - # robot_description_content = xacro.process_file( - # xacro_file, - # mappings={ - # "camera": "true" if sensor == "camera" else "false", - # "namespace": namespace, - # }, - # ).toxml() + xacro_file = os.path.join( + package_dir, + "models", + "quadrotor", + "quadrotor.urdf.xacro", + ) + + robot_description_content = xacro.process_file( + xacro_file, + mappings={ + "camera": "true" if sensor == "camera" else "false", + "namespace": namespace, + }, + ).toxml() ## Temporary SDF load to fix bumpers - sdf_file = os.path.join(package_dir, "models", "quadrotor", "quadrotor.sdf") - with open(sdf_file, "r") as infp: - robot_description_content = infp.read() + # sdf_file = os.path.join(package_dir, "models", "quadrotor", "quadrotor.sdf") + # with open(sdf_file, "r") as infp: + # robot_description_content = infp.read() robot_description = {"robot_description": robot_description_content} diff --git a/Launchers/rescue_people.launch.py b/Launchers/rescue_people.launch.py index ff1dbe361..643fc1aec 100755 --- a/Launchers/rescue_people.launch.py +++ b/Launchers/rescue_people.launch.py @@ -1,84 +1,58 @@ -""" -rescue_people.launch.py - -Entry point for the Rescue People 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.actions import ( + DeclareLaunchArgument, + IncludeLaunchDescription, + SetEnvironmentVariable, + AppendEnvironmentVariable, +) from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration, Command +from launch_ros.actions import Node from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node +from launch_ros.parameter_descriptions import ParameterValue def generate_launch_description(): - custom_robots_share = get_package_share_directory("custom_robots") - bridges_path = os.path.join(custom_robots_share, "bridges", "rescue_people.yaml") + package_dir = get_package_share_directory("custom_robots") + ros_gz_sim = get_package_share_directory("ros_gz_sim") + + gazebo_models_path = os.path.join(package_dir, "models") world_file_name = "rescue_people_harmonic.world" worlds_dir = "/opt/jderobot/Worlds" world_path = os.path.join(worlds_dir, world_file_name) - ########### 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( + gazebo_server = IncludeLaunchDescription( PythonLaunchDescriptionSource( - [ - os.path.join(get_package_share_directory("jderobot_drones"), "launch"), - "/as2_default_gazebo_sim.launch.py", - ] + os.path.join(ros_gz_sim, "launch", "gz_sim.launch.py") ), launch_arguments={ - "namespace": "drone0", + "gz_args": ["-s -v4 ", world_path], + "on_exit_shutdown": "true", }.items(), ) - start_gazebo_frontal_image_bridge_cmd = Node( - package="ros_gz_image", - executable="image_bridge", - arguments=["/drone0/frontal_cam/image_raw"], + world_entity_cmd = Node( + package="ros_gz_sim", + executable="create", + arguments=["-name", "world", "-file", world_path], output="screen", ) - start_gazebo_ventral_image_bridge_cmd = Node( - package="ros_gz_image", - executable="image_bridge", - arguments=["/drone0/ventral_cam/image_raw"], - output="screen", + ld = LaunchDescription() + + ld.add_action(SetEnvironmentVariable("GZ_SIM_RESOURCE_PATH", gazebo_models_path)) + set_env_vars_resources = AppendEnvironmentVariable( + "GZ_SIM_RESOURCE_PATH", os.path.join(package_dir, "models") ) + ld.add_action(set_env_vars_resources) - # 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) + ld.add_action(gazebo_server) + ld.add_action(world_entity_cmd) return ld diff --git a/Worlds/rescue_people_harmonic.world b/Worlds/rescue_people_harmonic.world index d91671930..17a992075 100644 --- a/Worlds/rescue_people_harmonic.world +++ b/Worlds/rescue_people_harmonic.world @@ -71,12 +71,5 @@ model://ocean 0 0 -0.02 0 0 -1.57 - - - model://quadrotor_dual_cam - drone0 - 0 0 1.45 0 0 0 - - \ No newline at end of file diff --git a/database/universes.sql b/database/universes.sql index a4aaab627..3070ab5cc 100644 --- a/database/universes.sql +++ b/database/universes.sql @@ -158,7 +158,7 @@ COPY public.universes (id, name, world_id, robot_id) FROM stdin; 28 Restaurant 21 0 29 Vacuums House Markers 25 17 30 Small Laser Mapping Warehouse 33 21 -31 Rescue People Harmonic 31 0 +31 Rescue People Harmonic 31 11 32 Follow Road Harmonic 32 0 33 Laser Mapping Warehouse Low Noise 12 21 34 Pick And Place World 34 0