Skip to content

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

@jveitchmichaelis

Description

@jveitchmichaelis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions