-
-
Notifications
You must be signed in to change notification settings - Fork 2
1. Introduction to ROS
ROS is an open source framework for developing robotics software. It is short for robot operating system, but it is not truly an operating system like Ubuntu or Windows. Instead it is "middle-ware" that provides some common things needed for a robotic system. ROS runs on top of Ubuntu Linux. Robots typically run many pieces of software ranging from high level autonomy like computer vision to lower level software like device drivers and control loops. In many cases, this software is even distributed across computing devices such as on peripheral microcontrollers driving sensors or on high powered servers communicating with onboard computers via radio. ROS provides the following capabilities:
- Interprocess communication via publisher-subscriber model
- Communication between distributed processes over serial, network, and other types of connections
- Its own build system (Catkin) that isolates build environments and provides simple dependency resolution
- Package management to rapidly pull in and run existing open-source ROS code and libraries for your robot
- Tight integration with the Gazebo simulation environment
- Fantastic tooling and infastructure for things like IK, motion planning, visualization, and localization
- Much more
ROS is the standard ecosystem for research in robotics and there is a huge, very active community behind it. This also means there are lots of online resources to learn about ROS.
Q: Are we limited to only using ROS libraries and packages since we are using ROS?
A: No. ROS provides packages for many common robotics libraries so that they can be used with ROS easily. In some cases, these libraries even provide nodes that can be executed and used. A great example of this is the ARUCO library and OpenCV. We could install OpenCV as usual, link it with Catkin, and make use of the ARUCO functions in our code. However, the ROS package for ARUCO actually provides a node that subscribes to camera images and outputs detections, which lets the user avoid even writing code.
Q: What about vice versa? Can ROS libraries be used outside of ROS?
A: Not always. A lot of ROS libraries fundamentally rely on the infrastructure of ROS itself, and thus can only be used with ROS. This means that by using ROS we gain access to a wealth of really great software that top robotics researchers have developed that we can't use otherwise.
Q. What does it mean for a program to be a "ROS program"?
A. Typically this would mean that the program is a process that is connected to the ROS network and registered as a node. This python program can be considered a basic ROS program:
import rospy
def main():
rospy.init_node('hello_world_node')
rate = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
hello_str = "hello world %s" % rospy.get_time()
print(hello_str)
rate.sleep()
if __name__ == '__main__':
main()
Q. How does the interprocess communication actually work?
A. It is implemented via UDP. There is a ROS master server which is configured by the enviornment variable ROS_MASTER_URI
which by default is set to localhost
. Each device must specify its ROS_IP
and connect to the master server, which knows about the various channels of information and the running nodes across devices. The model of communication is similar to LCM, but unlike LCM it supports massive payloads like full HD images.