How to avoid collision among two sensor drivers or more than?

asked 2019-10-10 11:55:40 -0600

kane_choigo gravatar image

updated 2019-10-10 12:13:40 -0600

Hello, I'm using ROS kinetic on Ubuntu 16.04.

I'd like to implement AMCL with turtlebot2 and there are no problems with following tutorials wrt the theme. To give a brief explanation, the AMCL is a kind of localization with sensor data.

But because I'm trying to do AMCL with other detection packages (using sensor data), I've suffered from a collision between the same sensor driver. In other words, in the case of when I launch openni2_launch for the AMCL package, the next openni2_launch should be launched to detect something. And here is the right place where the collision takes place.

At first, I simply thought if I comment out those kinds of codes in detection packages or AMCL packages, this trouble would be resolved. Unfortunately, I realized right away the AMCL and the detection packages need sensor data, so JUST ignore corresponding codes should not be a solution.

So I'm planning to modify the codes to get sensor data in AMCL and the right SAME data in the detection package after doing above. (In detail, I'll launch AMCL first, and detection packages next. )

In short, I'd like to know whether I could make two different nodes(or packages) subscribe to the rightly same topic.

If it is possible, are there any other operations I must do to make it?

Thanks in advance :)

edit retag flag offensive close merge delete


Your question is a bit confusing to me, If I get it right you want to use two instances of AMCL? This is something that can easily be solved with adding namespace like here

Choco93 gravatar image Choco93  ( 2019-10-11 05:15:35 -0600 )edit

Thank you for your nice reply and sorry about the late response. I eventually deleted AMCL's driver because AMCL only needs LaserScan topic for localization. In fact, a laser scan sensor driver is launched as I launch my robot( roslaunch turtlebot_bringup minimal.launch, Of course, I already modified it.). What I wanted to say was that; the same sensor driver is launched twice but the real sensor is just one. But your advice was very interesting to me, and I'm planning to use it later. Thank you :)

kane_choigo gravatar image kane_choigo  ( 2019-10-12 09:25:49 -0600 )edit