Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish tfs and set matching frame names #135

Merged
merged 1 commit into from
Nov 13, 2023
Merged
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
28 changes: 25 additions & 3 deletions openni2_camera/launch/camera_only.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@
import launch
import launch_ros.actions
import launch_ros.descriptions
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PathJoinSubstitution
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description():

namespace = '/camera'
namespace_param_name = "namespace"
namespace = LaunchConfiguration(namespace_param_name)
namespace_launch_arg = DeclareLaunchArgument(namespace_param_name, default_value='camera')

tf_prefix_param_name = "tf_prefix"
tf_prefix = LaunchConfiguration(tf_prefix_param_name)
tf_prefix_launch_arg = DeclareLaunchArgument(tf_prefix_param_name, default_value='')

container = launch_ros.actions.ComposableNodeContainer(
name='container',
Expand All @@ -53,11 +62,24 @@ def generate_launch_description():
plugin='openni2_wrapper::OpenNI2Driver',
name='driver',
parameters=[{'depth_registration': True},
{'use_device_time': True}],
{'use_device_time': True},
{'rgb_frame_id': [namespace,"_rgb_optical_frame"]},
{'depth_frame_id': [namespace,"_depth_optical_frame"]},
{'ir_frame_id': [namespace,"_ir_optical_frame"]},],
namespace=namespace,
),
],
output='screen',
)

return launch.LaunchDescription([container])
tfs = IncludeLaunchDescription(
PythonLaunchDescriptionSource(PathJoinSubstitution([ThisLaunchFileDir(), "tfs.launch.py"])),
launch_arguments={namespace_param_name: namespace, tf_prefix_param_name: tf_prefix}.items(),
)

return launch.LaunchDescription([
namespace_launch_arg,
tf_prefix_launch_arg,
container,
tfs,
])
28 changes: 25 additions & 3 deletions openni2_camera/launch/camera_with_cloud.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@
import launch
import launch_ros.actions
import launch_ros.descriptions
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PathJoinSubstitution
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description():

namespace = '/camera'
namespace_param_name = "namespace"
namespace = LaunchConfiguration(namespace_param_name)
namespace_launch_arg = DeclareLaunchArgument(namespace_param_name, default_value='camera')

tf_prefix_param_name = "tf_prefix"
tf_prefix = LaunchConfiguration(tf_prefix_param_name)
tf_prefix_launch_arg = DeclareLaunchArgument(tf_prefix_param_name, default_value='')

container = launch_ros.actions.ComposableNodeContainer(
name='container',
Expand All @@ -54,7 +63,10 @@ def generate_launch_description():
name='driver',
namespace=namespace,
parameters=[{'depth_registration': True},
{'use_device_time': True}],
{'use_device_time': True},
{'rgb_frame_id': [namespace,"_rgb_optical_frame"]},
{'depth_frame_id': [namespace,"_depth_optical_frame"]},
{'ir_frame_id': [namespace,"_ir_optical_frame"]},],
remappings=[('depth/image', 'depth_registered/image_raw')],
),
# Create XYZRGB point cloud
Expand All @@ -73,4 +85,14 @@ def generate_launch_description():
output='screen',
)

return launch.LaunchDescription([container])
tfs = IncludeLaunchDescription(
PythonLaunchDescriptionSource(PathJoinSubstitution([ThisLaunchFileDir(), "tfs.launch.py"])),
launch_arguments={namespace_param_name: namespace, tf_prefix_param_name: tf_prefix}.items(),
)

return launch.LaunchDescription([
namespace_launch_arg,
tf_prefix_launch_arg,
container,
tfs,
])
28 changes: 25 additions & 3 deletions openni2_camera/launch/camera_with_cloud_norgb.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@
import launch
import launch_ros.actions
import launch_ros.descriptions
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PathJoinSubstitution
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description():

namespace = '/camera'
namespace_param_name = "namespace"
namespace = LaunchConfiguration(namespace_param_name)
namespace_launch_arg = DeclareLaunchArgument(namespace_param_name, default_value='camera')

tf_prefix_param_name = "tf_prefix"
tf_prefix = LaunchConfiguration(tf_prefix_param_name)
tf_prefix_launch_arg = DeclareLaunchArgument(tf_prefix_param_name, default_value='')

container = launch_ros.actions.ComposableNodeContainer(
name='container',
Expand All @@ -54,7 +63,10 @@ def generate_launch_description():
name='driver',
namespace=namespace,
parameters=[{'depth_registration': False},
{'use_device_time': True}],
{'use_device_time': True},
{'rgb_frame_id': [namespace,"_rgb_optical_frame"]},
{'depth_frame_id': [namespace,"_depth_optical_frame"]},
{'ir_frame_id': [namespace,"_ir_optical_frame"]},],
remappings=[('depth/image', 'depth_registered/image_raw')],
),
# Create XYZ point cloud
Expand All @@ -72,4 +84,14 @@ def generate_launch_description():
output='screen',
)

return launch.LaunchDescription([container])
tfs = IncludeLaunchDescription(
PythonLaunchDescriptionSource(PathJoinSubstitution([ThisLaunchFileDir(), "tfs.launch.py"])),
launch_arguments={namespace_param_name: namespace, tf_prefix_param_name: tf_prefix}.items(),
)

return launch.LaunchDescription([
namespace_launch_arg,
tf_prefix_launch_arg,
container,
tfs,
])
34 changes: 34 additions & 0 deletions openni2_camera/launch/tfs.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import launch
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():

namespace_param_name = "namespace"
namespace = LaunchConfiguration(namespace_param_name)
namespace_launch_arg = DeclareLaunchArgument(namespace_param_name)

tf_prefix_param_name = "tf_prefix"
tf_prefix = LaunchConfiguration(tf_prefix_param_name)
tf_prefix_launch_arg = DeclareLaunchArgument(tf_prefix_param_name)

tf_args = [
["--frame-id", [tf_prefix,"/",namespace,"_link"],
"--child-frame-id", [tf_prefix,"/",namespace,"_depth_frame"],
"--y", "-0.02"],
["--frame-id", [tf_prefix,"/",namespace,"_link"],
"--child-frame-id", [tf_prefix,"/",namespace,"_rgb_frame"],
"--y", "-0.045"],
["--frame-id", [tf_prefix,"/",namespace,"_depth_frame"],
"--child-frame-id", [tf_prefix,"/",namespace,"_depth_optical_frame"],
"--roll", "-1.5707963267948966", "--yaw", "-1.5707963267948966"],
["--frame-id", [tf_prefix,"/",namespace,"_rgb_frame"],
"--child-frame-id", [tf_prefix,"/",namespace,"_rgb_optical_frame"],
"--roll", "-1.5707963267948966", "--yaw", "-1.5707963267948966"],
]

tf_nodes = [Node(package='tf2_ros', executable='static_transform_publisher', output='screen', arguments=args) for args in tf_args]

return launch.LaunchDescription([namespace_launch_arg, tf_prefix_launch_arg] + tf_nodes)
Loading