Skip to content

Commit

Permalink
Merge pull request #71 from christianrauch/optional_image_view
Browse files Browse the repository at this point in the history
optional image view dependency
  • Loading branch information
christianrauch authored Dec 14, 2024
2 parents 8246a01 + 5723c8e commit 123aeee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
49 changes: 30 additions & 19 deletions launch/camera.launch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from ament_index_python.resources import has_resource

from launch.actions import DeclareLaunchArgument
from launch.launch_description import LaunchDescription
from launch.substitutions import LaunchConfiguration
Expand Down Expand Up @@ -40,31 +42,40 @@ def generate_launch_description() -> LaunchDescription:
description="pixel format"
)

# composable nodes in single container
container = ComposableNodeContainer(
name='camera_container',
namespace='',
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
ComposableNode(
package='camera_ros',
plugin='camera::CameraNode',
parameters=[{
"camera": camera_param,
"width": 640,
"height": 480,
"format": format_param,
}],
extra_arguments=[{'use_intra_process_comms': True}],
),
# camera node
composable_nodes = [
ComposableNode(
package='camera_ros',
plugin='camera::CameraNode',
parameters=[{
"camera": camera_param,
"width": 640,
"height": 480,
"format": format_param,
}],
extra_arguments=[{'use_intra_process_comms': True}],
),

]

# optionally add ImageViewNode to show camera image
if has_resource("packages", "image_view"):
composable_nodes += [
ComposableNode(
package='image_view',
plugin='image_view::ImageViewNode',
remappings=[('/image', '/camera/image_raw')],
extra_arguments=[{'use_intra_process_comms': True}],
),
],
]

# composable nodes in single container
container = ComposableNodeContainer(
name='camera_container',
namespace='',
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=composable_nodes,
)

return LaunchDescription([
Expand Down
7 changes: 4 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>camera_ros</name>
<version>0.2.0</version>
<version>0.2.1</version>
<description>node for libcamera supported cameras (V4L2, Raspberry Pi Camera Modules)</description>
<maintainer email="Rauch.Christian@gmx.de">Christian Rauch</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>libcamera</depend>
<depend version_gte="0.1">libcamera</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>sensor_msgs</depend>
<depend>camera_info_manager</depend>
<depend>cv_bridge</depend>

<exec_depend>ros2launch</exec_depend>
<exec_depend>image_view</exec_depend>
<exec_depend>ament_index_python</exec_depend>
<exec_depend condition="$ROS_DISTRO != 'humble'">image_view</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_cmake_clang_format</test_depend>
Expand Down

0 comments on commit 123aeee

Please sign in to comment.