ros-drivers / flir_camera_driver

153 stars 145 forks source link

[Humble] stereo_synced.launch.py: libcamera_driver.so: cannot open shared object file: No such file or directory #175

Closed TillBeemelmanns closed 2 weeks ago

TillBeemelmanns commented 1 month ago

Bug We tried to follow the stereo launch example, but failed to launch a ComposableNode spinnaker_camera_driver::CameraDriver from package spinnaker_camera_driver with the error

[stereo_camera_container]: Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99

(Full Log Below)

A manual inspection of /opt/ros/humble/lib/ revealed that libcamera_driver.so is indeed missing. All other libs eg. spinnaker so files or spinnaker_camera_driver files are there.

This is our launch setup. The normal launch using the driver_node.launch.py works with our setup.

...
def make_camera_node(name, camera_type, serial):
    parameter_file = PathJoinSubstitution(
        [FindPackageShare('spinnaker_camera_driver'), 'config',
         camera_type + '.yaml'])

    node = ComposableNode(
        package='spinnaker_camera_driver',
        plugin='spinnaker_camera_driver::CameraDriver',
        name=name,
        parameters=[camera_params,
                    {'parameter_file': parameter_file,
                     'serial_number': serial}],
        remappings=[('~/control', '/exposure_control/control'), ],
        extra_arguments=[{'use_intra_process_comms': True}])
    return node

def launch_setup(context, *args, **kwargs):
    """Create synchronized stereo camera."""
    container = ComposableNodeContainer(
            name='stereo_camera_container',
            namespace='',
            package='rclcpp_components',
            executable='component_container',
            composable_node_descriptions=[
                make_camera_node(LaunchConfig('cam_0_name').perform(context),
                                 LaunchConfig('cam_0_type').perform(context),
                                 LaunchConfig('cam_0_serial').perform(context)),
                make_camera_node(LaunchConfig('cam_1_name').perform(context),
                                 LaunchConfig('cam_1_type').perform(context),
                                 LaunchConfig('cam_1_serial').perform(context)),
            ],
            output='screen',
    )  # end of container
    return [container]

System details

Logging output

[INFO] [component_container-1]: process started with pid [58]
[component_container-1] [INFO] [1715938514.700898867] [stereo_camera_container]: Load Library: /opt/ros/humble/lib/libcamera_driver.so
[component_container-1] [ERROR] [1715938514.701230695] [stereo_camera_container]: Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'cam_mono_top' of type 'spinnaker_camera_driver::CameraDriver' in container '/stereo_camera_container': Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[component_container-1] [INFO] [1715938514.705041094] [stereo_camera_container]: Load Library: /opt/ros/humble/lib/libcamera_driver.so
[component_container-1] [ERROR] [1715938514.705122588] [stereo_camera_container]: Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'cam_mono_bottom' of type 'spinnaker_camera_driver::CameraDriver' in container '/stereo_camera_container': Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[INFO] [component_container-1]: sending signal 'SIGINT' to process[component_container-1]
[component_container-1] [INFO] [1715939262.926209451] [rclcpp]: signal_handler(signum=2)
[INFO] [component_container-1]: process has finished cleanly [pid 58]
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-05-17-09-47-46-525981-0e5a55cbefcf-7
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [58]
[component_container-1] [INFO] [1715939266.836582974] [stereo_camera_container]: Load Library: /opt/ros/humble/lib/libcamera_driver.so
[component_container-1] [ERROR] [1715939266.836897128] [stereo_camera_container]: Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'cam_mono_top' of type 'spinnaker_camera_driver::CameraDriver' in container '/stereo_camera_container': Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[component_container-1] [INFO] [1715939266.840879402] [stereo_camera_container]: Load Library: /opt/ros/humble/lib/libcamera_driver.so
[component_container-1] [ERROR] [1715939266.840940678] [stereo_camera_container]: Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'cam_mono_bottom' of type 'spinnaker_camera_driver::CameraDriver' in container '/stereo_camera_container': Failed to load library: Could not load library dlopen error: /opt/ros/humble/lib/libcamera_driver.so: cannot open shared object file: No such file or directory, at ./src/shared_library.c:99
[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[INFO] [component_container-1]: sending signal 'SIGINT' to process[component_container-1]
[component_container-1] [INFO] [1715939291.870621112] [rclcpp]: signal_handler(signum=2)
[INFO] [component_container-1]: process has finished cleanly [pid 58]
berndpfrommer commented 1 month ago

I'm traveling right now so I can't test if the stereo camera launch script still works. It did at some point, but I changed the driver code quite a bit since then. I should remove the launch script from the source tree or test that it actually works. The reason I stopped testing it is because I'm using the spinnaker_synchronized_driver now. Are your cameras hardware synchronized?

berndpfrommer commented 1 month ago

Yeah, the loading of the composable node no longer works. Not sure what is broken. The library ends up in a weird place so the launch framework cannot find it: /opt/ros/humble/lib/x86_64-linux-gnu/libcamera_driver.so The stereo_synced launch script works fine when I use it from the "install" directory in my workspace. So this problem somehow arises during the packaging stage when the apt package is generated on the ROS2 build farm. Debugging this could be a longer process and probably not make it into the next sync on May 20th. Is building from source an option for you?

TillBeemelmanns commented 1 month ago

Thanks for the swift response! Yes, we will try to build the driver from source in our docker setup or try to copy libcamera_driver.so to the correct place. I will give an update on that later.

Marius-N-R commented 1 month ago

Just out of curiosity @TillBeemelmanns, as you said that you are working in a Ubuntu 22.04 docker with humble and didn't build from source, did you have any issues with getting the driver_node.launch.py to work? I struggle with setting up the udev rules in docker, as it constantly tells me "udev does not support containers"

TillBeemelmanns commented 1 month ago

@Marius-N-R No we did not have problems running driver_node.launch.py using docker. However, we use a docker-compose setup with several cameras and we can define the devices there:

services:
  camera-driver-1:
    image: our_image_with_ros_humble_and_driver:latest
    volumes:
      - ./driver_node.launch.py:/opt/ros/humble/share/spinnaker_camera_driver/launch/driver_node.launch.py
      - ./blackfly_s.yaml:/opt/ros/humble/share/spinnaker_camera_driver/config/blackfly_s.yaml
      - ./calibration-1.yaml:/docker-ros/ws/install/calibration.yaml
    command: ros2 launch spinnaker_camera_driver driver_node.launch.py camera_type:=blackfly_s serial:="'XXXX'" camera_name:=cam_1 frame_id:=rgb_cam_1_optical
    devices:
      - /dev/bus/usb

We did not need to setup udev rules in this setup.

For a completely different setup we use several ZED cameras connected via USB and there we have udev rules defined. Also defined via a docker-compose.yml file.

Marius-N-R commented 1 month ago

Oh, ok thanks I'll give it a try

berndpfrommer commented 2 weeks ago

Just tested (on ROS2 Iron) and the libraries are now found correctly.