Skip to content

Commit 1b1c090

Browse files
authored
Merge pull request #572 from Arcane-01/labyrinth_escape
Labyrinth escape migration to gazebo harmonic
2 parents 2edfb86 + 9f20dd6 commit 1b1c090

File tree

2 files changed

+203
-0
lines changed

2 files changed

+203
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?xml version="1.0"?>
2+
<sdf version="1.8">
3+
<world name="empty">
4+
<physics name="4ms" type="ignored">
5+
<max_step_size>0.004</max_step_size>
6+
<real_time_factor>1.0</real_time_factor>
7+
</physics>
8+
<plugin
9+
filename="gz-sim-physics-system"
10+
name="gz::sim::systems::Physics">
11+
</plugin>
12+
<plugin
13+
filename="gz-sim-user-commands-system"
14+
name="gz::sim::systems::UserCommands">
15+
</plugin>
16+
<plugin
17+
filename="gz-sim-scene-broadcaster-system"
18+
name="gz::sim::systems::SceneBroadcaster">
19+
</plugin>
20+
<plugin
21+
filename="gz-sim-sensors-system"
22+
name="gz::sim::systems::Sensors">
23+
<render_engine>ogre2</render_engine>
24+
</plugin>
25+
26+
<!--light-->
27+
<light type="directional" name="sun">
28+
<cast_shadows>true</cast_shadows>
29+
<pose>0 0 10 0 0 0</pose>
30+
<diffuse>0.8 0.8 0.8 1</diffuse>
31+
<specular>0.2 0.2 0.2 1</specular>
32+
<attenuation>
33+
<range>1000</range>
34+
<constant>0.9</constant>
35+
<linear>0.01</linear>
36+
<quadratic>0.001</quadratic>
37+
</attenuation>
38+
<direction>-0.5 0.1 -0.9</direction>
39+
</light>
40+
41+
<gui>
42+
<camera name="user_camera">
43+
<pose>-4.70385 10.895 16.2659 -0 0.921795 -1.12701</pose>
44+
</camera>
45+
</gui>
46+
47+
<!-- Arrows -->
48+
<include>
49+
<uri>model://arrow</uri>
50+
<name>arrow_1</name>
51+
<pose>-18 -8.5 0.1 0 0 0</pose>
52+
</include>
53+
<include>
54+
<uri>model://arrow</uri>
55+
<name>arrow_2</name>
56+
<pose>-5.5 -8.5 0.1 0 0 0</pose>
57+
</include>
58+
<include>
59+
<uri>model://arrow</uri>
60+
<name>arrow_3</name>
61+
<pose>7 -8.5 0.1 0 0 1.57</pose>
62+
</include>
63+
<include>
64+
<uri>model://arrow</uri>
65+
<name>arrow_4</name>
66+
<pose>7 3 0.1 0 0 1.57</pose>
67+
</include>
68+
<include>
69+
<uri>model://arrow</uri>
70+
<name>arrow_5</name>
71+
<pose>7 14.5 0.1 0 0 3.14</pose>
72+
</include>
73+
<include>
74+
<uri>model://arrow</uri>
75+
<name>arrow_6</name>
76+
<pose>2.5 14.5 0.1 0 0 3.14</pose>
77+
</include>
78+
<include>
79+
<uri>model://arrow</uri>
80+
<name>arrow_7</name>
81+
<pose>2.5 7.5 0.1 0 0 3.14</pose>
82+
</include>
83+
<include>
84+
<uri>model://arrow</uri>
85+
<name>arrow_8</name>
86+
<pose>-3 7.5 0.1 0 0 1.57</pose>
87+
</include>
88+
<include>
89+
<uri>model://arrow</uri>
90+
<name>arrow_9</name>
91+
<pose>-3 20.5 0.1 0 0 3.14</pose>
92+
</include>
93+
<include>
94+
<uri>model://arrow</uri>
95+
<name>arrow_10</name>
96+
<pose>-13 20.5 0.1 0 0 3.14</pose>
97+
</include>
98+
99+
<include>
100+
<uri>model://simple_labyrinth_green</uri>
101+
</include>
102+
103+
<!-- Grass plane -->
104+
<include>
105+
<uri>model://grass_plane</uri>
106+
</include>
107+
108+
<!-- JdeRobot Logo -->
109+
<include>
110+
<name>logo</name>
111+
<uri>model://logoJdeRobot</uri>
112+
<pose>-26.0 0.0 0.0 0.0 0.0 0.0</pose>
113+
</include>
114+
115+
<include>
116+
<uri>model://quadrotor_dual_cam</uri>
117+
<name>drone0</name>
118+
<pose>-18 -8.5 0.3 0 0 0</pose>
119+
</include>
120+
121+
</world>
122+
</sdf>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"""Entry point for the Labyrinth Escape exercise."""
2+
3+
import os
4+
5+
from ament_index_python.packages import get_package_share_directory
6+
7+
from launch import LaunchDescription
8+
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
9+
from launch.conditions import IfCondition
10+
from launch.launch_description_sources import PythonLaunchDescriptionSource
11+
from launch.substitutions import LaunchConfiguration
12+
from launch_ros.actions import Node
13+
14+
15+
def generate_launch_description():
16+
"""Generate the launch description for labyrinth escape simulation."""
17+
custom_robots_share = get_package_share_directory("custom_robots")
18+
# same bridges file as rescue_people exercise
19+
bridges_path = os.path.join(custom_robots_share, "bridges", "rescue_people.yaml")
20+
world_path = os.path.join(
21+
custom_robots_share, "worlds", "labyrinth_escape_harmonic.world"
22+
)
23+
24+
# YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE #
25+
declare_use_simulator_cmd = DeclareLaunchArgument(
26+
name="use_simulator",
27+
default_value="True",
28+
description="Whether to start the simulator",
29+
)
30+
31+
# Start Gazebo server
32+
gzsim = IncludeLaunchDescription(
33+
PythonLaunchDescriptionSource(
34+
[
35+
os.path.join(get_package_share_directory("jderobot_drones"), "launch"),
36+
"/gz_sim.launch.py",
37+
]
38+
),
39+
condition=IfCondition(LaunchConfiguration("use_simulator")),
40+
launch_arguments={
41+
"namespace": "drone0",
42+
"bridges_file": bridges_path,
43+
"world_file": world_path,
44+
}.items(),
45+
)
46+
47+
as2 = IncludeLaunchDescription(
48+
PythonLaunchDescriptionSource(
49+
[
50+
os.path.join(get_package_share_directory("jderobot_drones"), "launch"),
51+
"/as2_default_gazebo_sim.launch.py",
52+
]
53+
),
54+
launch_arguments={
55+
"namespace": "drone0",
56+
}.items(),
57+
)
58+
59+
start_gazebo_frontal_image_bridge_cmd = Node(
60+
package="ros_gz_image",
61+
executable="image_bridge",
62+
arguments=["/drone0/frontal_cam/image_raw"],
63+
output="screen",
64+
)
65+
66+
start_gazebo_ventral_image_bridge_cmd = Node(
67+
package="ros_gz_image",
68+
executable="image_bridge",
69+
arguments=["/drone0/ventral_cam/image_raw"],
70+
output="screen",
71+
)
72+
73+
# Create the launch description and populate
74+
ld = LaunchDescription()
75+
ld.add_action(declare_use_simulator_cmd)
76+
ld.add_action(gzsim)
77+
ld.add_action(as2)
78+
ld.add_action(start_gazebo_frontal_image_bridge_cmd)
79+
ld.add_action(start_gazebo_ventral_image_bridge_cmd)
80+
81+
return ld

0 commit comments

Comments
 (0)