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

Multiple cameras on same topic #2864

Closed
chumpblocckami opened this issue Aug 29, 2023 · 8 comments
Closed

Multiple cameras on same topic #2864

chumpblocckami opened this issue Aug 29, 2023 · 8 comments
Labels

Comments

@chumpblocckami
Copy link

Hi, i'm new to ROS and i'm trying to set up two Intel(R) RealSense(TM) Depth Ca on a computer (Lenovo Legion 5 15ARH05H) on two different USB port.

I launch the cameras as:

launch/cameras:
	ros2 launch realsense2_camera rs_launch.py camera:=camera_1 serial_no:=_$(CAMERA_1_SERIAL_NUMBER) &\
 	ros2 launch realsense2_camera rs_launch.py camera:=camera_2 serial_no:=_$(CAMERA_2_SERIAL_NUMBER)

The output on RViz is:
screencast-from-29-08-2023-171245_4wFqGfZP

The cameras are up and running but they share the same topic, which triggers the flickering on the video.
How can I run the cameras in two different topic?

Thanks a lot

@MartyG-RealSense
Copy link
Collaborator

Hi @chumpblocckami Does the flickering occur if you use the ROS2 wrapper's multiple camera launch file for a two-camera setup?

https://github.com/IntelRealSense/realsense-ros/blob/ros2-development/realsense2_camera/launch/rs_multi_camera_launch.py

ros2 launch realsense2_camera rs_multi_camera_launch.py

@chumpblocckami
Copy link
Author

Thanks for the quick response,

I tried to launch both
ros2 launch realsense2_camera rs_multi_camera_launch.py
and
ros2 launch realsense2_camera rs_multi_camera_launch.py camera_name1:=camera_1 camera_name2:=camera_2 device_type2:=d4. device_type1:=d4.
defining both camera_names and device_types (that are equal because the cameras are the same).

