ensenso / ros_driver

Official ROS driver for Ensenso stereo cameras.
http://wiki.ros.org/ensenso_driver
BSD 3-Clause "New" or "Revised" License
28 stars 25 forks source link

parameter 'serial' has invalid type: Wrong parameter type #119

Closed ruthvik92 closed 7 months ago

ruthvik92 commented 7 months ago

Here's the error that I have when using the launch file.

OS : Ubuntu 22.04 ROS2: Humble Camera: iDS GV 5260CP C-HQ Rev2

If providing the serial number using the default value, then the below error occurs:

def generate_launch_description():
    serial_launch_arg = DeclareLaunchArgument("serial", default_value="4104488519")
ros2 launch ensenso_camera mono_node.launch.py
[INFO] [launch]: All log files can be found below /home/ruthvik/.ros/log/2023-12-05-10-02-58-334475-ruthvik-lw-845676
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ensenso_camera_mono_node-1]: process started with pid [845680]
[ensenso_camera_mono_node-1] terminate called after throwing an instance of 'rclcpp::exceptions::InvalidParameterTypeException'
[ensenso_camera_mono_node-1]   what():  parameter 'serial' has invalid type: Wrong parameter type, parameter {serial} is of type {string}, setting it to {integer} is not allowed.
[ERROR] [ensenso_camera_mono_node-1]: process has died [pid 845680, exit code -6, cmd '/home/ruthvik/ros2_ws/install/ensenso_camera/lib/ensenso_camera/ensenso_camera_mono_node --ros-args -r __node:=ensenso_camera_mono_node --params-file /tmp/launch_params_rt0ieuzo'].

If I hard-code the serial number like shown below then I don't have an issue:

    node = Node(
        package="ensenso_camera",
        executable="ensenso_camera_mono_node",
        name="ensenso_camera_mono_node",
        parameters=[
            {
                # "serial": LaunchConfiguration("serial"),
                "serial": "4104488519",
saierd commented 7 months ago

Unfortunately ROS automatically converts the parameter to a number. You can add a ! to force it to a string and our nodes will remove it before using the serial number. The nodes should actually print a warning for this, but it seems like ROS2 complains about the wrong type before we get the chance to handle this. @benthie can we improve this for ROS2?