Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the user to specify camera topic name (when using multiple cameras) #43

Open
jveitchmichaelis opened this issue May 2, 2018 · 1 comment

Comments

@jveitchmichaelis
Copy link

jveitchmichaelis commented May 2, 2018

Possibly related to: #16 - it seems that would fix the issue, but it hasn't been closed yet. This is not only an issue re REP-0135, but it also makes using stereo cameras a pain.

The relevant code is here:

// Create ROS camera interface
if (image_encoding_ == "jpeg") {
        jpeg_pub_ = nh_.advertise<sensor_msgs::CompressedImage>("camera/image_raw/compressed",1);
        cinfo_pub_ = nh_.advertise<sensor_msgs::CameraInfo>("camera/camera_info",1);
    } else {
        camera_pub_ = image_transport_.advertiseCamera("camera/image_raw", 1);
}

So if you use a stereo namespace for the camera, you end up with e.g.

/stereo/camera/

and if you have multiple cameras, they all get published in the same topic,. One option is to namespace each camera individually, but that seems like an excessive amount of boilerplate and you're still forced to use /camera wtihin the namespace.

I've done this:

camera_pub_ = image_transport_.advertiseCamera(camera_name_ + "/image_raw", 1);

which works perfectly fine for my use case. Or we have another input parameter to change the topic name (defaulting to camera for back compatibility).

So now I can launch and end up with

/stereo/left
/stereo/right

Or is this something I should be fixing with remapping?

EDIT - Having played around with this, it seems like namespacing does fix the issue in the cleanest way, but given that the PR is now almost 4 years old, I guess this isn't a priority?

@jveitchmichaelis jveitchmichaelis changed the title Allow the user to specify camera topic name Allow the user to specify camera topic name (when using multiple cameras) May 2, 2018
@zacwitte
Copy link

I still am annoyed by this as well. I end up having to remap the topics to remove the extra /camera/ in the topic name.

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

No branches or pull requests

2 participants