anqixu / ueye_cam

A ROS nodelet and node that wraps the driver API for UEye cameras by IDS Imaging Development Systems GMBH.
Other
60 stars 102 forks source link

Default dynamic reconfigure parameters overwrite camera ini file #74

Closed anuppari closed 3 years ago

anuppari commented 5 years ago

There doesn't seem to be a way to use only the ueyedemo generated ini file to set the camera parameters rather than setting any ROS parameters. A basic launch file that doesn't set any of the camera parameters, e.g.,

<launch>
  <!-- <node name="check_ueye_api" pkg="ueye_cam" type="check_ueye_api" required="true" />-->
  <arg name="nodelet_manager_name" value="nodelet_manager" />
  <arg name="camera_name" value="camera" />

  <node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager_name)" args="manager" output="screen" />

  <node pkg="nodelet" type="nodelet" name="ueye_cam_nodelet"
        args="load ueye_cam/ueye_cam_nodelet $(arg nodelet_manager_name)">
    <param name="camera_name" type="str" value="$(arg camera_name)" /> <!-- == namespace for topics and services -->
    <param name="camera_topic" type="str" value="image_raw" />
    <param name="camera_id" type="int" value="0" /> <!-- 0 = any camera; 1+: camera ID -->
    <param name="camera_intrinsics_file" type="string" value="" /> <!-- default: ~/.ros/camera_info/<camera_name>.yaml -->
    <param name="camera_parameters_file" type="string" value="" /> <!-- default: ~/.ros/camera_conf/<camera_name>.ini -->

    <param name="ext_trigger_mode" type="bool" value="False" /> <!-- if False, then camera will operate in free-run mode; otherwise, frames need to be triggered by hardware signal (falling-edge) on digital input pin of camera -->
  </node>
</launch>

will correctly pickup the camera.ini file, but then overwrites them with the default values set in the dynamic reconfigure cfg file.

Not sure what would be a good solution to this, since the dynamic parameter server automatically handles overriding the default parameters with whatever parameters are set in the launch file, i.e., there's no real way of distinguishing default parameters from set values.

Couple ideas:

  1. Set invalid options in the cfg file, and check against those on init. Not sure this is possible for numeric values with valid ranges.
  2. Provide a service to read and set parameters from an ini file during runtime.
  3. Generate a cfg file from the ini file

Any ideas?

anuppari commented 5 years ago

Actually, probably the best solution would be setting the parameters on the server in queryCamParams, e.g., via local_nh.setParam("param").

Unless the default values in the camera differ from the default ROS parameters? Does it make sense to prefer the default hardware parameters over what the package sets as default?