Robot Notes
Robot Notes
source /opt/ros/noetic/setup.bash
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc
We can simply run roscd. You can see the current directory of your prompt is changed to where we
installed Noetic: /opt/ros/noetic
echo "deb http://packages.ros.org/ros/ubuntu focal main" | sudo tee
/etc/apt/sources.list.d/ros-focal.list
Resource
https://varhowto.com/install-ros-noetic-ubuntu-20-04/
Pre-requisite knowledge
The ROS graph
The original challenge with robots was the fetch problem. In the “fetch an item” problem, the robot’s
task is to navigate a typical home or office environment, find the requested item, and deliver it to the
requested location.
a ROS graph node represents a software module that is sending or receiving messages, and a ROS graph
edge represents a stream of messages between two nodes.
The circumstances leading up to the crash can often be recreated by logging the messages entering a
node and simply playing them back later inside a debugger.
Nodes as small single-purpose programs within a larger robotic system. One-way nodes communicate
with each other is by using messages. These messages are passed via channels called topics.
Nodes that send data are known as publisher nodes, and nodes that receive data are known as
subscriber nodes. The node that keeps track (i.e. a register) of which nodes are publisher nodes and
which nodes are subscriber nodes is called the ROS Master. Without the ROS Master, nodes would not
be able to communicate with each other.
Nodes that are interested in a particular piece of data subscribe to the relevant topic; nodes that
generate data publish to the relevant topic. There can be multiple publishers and subscribers to a topic.
You can think of topics like a middleman between publishers (nodes that generate data) and subscribers
(nodes that receive data). The communication is anonymous, so nodes do not know what nodes they
are sending data to/receiving data from.
A good analogy is to think of YouTube (or even other social media sites like Twitter or Instagram).
YouTubers (publisher nodes) publish videos (messages) to a channel (topic), and you (subscriber node)
can subscribe to that channel (topic) so that you receive all the videos (messages) on that channel
(topic). YouTube (ROS Master) keeps track of who is a publisher and who is a subscriber. One thing to
keep in mind is that (in contrast to YouTube) in ROS there can be multiple publishers to the same topic,
and publishers and subscribers don’t know each other.
roscore
roscore is a service that provides connection information to nodes so that they can transmit messages to
one another. Every node connects to roscore at startup to register details of the message streams it
publishes and the streams to which it wishes to subscribe. When a new node appears, roscore provides
it with the information that it needs to form a direct peer-to-peer connection with other nodes
publishing and subscribing to the same message topics. Every ROS system needs a running roscore, since
without it, nodes cannot find other nodes.
Starting ROS
catkin
catkin is the ROS build system: the set of tools that ROS uses to generate executable programs, libraries,
scripts, and interfaces that other code can use.
Getting started with ROS cli
roscore &
Turtlesim
Turtlesim isn’t the most exciting application, but it is a popular tool for learning the basics of ROS before
working with real robots. You can think of the turtle as an actual robot. All of the things you can do with
this turtle, you can do with a real, physical robot.
rosrun
ex rosrun <Name of the package> <Name of the node>
rosrun turlesim turtlesim_node