LogoLogo
Navigate?
  • XXX!
    • Frequently Asked XQuestions
  • YYY!
    • Advanced: Help me troubleshoot weird build problems
    • Advanced: Help me troubleshoot weird camera problems
  • ZZZ!
    • Basic Chatgpt ROS interface
    • Camera Calibration
    • Claw Movement
    • Computer Vision With Yolo8a
    • Connecting to the robot
    • Creating and Executing Launch Files
  • FIIVA
    • Download File From vscode
    • Edge Detection
    • Finding HSV values for any color
    • Finding correct color for line following
    • GPS Data with iPhone (GPS2IP)
    • How can I calculate a better way to rotate?
    • How do I attach a Bluetooth headset?
    • How do I control AWS RoboMaker?
    • How do I control the Arm
    • How do I convert Imagenet to Darknet
    • How do I create a Gazebo world
    • How do I create a ROS UI with TkInter?
    • How do I creating a gazebo world
    • How do I deploy a Pytorch model our cluster?
    • How do I move a file from my vnc and back?
    • How do I read a BDLC motor spec sheet
    • How do I set up AprilTags
    • How do I set up a USB camera?
    • How do I set up the Astra Pro Depth Camera?
    • How do I setup to Coral TPU
    • How do I spawn an animated Human?
    • How do I use Alexa Flask-ASK for ROS
    • How do I use OpenCV and Turtlebot3 Camera
    • How do I use Parameters and Arguments in ROS?
    • How do I use a sigmoid function instead of a PID
    • How do I visualize the contents of a bag
    • How do you use UDP to communicate between computers?
    • How does GPS work?
    • How to Copy a MicroSD
    • How to add an SDF Model
    • How to approach computer vision
    • How to connect to multiple robots
    • How to define and Use your own message types
    • Interbotix Pincher X100 Arm
    • PID-guide.md
    • PX-100 Arm ROS2 Setup
    • Pincer Attachment
    • ROSBridge and ROSLIBJS
    • Recognizing Objects Based on Color and Size using OpenCV
    • Reinforcement Learning and its Applications
    • Robot Arm Transforms
    • Running Multi Robot in Gazebo and Real Robot
    • Simplifying_Lidar.md
    • Spawning Multiple Robots
    • Tips for using OpenCV and Cameras
    • Using ROS2 with Docker
    • What are some Computer Vision Tips
    • What are the ROS Message Types
    • Why does roscd go wrong?
    • Why is my robot not moving?
    • Working with localStorage in React for web clients
    • bouncy-objects.md
    • camera-performance-notes.md
    • camera_pitch.md
    • change_model_color.md
    • communicate-with-rosserial.md
    • contribution-guide.md
    • customize_tb3.md
    • diy-gazebo-world.md
    • fiducial-tips.md
    • fiducial_follows.md
    • gazebo_tf.md
    • gazebo_world.md
    • handy-commands.md
    • how-to-add-texture-to-sdf.md
    • how_to_get_correct_color_for_line_following.md
    • joint-controllers.md
    • laserscan-definition-modify.md
    • launch-files.md
    • lidar_placement_and_drift.md
    • logging.md
    • model_teleportation.md
    • modular_teleop.md
    • multi-robot-one-core.md
    • multirobot-map-merge.md
    • namespacing-tfs.md
    • object_detection_yolo_setup.md
    • publish_commands_to_commandline.md
    • quaternions.md
    • reset-world-gazebo.md
    • robot multitasking
    • ros_and_aws_integration.md
    • rosbridge.md
    • rviz-markers.md
    • sdf_to_urdf.md
    • spawn_model_terminal.md
    • using-conditionals-in-roslaunch.md
    • ROS and TkInter
    • Brandeis Robotics Utility
      • Controlling Robots from VNC
      • BRU Concepts
      • Commands
      • Standard ROSUTILS directory everywhere
      • script.md
    • Cosi119 Final Reports!
      • 2023
        • Autopilot
        • Bowling Bot
        • Cargo Claw
        • Command and Control Dashboard
        • Dynamaze
        • Guard Robot
        • Multi Robot Surveilance
        • Object Sorter
        • Robot Race
        • Typenator
      • 2022
        • NASCAR-style-turtlebot-racing.md
        • RoboTag.md
        • litter_picker.md
        • mini_scouter.md
        • not-play-catch.md
        • Waiterbot
      • 2020
        • Behavior Trees Investigatoin
        • Computer Vision Maze Solver
        • FiducialSLAM.md
        • Gesture Recognition
          • color.md
          • demo.md
          • gestures.md
          • kinect.md
          • kinectv2.md
          • leap-motion.md
          • leap_motion.md
          • local-camera.md
          • ssd.md
        • dangersigns.md
        • pathplanning.md
        • reinforcement-learning-racer.md
        • stalkerbot.md
      • 2019
        • robot-arm.md
      • Sample Project Template
      • past-gen-letters.md
    • Brandeis Rover Cluster
      • intro.md
      • operation-guide
        • architecture.md
        • cluster.md
        • faq.md
        • graphs
        • graphs.md
        • image.md
        • lifecycle.md
        • nodes.md
        • operating
          • cluster.md
          • users.md
        • sources.md
      • user-guide
        • code-editor.md
        • desktop-ui.md
        • getting-started.md
    • Robots in our Lab
      • linorobot
        • Platform Hardware Specs
        • connections.md
        • howto.md
        • stack.md
        • troubleshooting.md
        • validating.md
      • minirover
        • mrbuild.md
        • mrsetup.md
        • mrtroubleshooting.md
        • mruse.md
      • platform
      • platform.md
      • pupper
        • boundary-generation.md
        • controls.md
        • fiducial-detection.md
        • hardware.md
        • introduction.md
        • planning.md
        • software-overview.md
        • software-setup.md
        • testing.md
    • Campus Rover Packages
      • C3 Architecture Notes
      • Campus Rover V 3
      • campus-rover-4
        • Working with TIVAC
        • progress-report.md
      • demos
        • demo-script-fall-2018.md
        • gen2-demo-instructions.md
      • mutant
        • Description of Mutant
        • mutant-usage.md
        • mutantsetup.md
        • raspicam.md
      • navigation
        • costmap-clearing
          • costmap-clearing-part-1.md
          • costmap-clearing-part-2.md
        • cpu-usage-and-errors-in-navigation.md
        • fiducials.md
        • floormapping.md
        • lost-and-found.md
      • nodes.md
      • package-delivery
        • talker-node.md
      • state-management-services.md
      • voice
        • [voice integration.md](./cr-package/voice/voice integration.md)
        • voice-integration.md-.-cr-package-voice-voice-integration.md.md
        • voice.md
      • web-application
        • Integrating using Flask and ROS
        • flask.md
        • livemap.md
    • Lab Infrastructure
      • Tailscale VPN
      • Creating a bootable SSD
      • Danger Signs with Batteries and Chargers
      • How to use the Rover Cluster
      • Setting up SSH on a new robot
      • Turtlebot3s.md
      • copying-robot-sd-cards.md
      • external-ssd-instructions
      • external-ssd-instructions.md
      • linux_terminal_eduroam_setup.md
      • multi-robot-infrastructure.md
      • networking.md
      • our-robots.md
      • private-networking.md
      • ros-melodic.md
      • setup-hints.md
      • ubuntubrandeis.md
    • Our ROS Packages
      • Behavior Trees
        • Nodes
        • Visualization of the behavior Tree
        • basic_movement.md
        • build
          • defining_blackboard.md
          • defining_nodes.md
          • defining_references.md
        • custom_nodes
          • custom_action.md
          • custom_conditional.md
          • custom_update.md
        • included_nodes
          • action_nodes.md
          • conditional_nodes.md
          • included_nodes.md
          • parent_nodes.md
          • update_nodes.md
        • nodes
          • leaf_nodes.md
          • parent_nodes.md
      • Speech Recognition Report
