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

How does ROS work with real/actual robot in general? How's the process when we send a data to the actual robot?

asked 2016-10-13 02:46:51 -0600

alienmon gravatar image

updated 2016-10-13 03:15:53 -0600

These are basic questions. I've been wondering how does ROS work with real robot, in GENERAL. Please help me to clarify these things

  1. When we install ROS packages, we install it in our PC, and not in the actual robot. So the ROS library, driver,etc isonly in our PC, and not in the microprocessor of the robot. Is that right?
  2. Which means that only our PC knows/recogizes ROS message types (e.g. cmd_vel) ,but the actual robot does not recognize the ROS message types. The actual robot only recognizes primitive data types (e.g. int) or whatever data types are present in its microcontroller.
  3. So when we publish message to a topic e.g. cmd_vel to velocity topic. This topic is only known in our PC, and not in the robot's computer?
  4. For a ROS package (e.g. navigation) working , the ROS package actually do all the works in our PC and just send result or information to the actual robot right.
  5. So when we use/code all these ROS packages, we actually code just on our PC, meaning that we do not change anything on the robot's microcontroller itself. The robot has its own microcontroller and program, and what we do is just sending info to the microcontroller from our PC. Is that correct?
  6. For a specific robot, Where/how to find out what data(message, command) an actual robot expects to receive?

Please elaborate on those things. If possible, please give step by step example on those things e.g. when sending velocity command to an actual robot, how's the process? The data that we send from our PC is of cmd_vel type. does the robot knows this type, or it is being converted first in our PC before sending? and after the data is received on the robot, does the robot has its own program to react on that data?

PS: I've worked with a drone with ROS before. And I got the impression that we only send info to the drone.. cause I didn't install ROS to the drone, I just install it to my PC. I'm so confused how do we send the info to the drone?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
6

answered 2016-10-13 03:19:00 -0600

mgruhler gravatar image

updated 2016-10-13 04:38:18 -0600

  1. Yes, but not every robot has a microprocessor. Bigger/more complex robots typically only have a PC communicating directly with the motor drivers, sensors, ...
  2. Yes, ROS messages are for ROS, you need to translate this to whatever your actuators/sensors understand. For cmd_vel you typically have a base driver which translates the velocity of the robot base link to motor commands and sends those to the motor drives. This could be a message to a microprocessor which then sets the motor velocities or a CAN message going to a motor drive over CAN bus.
  3. Well, yes
  4. yes. but it needs information from the robot (sensor data, odometry, ...)
  5. Not necessarily. You have to interface the PC with the microcontroller. If the microcontroller has a defined interface, you could do anything on the PC, but probably you have to write the microcontroller interface to the PC as well.
  6. This is up to your hardware. Check how the microcontroller commands the robot, this is what you need to do in the end. How you send the data from ROS to your system is up to you.

There cannot be a step for step explanation for how to do this, because this depends on the HW. If you can control the robot to your liking from a self-written program on the microcontroller, you can write the rest yourself. But ROS is not just: "Plug in any roboter and they magically understand ROS".


EDIT

The answer to all your questions below is actually the same:

Any sensor or actuator provides an interface specification how to retrieve the data from it. What you need to do is to write a ROS driver for this HW, that adheres to the interface specification of the sensor/actuator and then "translates" this in the respective ROS message type.

The same basically holds for a micro controller, however, there you might have the chance to decide on the interface specification yourself.

edit flag offensive delete link more

Comments

When we create nodes, subscribers,and publishers etc, we create it in our PC. SO when we publish, only our PC knows. SO we do not send the info to the robot when we publish. How does the robot knows the info?

alienmon gravatar image alienmon  ( 2016-10-13 03:35:17 -0600 )edit
  1. Where does all these translating process happen? in the actual robot or in our PC?
alienmon gravatar image alienmon  ( 2016-10-13 03:37:37 -0600 )edit
  1. How does this reading info from the robot's sensors happen? I know that in simulation , the robot will publish message containing the sensor readings to certain topics.

How is it in real robot? How does the real robot know how to publish things to topics, if it does not have ROS installed in it?

alienmon gravatar image alienmon  ( 2016-10-13 03:39:41 -0600 )edit

see edit above.

mgruhler gravatar image mgruhler  ( 2016-10-13 04:38:27 -0600 )edit

Thanks for your reply. But I'm still confused. When writing code , we publish message to a topic, and we do not send it to the robot. How does the robot know the information/msg since the robot does not have subscriber to the topic.

alienmon gravatar image alienmon  ( 2016-10-13 04:59:27 -0600 )edit

I meant when we publish message , it's only to the ros master which is our own pc. And i don't remeber sending it e.g. cmd_vel to the robot. Where(in the code) does this(sending data from pc to robot , which is different from publishing message to a topic) happen?

alienmon gravatar image alienmon  ( 2016-10-13 05:05:27 -0600 )edit
2

you have a ROS node which subscribes to this topic and this then is the HW driver which translates it to whatever the robot understands.

mgruhler gravatar image mgruhler  ( 2016-10-13 05:17:35 -0600 )edit

Your explain is very well. Firstly, thank you. But, I'm wondering about turtlebot3 communication protocol. I try to understand the Turtlebot3 code for PC, and OpenCR code for MCU. On Turtbot3-PC side, the robot generates and Twist message and publish on cmd_vel. But other side (MCU), there is an ardunio code and there are some ROS libs which are included. Code here. I am confused. Do you know about this achitecture?

