Skip to content

Commit

Permalink
add some docs, launch files
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeferguson committed Jun 12, 2020
1 parent e78b3a1 commit 28b53f2
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 2 deletions.
5 changes: 5 additions & 0 deletions openni2_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ install(
DESTINATION include
)

install(
DIRECTORY launch
DESTINATION share/${PROJECT_NAME}/
)

ament_export_include_directories(include)
ament_export_libraries(openni2_wrapper)
ament_export_dependencies(
Expand Down
36 changes: 34 additions & 2 deletions openni2_camera/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
openni2_camera
==============

ROS wrapper for openni 2.0
ROS2 wrapper for openni 2.0

Note: openni2_camera supports xtion devices, but not kinects. For using a kinect with ROS, try the freenect stack: http://www.ros.org/wiki/freenect_stack
Note: openni2_camera supports xtion devices, but not Kinects.

## Running ROS2 Driver

An example launch exists that loads just the camera component:

```
ros2 launch openni2_camera camera_only.launch.py
```

If you want to get a PointCloud2, use:

```
ros2 launch openni2_camera camera_with_cloud.launch.py
```

## Migration from ROS1

* The GetService message has moved to a new openni2_camera_msgs package.
* The rgb/image topic has been renamed to rgb/image_raw for consistency.
* The nodelet has been refactored into an rclcpp component called
"openni2_wrapper::OpenNI2Driver". See the launch folder for an example
of how to start this.
* Since most components in image_proc/depth_image_proc lack lazy pub/sub,
the advanced processing graphs in rgbd_launch and openni2_launch are not
currently feasible. It is recommended to create a launch file with the
specific pipeline you want. See the launch folder for an example.

## Known Issues

* There are currently no subscriber connect/disconnect callbacks in ROS2.
This package implements a lazy publisher by running a 1Hz update loop
and seeing if there are new subscribers.
65 changes: 65 additions & 0 deletions openni2_camera/launch/camera_only.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python3

# Copyright (c) 2020, Michael Ferguson
# All rights reserved.
#
# Software License Agreement (BSD License 2.0)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import os

import launch
import launch_ros.actions
import launch_ros.descriptions


def generate_launch_description():

namespace = '/camera'

container = launch_ros.actions.ComposableNodeContainer(
name='container',
namespace=namespace,
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
# Just the driver
launch_ros.descriptions.ComposableNode(
package='openni2_camera',
plugin='openni2_wrapper::OpenNI2Driver',
name='driver',
parameters=[{'depth_registration': True},
{'use_device_time': False}],
namespace=namespace,
),
],
output='screen',
)

return launch.LaunchDescription([container])
78 changes: 78 additions & 0 deletions openni2_camera/launch/camera_with_cloud.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env python3

# Copyright (c) 2020, Michael Ferguson
# All rights reserved.
#
# Software License Agreement (BSD License 2.0)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import os

import launch
import launch_ros.actions
import launch_ros.descriptions


def generate_launch_description():

namespace = '/camera'

container = launch_ros.actions.ComposableNodeContainer(
name='container',
namespace=namespace,
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
# Driver
launch_ros.descriptions.ComposableNode(
package='openni2_camera',
plugin='openni2_wrapper::OpenNI2Driver',
name='driver',
namespace=namespace,
parameters=[{'depth_registration': True},
{'use_device_time': False}],
remappings=[('depth/image', 'depth_registered/image_raw')],
),
# Create XYZRGB point cloud
launch_ros.descriptions.ComposableNode(
package='depth_image_proc',
plugin='depth_image_proc::PointCloudXyzrgbNode',
name='points_xyzrgb',
namespace=namespace,
parameters=[{'queue_size': 10}],
remappings=[('rgb/image_rect_color', 'rgb/image_raw'),
('rgb/camera_info', 'rgb/camera_info'),
('depth_registered/image_rect', 'depth_registered/image_raw'),
('points', 'depth_registered/points'), ],
),
],
output='screen',
)

return launch.LaunchDescription([container])

0 comments on commit 28b53f2

Please sign in to comment.