Powered by GitBook

Copyright (c) Brandeis University

On this page
  • How to namespace multiple robots and have them on the same roscore
  • Set namespace on robots' onboard computers with environment variable
  • Set namespace on your laptop with environment variable
  • Permanently associate your laptop with the name space
  • Use an environment variable
  • Use the .launch file
  • Not recommended: add __ns to the run or launch command
  • Publishing/Subsribing topics in other namespace
  • Make changes to turtlebot3_navigation package on your laptop
  • Change move base arguments
  • Change rviz arguments

Was this helpful?

Edit on GitHub
Export as PDF
  1. FIIVA
  2. Lab Infrastructure

multi-robot-infrastructure.md

How to namespace multiple robots and have them on the same roscore

To have multiple robots on the same ROS core and each of them listen to a separate node, namespacing would be an easy and efficient way to help.

Set namespace on robots' onboard computers with environment variable

  • Boot up the robot and ssh into it

  • On the robot's onboard computer, open the terminal and type in

nano ~/.bashrc

Then add the following line to the end of the file, using the robots name as the namespace

export ROS_NAMESPACE={namespace_you_choose}

Also make the following other changes:

alias bu='roslaunch turtlebot3_bringup turtlebot3_robot.launch'
export IP="$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')"
export ROS_IP=$IP
export ROS_MASTER_URI=http://roscore1.cs.brandeis.edu:11311
export ROS_NAMESPACE=roba
export TB3_MODEL=burger
export TURTLEBOT3_MODEL=burger
  • Save the file and don't forget to do source ~/.bashrc

