Skip to content

ROS topic names ignore namespace configuration when spawning multiple robots of the same model #89

@nahueespinosa

Description

@nahueespinosa

Hi! There seems to be a bug in the way ROS topic names are loaded in various plugins.

How to reproduce

Add a laser plugin to a robot model:

plugins:
  - type: Laser
    name: laser_front
    frame: laser_front
    topic: scan2
    body: base2
    broadcast_tf: true
    origin: [0.28, 0, 0]
    range: 20
    angle: {min: -2.356194490192345, max: 2.356194490192345, increment: 0.004363323129985824}
    noise_std_dev: 0.05
    update_rate: 40

Launch a flatland_server node with the following world configuration file and see how both robots publish on the same topic (/scan2):

models:
  - name: turtlebot1
    namespace: robot1
    pose: [0, 0, 0]
    model: "turtlebot.model.yaml"
    
  - name: turtlebot2
    namespace: robot2
    pose: [0, 1, 0]
    model: "turtlebot.model.yaml"

Cause

In flatland_server/src/model.cpp there is a function called NameSpaceTopic used to prepend the namespace to the topic name before creating a publisher.

Currently, this is only used in bool_sensor.cpp but it should probably be added to other plugins, like laser.cpp.

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