Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Error running launch file multiple cameras with leading zero's as serial number #164

Open
cgrain opened this issue Oct 2, 2020 · 1 comment

Comments

@cgrain
Copy link

cgrain commented Oct 2, 2020

I tried to launch multiple camera's, and I presumed it would not be much of an hassle. Simply plug in the numbers and it should be all set (Code block 1). However, this string gets silently converted to a double (Note the leading zero's) which is not what was expected, and therefore it crashes. (Code block 2). I tried removing the leading zero's and the quotes (Code block 3), but that resulted in another error, because apparently 00xx != xx (Code block 4). Please note that in Python, leading zero's are not allowed in literals. i.e. default=00xx gives an syntax error and will not run at all.

I am wondering if anybody encountered a similar problem and has a fix.
I am using ROS2-Foxy and the refactor branch on Ubuntu 20.

def generate_launch_description():
    # config the serial number and base frame id of each camera
    camera1_base_frame_id = LaunchConfiguration(
        'base_frame_id', default='camera1_link')
    camera2_base_frame_id = LaunchConfiguration(
        'base_frame_id', default='camera2_link')
    camera1_serial_no = LaunchConfiguration(
        'serial_no', default='017322071690')
    camera2_serial_no = LaunchConfiguration(
        'serial_no', default='001622072049')

    camera1_node = Node(
        package='realsense_node',
        node_executable='realsense_node',
        node_namespace="/camera1",
        output='screen',
        parameters=[{'serial_no': camera1_serial_no,
                     'base_frame_id': camera1_base_frame_id}]
    )
    camera2_node = Node(
        package='realsense_node',
        node_executable='realsense_node',
        node_namespace="/camera2",
        output='screen',
        parameters=[{'serial_no': camera2_serial_no,
                     'base_frame_id': camera2_base_frame_id}]
    )
    return launch.LaunchDescription([camera1_node, camera2_node])
[INFO] [realsense_node-8]: process started with pid [36898]
[INFO] [realsense_node-9]: process started with pid [36900]
[realsense_node-8] terminate called after throwing an instance of 'rclcpp::ParameterTypeException'
[realsense_node-8]   what():  expected [integer] got [double]
[realsense_node-9] terminate called after throwing an instance of 'rclcpp::ParameterTypeException'
[realsense_node-9]   what():  expected [integer] got [double]
[ERROR] [realsense_node-8]: process has died [pid 36898, exit code -6, cmd '/home/riwo-game-pc/ros2_ws/install/realsense_node/lib/realsense_node/realsense_node --ros-args --params-file /tmp/launch_params_ozt8n6_t -r __ns:=/camera1'].
[ERROR] [realsense_node-9]: process has died [pid 36900, exit code -6, cmd '/home/riwo-game-pc/ros2_ws/install/realsense_node/lib/realsense_node/realsense_node --ros-args --params-file /tmp/launch_params_drclna3x -r __ns:=/camera2'].
def generate_launch_description():
    # config the serial number and base frame id of each camera
    camera1_base_frame_id = LaunchConfiguration(
        'base_frame_id', default='camera1_link')
    camera2_base_frame_id = LaunchConfiguration(
        'base_frame_id', default='camera2_link')
    camera1_serial_no = LaunchConfiguration(
        'serial_no', default=17322071690)
    camera2_serial_no = LaunchConfiguration(
        'serial_no', default=1622072049)
    # yada yada yada
[realsense_node-9] [INFO] [1601629749.385466311] [camera2.camera]: Device with serial number 001622072049 was found.
[realsense_node-9] [INFO] [1601629749.392884082] [camera2.camera]: Device with serial number 017322071690 was found.
[realsense_node-9] [ERROR] [1601629749.393290446] [camera2.camera]: The Device with serial number 1622072049 is not found. Please connect it.
@cgrain
Copy link
Author

cgrain commented Oct 5, 2020

I fixed it by using a terrible fix: At the appropiate place in the c++ code of the realsense node, I plugged in:

   if (serial_no == "42") {
      serial_no = "017322071690"
   }

Which obviously only works for me, and I can't update the package now, anymore. So this is still a bug that needs to be fixed, But a small look at the ticket times shows that a workaround like this is probably the best idea.

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

No branches or pull requests

1 participant