Set namespace on your laptop with environment variable

  • Now that the robot is configured properly with its own unique name space, how do we talk to it?

  • There are three ways:

    1. Configure your laptop to be permanently associated with the same name space

    2. Set a temporary environment variable that specifies the name space

    3. Add the namespace to a launch file

    4. Use the __ns parameter for roslaunch or rosrun (not recommended)

Permanently associate your laptop with the name space

  • Use the same steps above. Make sure your namespace is exactly the same as the namespace of the robot you want to control.

  • From now on, whenever you do, e.g. a cmd_vel, it will be directed just to your robot.

Use an environment variable

  • Set namespace for a termimal with temporary environment variable.

  • To set a namespace temporarily for a terminal, which will be gone when you close the termial, just type in export ROS_NAMESPACE={namespace_you_choose} directly in your terminal window.

  • You can use echo $ROS_NAMESPACE to check it.

Use the .launch file

  • To set namespace for a node in launch file, Use the attribute ns, for example:

<node name="listener1" pkg="rospy_tutorials" type="listener.py" ns="{namespace_you_choose}" />

Not recommended: add __ns to the run or launch command

  1. Launch/Run a file/node with namespace in terminal. Add a special key __ns (double underscore here!) to your command, for example: roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch __ns:={namespace_you_choose} However,

Publishing/Subsribing topics in other namespace

Do a rostopic list, you will find out topics under a namespace will be listed as /{namespace}/{topic_name}

Make changes to turtlebot3_navigation package on your laptop

  • Type roscd turtlebot3_navigation to go to the package directory.

  • Type cd launch to go to the folder that stores .launch files.

  • Open the turtlebot3_navigation.launch file with nano or your favorite code editor.

  • You will see the scripts for launching move base and rviz:

  <!-- move_base -->
  <include file="$(find turtlebot3_navigation)/launch/move_base.launch">
    <arg name="model" value="$(arg model)" />
    <arg name="move_forward_only" value="$(arg move_forward_only)"/>
  </include>

  <!-- rviz -->
  <group if="$(arg open_rviz)">
    <node pkg="rviz" type="rviz" name="rviz" required="true"
          args="-d $(find turtlebot3_navigation)/rviz/turtlebot3_navigation.rviz"/>
  </group>

Change move base arguments

  • Add another argument cmd_vel_topic to the four arguments in the <!-- Arguments --> section:

      <!-- Arguments -->
      <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
      <arg name="map_file" default="$(find turtlebot3_navigation)/maps/map.yaml"/>
      <arg name="open_rviz" default="true"/>
      <arg name="move_forward_only" default="false"/>
      <arg name="cmd_vel_topic" default="/{namespace_you_choose}/cmd_vel"/>
    • Pass the new argument to move base launch file:

      <!-- move_base -->
      <include file="$(find turtlebot3_navigation)/launch/move_base.launch">
       <arg name="model" value="$(arg model)" />
       <arg name="move_forward_only" value="$(arg move_forward_only)"/>
       <arg name="cmd_vel_topic" value="$(arg cmd_vel_topic)"/>
      </include>
  • These changes will make move base publish to /{namespace_you_choose}/cmd_vel instead of /cmd_vel. Open the move_base.launch file in the launch folder, you will see why it worked.

Change rviz arguments

  • Type roscd turtlebot3_navigation to go to the package directory.

  • Type cd rviz to go to the folder that has turtlebot3_navigation.rviz. It stores all the arguments for rviz.

  • Open turtlebot3_navigation.rviz with VSCode or other realiable code editors, since this file is long and a bit messy.

  • In the .rviz file, search for all the lines that has the part Topic:

  • Add your namespace to the topics you found. For example, change

      Topic: /move_base/local_costmap/footprint
      `

    to

      Topic: /roba/move_base/local_costmap/footprint
  • These changes will make rviz subsribe to topics in your namespace.

Previouslinux_terminal_eduroam_setup.mdNextnetworking.md

Last updated 1 year ago

Was this helpful?

Use of this keyword is generally not encouraged as it is provided for special cases where environment variables cannot be set. ()

http://wiki.ros.org/Nodes