I had the same result:

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense2_camera_node-1]: process started with pid [44]
[INFO] [realsense2_camera_node-2]: process started with pid [46]
[INFO] [static_transform_publisher-3]: process started with pid [48]
[static_transform_publisher-3] [WARN] [1693324128.381845552] []: Old-style arguments are deprecated; see --help for new-style arguments
[static_transform_publisher-3] [INFO] [1693324128.398060717] [static_transform_publisher_K26PpZct8iZ1azue]: Spinning until stopped - publishing transform
[static_transform_publisher-3] translation: ('0.000000', '0.000000', '0.000000')
[static_transform_publisher-3] rotation: ('0.000000', '0.000000', '0.000000', '1.000000')
[static_transform_publisher-3] from 'camera1_link' to 'camera2_link'
[realsense2_camera_node-1] �[0m[INFO] [1693324128.464760937] [camera1.camera1]: RealSense ROS v4.54.1�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.464883718] [camera1.camera1]: Built with LibRealSense v2.54.1�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.464903344] [camera1.camera1]: Running with LibRealSense v2.54.1�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.466044349] [camera2.camera2]: RealSense ROS v4.54.1�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.466156724] [camera2.camera2]: Built with LibRealSense v2.54.1�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.466172439] [camera2.camera2]: Running with LibRealSense v2.54.1�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.492523041] [camera1.camera1]: Device with serial number 318122301365 was found.
[realsense2_camera_node-1] �[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.492593302] [camera1.camera1]: Device with physical ID /sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-2/3-2:1.0/video4linux/video20 was found.�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.492609156] [camera1.camera1]: Device with name Intel RealSense D455 was found.�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.492834535] [camera1.camera1]: Device with port number 3-2 was found.�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.492862891] [camera1.camera1]: Device USB type: 2.1�[0m
[realsense2_camera_node-1] �[33m[WARN] [1693324128.492876231] [camera1.camera1]: Device 318122301365 is connected using a 2.1 port. Reduced performance is expected.�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.493400254] [camera1.camera1]: getParameters...�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.493745132] [camera2.camera2]: Device with serial number 318122301365 was found.
[realsense2_camera_node-2] �[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.493802403] [camera2.camera2]: Device with physical ID /sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-2/3-2:1.0/video4linux/video20 was found.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.493820631] [camera2.camera2]: Device with name Intel RealSense D455 was found.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.494152310] [camera2.camera2]: Device with port number 3-2 was found.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.494196939] [camera2.camera2]: Device USB type: 2.1�[0m
[realsense2_camera_node-2] �[33m[WARN] [1693324128.494212793] [camera2.camera2]: Device 318122301365 is connected using a 2.1 port. Reduced performance is expected.�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494567869] [camera1.camera1]: JSON file is not provided�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494617526] [camera1.camera1]: Device Name: Intel RealSense D455�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494630866] [camera1.camera1]: Device Serial No: 318122301365�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494641342] [camera1.camera1]: Device physical port: /sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-2/3-2:1.0/video4linux/video20�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494656218] [camera1.camera1]: Device FW version: 5.13.0.55�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494669349] [camera1.camera1]: Device Product ID: 0x0B5C�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.494683666] [camera1.camera1]: Sync Mode: Off�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.494881388] [camera2.camera2]: getParameters...�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495384668] [camera2.camera2]: JSON file is not provided�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495421964] [camera2.camera2]: Device Name: Intel RealSense D455�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495436072] [camera2.camera2]: Device Serial No: 318122301365�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495450529] [camera2.camera2]: Device physical port: /sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-2/3-2:1.0/video4linux/video20�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495465196] [camera2.camera2]: Device FW version: 5.13.0.55�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495479373] [camera2.camera2]: Device Product ID: 0x0B5C�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.495493272] [camera2.camera2]: Sync Mode: Off�[0m
[realsense2_camera_node-2] 29/08 11:48:48,546 ERROR [139882026485312] (librealsense-exception.h:52) set_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Invalid or incomplete multibyte or wide character
[realsense2_camera_node-2] �[33m[WARN] [1693324128.547146152] [camera2.camera2]: Failed to set value to sensor: depth_module.exposure = 33000[1, 200000]
[realsense2_camera_node-2] set_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Invalid or incomplete multibyte or wide character�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.626504983] [camera1.camera1]: Set Exposure.1 to 7500�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.631026121] [camera2.camera2]: Set Exposure.1 to 7500�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.631597217] [camera1.camera1]: Set ROS param depth_module.profile to default: 640x480x15�[0m
[realsense2_camera_node-1] �[33m[WARN] [1693324128.634756719] [camera1.camera1]: Could not set param: rgb_camera.power_line_frequency with 3 Range: [0, 2]: parameter 'rgb_camera.power_line_frequency' could not be set: Parameter {rgb_camera.power_line_frequency} doesn't comply with integer range.�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.636698669] [camera1.camera1]: Set ROS param rgb_camera.profile to default: 640x480x15�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.637785407] [camera1.camera1]: Set ROS param gyro_fps to default: 200�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.638072806] [camera1.camera1]: Set ROS param accel_fps to default: 100�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.645495869] [camera2.camera2]: Set ROS param depth_module.profile to default: 640x480x15�[0m
[realsense2_camera_node-2] �[33m[WARN] [1693324128.648866503] [camera2.camera2]: Could not set param: rgb_camera.power_line_frequency with 3 Range: [0, 2]: parameter 'rgb_camera.power_line_frequency' could not be set: Parameter {rgb_camera.power_line_frequency} doesn't comply with integer range.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.650820326] [camera2.camera2]: Set ROS param rgb_camera.profile to default: 640x480x15�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.651857197] [camera1.camera1]: Stopping Sensor: Depth Module�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.651911604] [camera2.camera2]: Set ROS param gyro_fps to default: 200�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.652007916] [camera2.camera2]: Set ROS param accel_fps to default: 100�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.656202333] [camera1.camera1]: Starting Sensor: Depth Module�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.660673185] [camera2.camera2]: Stopping Sensor: Depth Module�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.664493111] [camera2.camera2]: Starting Sensor: Depth Module�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.822688427] [camera1.camera1]: Open profile: stream_type: Depth(0), Format: Z16, Width: 640, Height: 480, FPS: 15�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.822835584] [camera1.camera1]: Stopping Sensor: RGB Camera�[0m
[realsense2_camera_node-2] 29/08 11:48:48,834 ERROR [139882026485312] (librealsense-exception.h:52) xioctl(VIDIOC_S_FMT) failed, errno=16 Last Error: Device or resource busy
[realsense2_camera_node-2] �[31m[ERROR] [1693324128.834650018] [camera2.camera2]: ./src/rs_node_setup.cpp:370:An exception has been thrown: xioctl(VIDIOC_S_FMT) failed, errno=16 Last Error: Device or resource busy�[0m
[realsense2_camera_node-2] Failed to start device: xioctl(VIDIOC_S_FMT) failed, errno=16 Last Error: Device or resource busy
[realsense2_camera_node-2] �[0m[INFO] [1693324128.834945937] [camera2.camera2]: Stopping Sensor: Depth Module�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.836202181] [camera2.camera2]: Starting Sensor: Depth Module�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.846395448] [camera1.camera1]: Starting Sensor: RGB Camera�[0m
[realsense2_camera_node-2] 29/08 11:48:48,847 ERROR [139881732871744] (librealsense-exception.h:52) xioctl(VIDIOC_S_FMT) failed, errno=16 Last Error: Device or resource busy
[realsense2_camera_node-2] �[31m[ERROR] [1693324128.847897256] [camera2.camera2]: ./src/rs_node_setup.cpp:370:An exception has been thrown: xioctl(VIDIOC_S_FMT) failed, errno=16 Last Error: Device or resource busy�[0m
[realsense2_camera_node-2] �[31m[ERROR] [1693324128.847971079] [camera2.camera2]: Error updating the sensors: xioctl(VIDIOC_S_FMT) failed, errno=16 Last Error: Device or resource busy�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.851838707] [camera1.camera1]: Open profile: stream_type: Color(0), Format: RGB8, Width: 640, Height: 480, FPS: 15�[0m
[realsense2_camera_node-1] �[0m[INFO] [1693324128.853540471] [camera1.camera1]: RealSense Node Is Up!�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.863683801] [camera2.camera2]: Device with serial number 318122301365 was found.
[realsense2_camera_node-2] �[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.863778716] [camera2.camera2]: Device with physical ID /sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-2/3-2:1.0/video4linux/video20 was found.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.863811193] [camera2.camera2]: Device with name Intel RealSense D455 was found.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.864047537] [camera2.camera2]: Device with port number 3-2 was found.�[0m
[realsense2_camera_node-2] �[0m[INFO] [1693324128.864071912] [camera2.camera2]: Device USB type: 2.1�[0m
[realsense2_camera_node-2] �[33m[WARN] [1693324128.864097684] [camera2.camera2]: Device 318122301365 is connected using a 2.1 port. Reduced performance is expected.�[0m
[realsense2_camera_node-1] �[33m[WARN] [1693324128.982667642] [camera1.camera1]: �[0m
[realsense2_camera_node-1] 29/08 11:48:49,534 ERROR [140594831660608] (backend-v4l2.cpp:2771) xioctl(VIDIOC_QBUF) failed when requesting new frame! fd: 24 error: No such device
[realsense2_camera_node-1] 29/08 11:48:49,534 ERROR [140594831660608] (backend-v4l2.cpp:2771) xioctl(VIDIOC_QBUF) failed when requesting new frame! fd: 24 error: No such device
[realsense2_camera_node-1] 29/08 11:48:49,534 ERROR [140594831660608] (backend-v4l2.cpp:2771) xioctl(VIDIOC_QBUF) failed when requesting new frame! fd: 24 error: No such device
...

My gut says that this error can be related to the fact that both cameras are the same, so the script cannot detect the correct
serial number for each cameras, resulting in overlapping the same camera.

Any thoughts on this?

@MartyG-RealSense
Copy link
Collaborator

It does appear that only the camera with serial number 318122301365 is being detected.

Do the cameras both work normally when launched on their own (with one of them unplugged) instead of together?

@chumpblocckami
Copy link
Author

Yes, cameras were detected correctly if they one is plugged and the other one is not.

@MartyG-RealSense
Copy link
Collaborator

Have you tried launching the cameras in separate ROS terminals?

Terminal 1
ros2 launch realsense2_camera rs_launch.py camera:=camera_1 serial_no:=318122301365

Terminal 2
ros2 launch realsense2_camera rs_launch.py camera:=camera_2 serial_no:= [whatever the camera 2 serial number is]

@SamerKhshiboun
Copy link
Collaborator

Hi @chumpblocckami, you can take a look on latest changes in ros2-development branch, which include support of camera_namespace and camera_name parameters. This will help creating two different topics for the two cameras.

See announcement by @MartyG-RealSense regarding these changes:
#2866

@chumpblocckami
Copy link
Author

Hi @SamerKhshiboun , thank you for pinpoint me into ros2-development branch, it was exactly what i needed :)
I was able to generate two topic related to different cameras using :

	ros2 launch realsense2_camera rs_launch.py camera_namespace:=topic_1 camera_name:=cam_1 serial_no:=_$(CAMERA_1_SERIAL_NUMBER) &
 	ros2 launch realsense2_camera rs_launch.py camera_namespace:=topic_2 camera_name:=cam_2  serial_no:=_$(CAMERA_2_SERIAL_NUMBER)

The output in rviz is the following (video and depth):

image

I post the commands and the outputs for clarification and for future users that might be interested.

@MartyG-RealSense
Copy link
Collaborator

@chumpblocckami It's excellent news that the wrapper changes enabled you to succeed. Thanks very much for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants