Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions CustomRobots/quadrotor/launch/quadrotor.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
84 changes: 29 additions & 55 deletions Launchers/rescue_people.launch.py
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions Worlds/rescue_people_harmonic.world
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,5 @@
<uri>model://ocean</uri>
<pose>0 0 -0.02 0 0 -1.57</pose>
</include>

<include>
<uri>model://quadrotor_dual_cam</uri>
<name>drone0</name>
<pose>0 0 1.45 0 0 0</pose>
</include>

</world>
</sdf>
2 changes: 1 addition & 1 deletion database/universes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading