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

Revision history [back]

click to hide/show revision 1
initial version

Thanks, abhishek47 and aprotyas for your comments. It worked by creating a method with the namespace argument.

In BasicNavigor class:

def createSubscriptions(self, namespace):
    self.localization_pose_sub = self.create_subscription(PoseWithCovarianceStamped,
                                                          namespace + 'amcl_pose',
                                                          self._amclPoseCallback,
                                                          amcl_pose_qos)

And then I call this in main:

navigator = BasicNavigator()

namespace = "robot1"
navigator.createSubscriptions(namespace)

Not sure if this is exactly what you wanted me to try, but it works, so I'm happy :)