Skip to content

Commit

Permalink
PR #2709 from Arun-Prasad-V: Fixing TF frame links b/w multi camera n…
Browse files Browse the repository at this point in the history
…odes when using custom names
  • Loading branch information
Nir-Az authored Jun 27, 2023
2 parents e6e7f95 + aa1eab6 commit afbf534
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions realsense2_camera/launch/rs_multi_camera_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

"""Launch realsense2_camera node."""
import copy
from launch import LaunchDescription
from launch import LaunchDescription, LaunchContext
import launch_ros.actions
from launch.actions import IncludeLaunchDescription
from launch.actions import IncludeLaunchDescription, OpaqueFunction
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir
from launch.launch_description_sources import PythonLaunchDescriptionSource
import sys
Expand All @@ -47,6 +47,16 @@ def duplicate_params(general_params, posix):
param['name'] += posix
return local_params

def add_node_action(context : LaunchContext):
# dummy static transformation from camera1 to camera2
node = launch_ros.actions.Node(
package = "tf2_ros",
executable = "static_transform_publisher",
arguments = ["0", "0", "0", "0", "0", "0",
context.launch_configurations['camera_name1'] + "_link",
context.launch_configurations['camera_name2'] + "_link"]
)
return [node]

def generate_launch_description():
params1 = duplicate_params(rs_launch.configurable_parameters, '1')
Expand All @@ -64,10 +74,5 @@ def generate_launch_description():
PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/rs_launch.py']),
launch_arguments=set_configurable_parameters(params2).items(),
),
# dummy static transformation from camera1 to camera2
launch_ros.actions.Node(
package = "tf2_ros",
executable = "static_transform_publisher",
arguments = ["0", "0", "0", "0", "0", "0", "camera1_link", "camera2_link"]
),
OpaqueFunction(function=add_node_action)
])

0 comments on commit afbf534

Please sign in to comment.