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

How to implement "Multiple CameraInfoManagers in same node"?

asked 2017-05-30 07:44:17 -0500

sihe gravatar image

updated 2017-05-30 07:49:28 -0500

I'm trying to modify the cv_camera package to do a synchronized grabbing of the two frames of a stereo camera. The publication of the two images works fine, but the two CameraInfoManager's in the node are causing problems. When starting the node, this error is displayed:

[ERROR] [1496147678.442999357]: Tried to advertise a service that is already advertised in this node [/cv_camera/set_camera_info]

I assume the problem is that the two CameraInfoManager try to create a service of the same name.

In this question it is said:

Now you can have 2 camera info managers in the same driver node for both cameras; but the 2 camera info managers should be remapped to separate topic, identical with the camera namepaces

But unfortunately the author does not specify how to remap these topics.

In my code the constructor of the core functionality class Capture initializes two camera_info_manager::CameraInfoManager objects:

Capture::Capture([....]) :
    node_(node),
    [...],
    frame_id_(frame_id),
    info_managerLeft_( node_, frame_id),
    info_managerRight_(node_, frame_id)
    {
    }

In the documentation of the CameraInfoManager Class Constructor it is said:

Parameter nh : node handle, normally for the driver's streaming name space ("camera"). The service name is relative to this handle. Nodes supporting multiple cameras may use subordinate names, like "left/camera" and "right/camera".

So how can I pass subordinate names to the info_managers?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-05-30 15:08:25 -0500

kmhallen gravatar image

updated 2017-05-30 23:14:43 -0500

You could create a node handle with a namespace for each one:

Capture::Capture([....]) :
    node_(node),
    node_left_(node, "left"),
    node_right_(node, "right"),
    [...],
    frame_id_(frame_id),
    info_managerLeft_( node_left_,   frame_id),
    info_managerRight_(node_right_, frame_id)
    {
    }
edit flag offensive delete link more

Comments

Worked like a charm. Thank you!

sihe gravatar image sihe  ( 2017-05-31 01:41:22 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-05-30 07:44:17 -0500

Seen: 286 times

Last updated: May 30 '17