Skip to content

Connecting to multiple robots

jsapers edited this page Dec 18, 2015 · 6 revisions

FINAL SYSTEM We modified the neato launch file to create independent neato_nodes. To do that, we created bringup_multi.launch that created a unique namespace and camera port as well as connecting to the neato. It also includes the unique information the robot needs for the ar_pose such as phase_offset and pose_correction.
In order to create a more streamlined process, we created the python script multi_connect.py. When multi_connect.py is run, it also takes in the IP addresses of the robots to connect to via user input through the terminal window. It then runs bringup_multi.launch for each IP address with the namespace “robot[n]” and port 500X, where X is the robot index starting at 0. It also send the phase_offset and pose_correction that are hard coded in for each ip address. It then waits for a kill command to shut down the robots. PROCESS The first step we took was connecting to multiple robots and controlling them independently. In order to do that, we decided to take advantage of a ROS feature called namespaces. Namespaces are ROS’s capability of working with multiple robots, or agents, using hierarchical naming. For example, publishing to the /robot1/cmd_vel topic is different than publishing to the /robot2/cmd_vel topic. By creating namespaces for each robot, we can send and receive information from each robot independently and thus control them separately.

The first hurdle we encountered was converting the supplied launch file that connected to one Neato into a framework that allowed us to easily connect to multiple robots. The first step we took was adding a name argument to the original launch file. That allowed us to give each robot a namespace, allowing them to be controlled separately. This was accomplished by wrapping everything in a <group> tag with a ns attribute: <group ns="$(arg robot)"> where robot is the name argument (“robot1”, “robot2”, etc). See launch/bringup_multi.launch.

After we confirmed that we could connect to multiple robots and give them distinct namespaces, we wrote a Python script called multi_connect.py that takes in a list of I.P. addresses and connects to those robots. We made sure that each robot is automatically given a distinct name and camera port (because of how the camera stream is set up, each robot need to have a different port number). See scripts/multi_connect.py.

We then created a simple GUI for publishing velocities to each robot in order to test our ability to control multiple robots independently. We used dynamic reconfiguring to create the gui and send linear x velocity and angular z velocity to mulitrobot_gui.py based on slider values. Those values are then published to their respective robots via namespaces. We can also use this interface to drive the Neatos around as we are working with them. See scripts/multirobot_gui.py and cfg/multirobot.cfg.