gokhan.acer gravatar image gokhan.acer  ( 2020-05-12 10:50:51 -0600 )edit
7

answered 2016-10-13 11:58:59 -0600

Mark Rose gravatar image

updated 2016-10-13 12:00:42 -0600

As mig says, the answers depend on your hardware.

Example 1 (my robot):

  • Raspberry Pi, on the robot, runs ROS.
  • Arduino-style microcontroller talks to sensors and motors, does not run ROS.
  • ROS node (ros_arduino_python) listens for /cmd_vel messages, decides motor speeds, and sends over a serial protocol to Arduino.
  • Arduino sketch (ROSArduinoBridge.ino, source in ros_arduino_bridge package) listens for motor speed commands, controls motors, and sends sensor values over serial protocol to RPi.
  • ros_arduino_python receives sensor values and publishes as ROS messages.

Example 2 (hypothetical robot):

  • Robot runs some Linux microcontroller, perhaps Raspberry Pi or Odroid, running ROS.
  • Fancy motor controller connected to microcontroller using USB connection.
  • Some sensors connected via I2C to microcontroller.
  • ROS node on robot listens for /cmd_vel, decides motor speeds, and sends to motor controller.
  • ROS node on robot talks I2C to sensors and publishes ROS sensor messages.

In both cases the ROS nodes on the robot and ROS on your PC communicate over WiFi, presumably. You could run the ROS master on the robot (that's what I do) or your laptop.

What is your hardware?

edit flag offensive delete link more

Comments

Hi ,thanks for your helpful answer.

My hardware is a drone(crazyflie). I didn't remember installing ROS in the crazyflie itself, and afaik it's not preinstalled in the drone. So I assume that the robot does not have ROS installed in it.

alienmon gravatar image alienmon  ( 2016-10-13 20:27:00 -0600 )edit

Since the robot does not have ROS installed , so all the nodes are my PC's nodes. What I am confused is : I don't remember sending info to the robot. I only publish message to topic. And all topics are in my PC.

alienmon gravatar image alienmon  ( 2016-10-13 20:28:35 -0600 )edit

Can you please give one more example on: robot that does not have ROS installed in it?

So, all the nodes running in PC, and there's no node in the robot. How does the sending information to the robot happen? It does not happen during publishing message right?

Thanks

alienmon gravatar image alienmon  ( 2016-10-13 20:30:27 -0600 )edit
1

Well, another possibility would be a smaller robot I have that uses an Arduino-type board that has built-in Bluetooth. A ROS node on the PC could handle the sending and receiving data to the robot. Probably a roll-your-own protocol to send motor commands and get sensor data back.

Mark Rose gravatar image Mark Rose  ( 2016-10-13 20:33:25 -0600 )edit
1

Once you get outside of ROS message/service communication, either you have to do the communication yourself (from a ROS node), or you have to use a ROS node that knows how to control the hardware (usually only for commercial robots).

Mark Rose gravatar image Mark Rose  ( 2016-10-13 20:34:25 -0600 )edit

I think I finally got what @mig said now. There's a ROS driver in our PC that subscribe to e.g. cmd_vel, translate this cmd_vel to data type that the robot understands, and send it to the robot.

alienmon gravatar image alienmon  ( 2016-10-13 20:47:52 -0600 )edit

Just want to reconfirm. pls correct me @mig@Mark Rose

  1. ROS running on robot and PC. All the info exchange happen through subscribe & publish

  2. ROS ONLY running on PC. There's a ROS driver in our PC which subscribes to needed message e.g. cmd_vel, TRANSLATE it, and SEND it to robot.

alienmon gravatar image alienmon  ( 2016-10-13 20:51:41 -0600 )edit
  1. ROS ONLY running on robot. So all the package involved e.g. navgation ,etc are in the robot itself .

Those are all possible right?

alienmon gravatar image alienmon  ( 2016-10-13 20:58:39 -0600 )edit
0

answered 2016-11-15 00:25:39 -0600

chrisalbertson gravatar image

The answers you are getting are good. But long. A short answer is

Your question: "How does the information in ROS get to the physical hardware inside your robot?"

There are two answers:

1) You robot might have a computer inside of it that is running ROS. Either an X86 "PC" type computer of a smaller ARM based computer. This is common with larger robots or,

2) Your robot might have a small micro controller that is way to small to run Linux and ROS. So you make a radio link and run a ROS Bridge on both the PC and the uP inside the robot. ROS Bridge allows a ROS Node to run on the uP. (You can Google ROS Bridge for more info.

That is the end of my short answers

Now a comment: ROS allows all kinds of variations. You might even have multiple computers inside your robot some running Linux and ROS and others being just simple micro controllers perhaps running some RTOS (real time OS) or not. Or to save space and power in the robot you can move one or more of the ROS computers physically outside but functionally inside the robot using WiFi. You can mix and match. . For your purposes. with a uP inside the robot and ROS only running on the desktop you'd be looking at ROS Bridge

edit flag offensive delete link more

Comments

Just a note: if you intend to 'close the loop' over your radio link, I would actually go for a wired connection. As stable as you might get your radio, a wired connection will always be more performant, robust and have more predictable performance characteristics.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-15 02:11:52 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-10-13 02:46:51 -0600

Seen: 3,373 times

Last updated: Nov 15 '16