Skip to content

Commit 4fcc3e0

Browse files
committed
add config template to ros bridge
1 parent 2e69694 commit 4fcc3e0

File tree

2 files changed

+70
-3
lines changed

2 files changed

+70
-3
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2025 Open Source Robotics Foundation, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from launch import LaunchDescription
16+
from launch_ros.actions import Node
17+
18+
19+
def generate_launch_description():
20+
21+
# Bridge
22+
bridge = Node(
23+
package="ros_gz_bridge",
24+
executable="parameter_bridge",
25+
arguments=[
26+
"/sensor/camera@sensor_msgs/msg/Image@gz.msgs.Image", # for the multibeam world
27+
"/sensor/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo", # for the multibeam world
28+
"/sensor/depth_camera@sensor_msgs/msg/Image@gz.msgs.Image", # for the multibeam world
29+
"/sensor/multibeam_sonar/point_cloud2@sensor_msgs/msg/PointCloud2@gz.msgs.PointCloudPacked", # the point cloud bridge, must match the model.sdf
30+
],
31+
output="screen",
32+
)
33+
34+
tf_node = Node(
35+
package="tf2_ros",
36+
executable="static_transform_publisher",
37+
arguments=[
38+
"--frame-id",
39+
"world",
40+
"--child-frame-id",
41+
"blueview_p900/blueview_p900_base_link/multibeam_sonar",
42+
],
43+
)
44+
45+
return LaunchDescription([bridge, tf_node])

models/dave_sensor_models/launch/upload_sensor.launch.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
from launch import LaunchDescription
2-
from launch.actions import DeclareLaunchArgument, RegisterEventHandler, LogInfo
2+
from launch.actions import (
3+
DeclareLaunchArgument,
4+
RegisterEventHandler,
5+
LogInfo,
6+
IncludeLaunchDescription,
7+
)
38
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
49
from launch.conditions import IfCondition
510
from launch_ros.substitutions import FindPackageShare
611
from launch.event_handlers import OnProcessExit
712
from launch_ros.actions import Node
13+
from launch.launch_description_sources import PythonLaunchDescriptionSource
814

915

1016
def generate_launch_description():
@@ -76,7 +82,7 @@ def generate_launch_description():
7682
[
7783
FindPackageShare("dave_sensor_models"),
7884
"description",
79-
namespace,
85+
LaunchConfiguration("namespace"),
8086
"model.sdf",
8187
]
8288
)
@@ -126,6 +132,22 @@ def generate_launch_description():
126132
parameters=[{"use_sim_time": use_sim_time}],
127133
)
128134

135+
sensor_config = IncludeLaunchDescription(
136+
PythonLaunchDescriptionSource(
137+
PathJoinSubstitution(
138+
[
139+
FindPackageShare("dave_sensor_models"),
140+
"config",
141+
LaunchConfiguration("namespace"),
142+
"sensor_config.py",
143+
]
144+
)
145+
),
146+
launch_arguments={
147+
"namespace": namespace,
148+
}.items(),
149+
)
150+
129151
nodes = [tf2_spawner, gz_spawner]
130152

131153
event_handlers = [
@@ -134,4 +156,4 @@ def generate_launch_description():
134156
)
135157
]
136158

137-
return LaunchDescription(args + nodes + event_handlers)
159+
return LaunchDescription(args + nodes + event_handlers + [sensor_config])

0 commit comments

Comments
 (0)