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?
Originally posted by Mark Rose with karma: 1563 on 2016-10-13
This answer was NOT ACCEPTED on the original site
Post score: 7
Original comments
Comment by alienmon on 2016-10-13:
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.
Comment by alienmon on 2016-10-13:
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.
Comment by alienmon on 2016-10-13:
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
Comment by Mark Rose on 2016-10-13:
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.
Comment by Mark Rose on 2016-10-13:
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).
Comment by alienmon on 2016-10-13:
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.
Comment by alienmon on 2016-10-13:
Just want to reconfirm. pls correct me @mig @Mark Rose
ROS running on robot and PC. All the info exchange happen through subscribe & publish
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.
Comment by alienmon on 2016-10-13:
3. ROS ONLY running on robot. So all the package involved e.g. navgation ,etc are in the robot itself .
Those are all possible right?
Comment by alienmon on 2016-10-13:
on ANY cases, when we want to control the actuator e.g. motor, we need to translate it to the type that the actuator understand e.g. int.
This can be done in:
- robot's callback function. e.g. when the robot's subscriber receive cmd_vel , the callback funtion extract the message & write to motor
Comment by mgruhler on 2016-10-14:
@alienmon yes
@Mark Rose Thanks for helping out here :-) The examples clarified my points.
Comment by hasnain on 2018-03-29:
Hi, I am really new to ROS. Can you please refer any tutorials or steps that I can follow to understand and implement this. I need to do this on my robot car. Thank you