Skip to content

Commit

Permalink
Multiple cameras + compression
Browse files Browse the repository at this point in the history
  • Loading branch information
brendoncintas committed May 15, 2023
1 parent 4f597d1 commit 2d55646
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config/params.yaml → config/params_1.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**:
ros__parameters:
video_device: "/dev/video0"
framerate: 30.0
framerate: 15.0
io_method: "mmap"
frame_id: "camera"
pixel_format: "mjpeg2rgb" # see usb_cam/supported_formats for list of supported formats
Expand Down
22 changes: 22 additions & 0 deletions config/params_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**:
ros__parameters:
video_device: "/dev/video2"
framerate: 15.0
io_method: "mmap"
frame_id: "camera"
pixel_format: "mjpeg2rgb" # see usb_cam/supported_formats for list of supported formats
image_width: 640
image_height: 480
camera_name: "test_camera"
camera_info_url: "package://usb_cam/config/camera_info.yaml"
brightness: -1
contrast: -1
saturation: -1
sharpness: -1
gain: -1
auto_white_balance: true
white_balance: 4000
autoexposure: true
exposure: 100
autofocus: false
focus: -1
69 changes: 56 additions & 13 deletions launch/demo_launch.py → launch/camera.launch.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import GroupAction
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition



def generate_launch_description():
Expand All @@ -52,26 +57,64 @@ def generate_launch_description():
usb_cam_dir = get_package_share_directory('usb_cam')

# get path to params file
params_path = os.path.join(
params_path_1 = os.path.join(
usb_cam_dir,
'config',
'params.yaml'
'params_1.yaml'
)

params_path_2 = os.path.join(
usb_cam_dir,
'config',
'params_2.yaml'
)

# params_path = os.path.join(
# usb_cam_dir,
# 'config',
# 'params_3.yaml'
# )
# params_path = os.path.join(
# usb_cam_dir,
# 'config',
# 'params_4.yaml'
# )

node_name = args.node_name
camera_group = GroupAction([


Node(
package='usb_cam', executable='usb_cam_node_exe', output='screen',
name="usb_cam_1",
# namespace=ns,
parameters=[params_path_1],
remappings=[('image_raw', 'camera1/image_raw'),
('image_raw/compressed', 'camera1/image_compressed')]
),

print(params_path)
ld.add_action(Node(
Node(
package='usb_cam', executable='usb_cam_node_exe', output='screen',
name=node_name,
name='usb_cam_2',
# namespace=ns,
parameters=[params_path]
))
ld.add_action(Node(
package='usb_cam', executable='show_image.py', output='screen',
parameters=[params_path_2],
remappings=[('image_raw', 'camera2/image_raw'),
('image_raw/compressed', 'camera2/image_compressed')]
)

# Node(
# package='usb_cam', executable='usb_cam_node_exe', output='screen',
# name=node_name,
# # namespace=ns,
# parameters=[params_path_3],
# ),

# Node(
# package='usb_cam', executable='usb_cam_node_exe', output='screen',
# name=node_name,
# namespace=ns,
# arguments=[image_manip_dir + "/data/mosaic.jpg"])
# remappings=[('image_in', 'image_raw')]
))
# parameters=[params_path_4],
# )
])

ld.add_action(camera_group)
return ld
Empty file modified scripts/show_image.py
100755 → 100644
Empty file.

0 comments on commit 2d55646

Please sign in to comment.