ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to configure CameraInfoManager set_camera_info service name?

asked 2019-03-08 15:15:21 -0500

dcurtis gravatar image

How do I configure CameraInfoManager to publish the correct set_camera_info services?

I am working on a very simple node to take stereo images produced by a stereo USB camera where the images come in as a single double-wide image consisting of left/right images concatenated. The node simply splits the incoming image down the middle and republishes on left and right image topics. I am trying to add the appropriate CameraInfoManager machinery to load/save calibration data. The current code is in the branch 'cam_info' at

I create two pointers to CamInfoManager instances:

// Camera info managers.
camera_info_manager::CameraInfoManager *left_cinfo_;
camera_info_manager::CameraInfoManager *right_cinfo_;

Allocate and init:

    // Allocate and initialize camera info managers.
    left_cinfo_ =
        new camera_info_manager::CameraInfoManager(nh, "left_camera");
    right_cinfo_ =
        new camera_info_manager::CameraInfoManager(nh, "right_camera");

But I don't see 'left_camera' or 'right_camera' associated set_camera_info services being advertised:

dave@ai1:~/catkin_ws$ rosservice list

There is /side_by_side_stereo_splitter_node/set_camera_info, but I am confused as to what is creating that.

So, I am clearly not setting up the CameraInfoManagers correctly to get the topics that camera_calibration expects. It is kind of whiney:

Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/camera_calibration/", line 247, in on_mouse
    if self.do_upload():
  File "/opt/ros/melodic/lib/python2.7/dist-packages/camera_calibration/", line 207, in do_upload
    response = self.set_left_camera_info_service(info[0])
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/", line 439, in __call__
    return*args, **kwds)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/", line 499, in call
    service_uri = self._get_service_uri(request)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/", line 467, in _get_service_uri
    raise ServiceException("service [%s] unavailable"%self.resolved_name)
rospy.service.ServiceException: service [/left_camera/set_camera_info] unavailable

What do I need to do to get CameraInfoManager to advertise sensible services?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-11 17:10:52 -0500

dcurtis gravatar image

So this turns out to be a case where multiple node handles is the answer. With:

ros::NodeHandle nh("sxs_stereo");
ros::NodeHandle nh_left(nh, "left");
ros::NodeHandle nh_right(nh, "right");
left_cinfo_ =
    new camera_info_manager::CameraInfoManager(nh_left);
right_cinfo_ =
    new camera_info_manager::CameraInfoManager(nh_right);

The result is sensible service names, and the camera calibrator is happy.

edit flag offensive delete link more

Question Tools



Asked: 2019-03-08 15:15:21 -0500

Seen: 688 times

Last updated: Mar 11 '19