Skip to content

Commit 3afba27

Browse files
authored
Merge branch 'humble-devel' into testing
2 parents 043a03a + 21bc451 commit 3afba27

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+17011
-0
lines changed

CustomRobots/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ install(
9797
car_junction/models
9898
car_junction/worlds
9999
car_junction/launch
100+
car_junction/scripts
100101
# AMAZON WAREHOUSE ROBOT
101102
amazon_robot/launch
102103
amazon_robot/models
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import os
2+
from launch import LaunchDescription
3+
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
4+
from launch.conditions import IfCondition, UnlessCondition
5+
from launch.launch_description_sources import PythonLaunchDescriptionSource
6+
from launch.substitutions import Command, LaunchConfiguration, PythonExpression
7+
from launch_ros.actions import Node
8+
from launch_ros.substitutions import FindPackageShare
9+
10+
11+
def generate_launch_description():
12+
13+
# Set the path to the Gazebo ROS package
14+
pkg_gazebo_ros = FindPackageShare(package="gazebo_ros").find("gazebo_ros")
15+
16+
# Set the path to this package.
17+
pkg_share = FindPackageShare(package="custom_robots").find("custom_robots")
18+
19+
# Set the path to the world file
20+
world_file_name = "road_junction.world"
21+
world_path = os.path.join(pkg_share, "worlds", world_file_name)
22+
23+
# Set the path to the SDF model files.
24+
gazebo_models_path = os.path.join(pkg_share, "models")
25+
os.environ[
26+
"GAZEBO_MODEL_PATH"
27+
] = f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
28+
29+
start_ros_gazebo_bridge = Node(
30+
package="ros_gz_bridge",
31+
executable="parameter_bridge",
32+
arguments=[
33+
"/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock",
34+
"/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist",
35+
"/odom@nav_msgs/msg/Odometry]gz.msgs.Odometry",
36+
"/waymo/lidar/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked",
37+
"/waymo/camera_info@sensor_msgs/msg/CameraInfo[gz.msgs.CameraInfo",
38+
],
39+
parameters=[{'use_sim_time': True}],
40+
output="screen"
41+
),
42+
43+
start_ros_gazebo_image_bridge = Node(
44+
package="ros_gz_image",
45+
executable="image_bridge",
46+
arguments=["/waymo/camera_front@sensor_msgs/msg/Image[gz.msgs.Image"],
47+
output="screen",
48+
)
49+
50+
########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
51+
# Launch configuration variables specific to simulation
52+
headless = LaunchConfiguration("headless")
53+
use_sim_time = LaunchConfiguration("use_sim_time")
54+
use_simulator = LaunchConfiguration("use_simulator")
55+
world = LaunchConfiguration("world")
56+
57+
declare_simulator_cmd = DeclareLaunchArgument(
58+
name="headless",
59+
default_value="False",
60+
description="Whether to execute gzclient",
61+
)
62+
63+
declare_use_sim_time_cmd = DeclareLaunchArgument(
64+
name="use_sim_time",
65+
default_value="true",
66+
description="Use simulation (Gazebo) clock if true",
67+
)
68+
69+
declare_use_simulator_cmd = DeclareLaunchArgument(
70+
name="use_simulator",
71+
default_value="True",
72+
description="Whether to start the simulator",
73+
)
74+
75+
declare_world_cmd = DeclareLaunchArgument(
76+
name="world",
77+
default_value=world_path,
78+
description="Full path to the world model file to load",
79+
)
80+
81+
# Specify the actions
82+
83+
# Start Gazebo server
84+
start_gazebo_server_cmd = IncludeLaunchDescription(
85+
PythonLaunchDescriptionSource(
86+
os.path.join(pkg_gazebo_ros, "launch", "gzserver.launch.py")
87+
),
88+
condition=IfCondition(use_simulator),
89+
launch_arguments={"world": world}.items(),
90+
)
91+
92+
# Start Gazebo client
93+
start_gazebo_client_cmd = IncludeLaunchDescription(
94+
PythonLaunchDescriptionSource(
95+
os.path.join(pkg_gazebo_ros, "launch", "gzclient.launch.py")
96+
),
97+
condition=IfCondition(PythonExpression([use_simulator, " and not ", headless])),
98+
)
99+
100+
# Create the launch description and populate
101+
ld = LaunchDescription()
102+
103+
# Declare the launch options
104+
ld.add_action(declare_simulator_cmd)
105+
ld.add_action(declare_use_sim_time_cmd)
106+
ld.add_action(declare_use_simulator_cmd)
107+
ld.add_action(declare_world_cmd)
108+
109+
# Add any actions
110+
ld.add_action(start_gazebo_server_cmd)
111+
ld.add_action(start_gazebo_client_cmd)
112+
ld.add_action(start_ros_gazebo_bridge)
113+
ld.add_action(start_ros_gazebo_image_bridge)
114+
115+
return ld
496 KB
Loading
426 KB
Loading
340 KB
Loading
526 KB
Loading
382 KB
Loading
382 KB
Loading
477 KB
Loading
342 KB
Loading

0 commit comments

Comments
 (0)