Odometry
Odometry
message is used for /odom
topic.
- The Robot’s “belief” of where it is, and what it is doing.
- Based on sensors in the base, including possibly the motors, a GPS, a magnetometer etc.
- Odometry is published as topic /odom and the message definition is called nav_msgs/Odometry
- nav_msgs/Odometry
- Header - standard header
- pose - where does the robot thinks that it is (including Covariance - how sure is it?)
- twist - how does it think it is moving (also with a covariance)
catkin
- catkin is the ROS build system
- It’s quite complicated and related to CMAKE
- Treat it like a black box
Workspaces
- A subdirectory in which you will be doing your ROS work
- You need only one and it will be called catkin_ws/
- You should already have it on your linux install, but here’s how you would create it otherwise:
$ cs
$ catkin_init_workspace
- From time to time you have to build things, called “doing a build or make”
- Use the alias
cm
.bashrc
- A “hidden” file in your home directory
- Contains a series of shell commands that are executed each time you start a shell
- It is
populated
with lots of useful stuff by the installation of ROS
- Any commands you want run each time will be placed there
- source
~/.bashrc command
reads the file and executes it as if you typed it into bash
- Key environment variables have to be defined in .bashrc
example
$ source ~/catkin_ws/devel/setup.bash
$ export ROS_MASTER_URI=http://localhost:11311
$ export ROS_HOSTNAME=localhost
$ export TB3_MODEL=burger
$ export TURTLEBOT3_MODEL=burger
ROS Packages
- A complete “application” or “tool”, stored as a directory tree in a standard layout
- Analogous to a gem in ruby, or a library in Java
- Can be created like this:
$ catkin_create_pkg my_new_package rospy
Contents of a package directory
package.xml
# describes all the things that are in the package
CMakeLists.txt
# describes how to “build”
./messages
# descriptors of the messages
./scripts
# contains all the python source files
./launch
# contains all the .launch files
Python programs
- Most of your python code will implement nodes
- You should put them into the ./scripts directory
- Name them *.py and give them execution file property:
chmod +x myfile.py
rosrun and roslaunch
# run a certain program from a certain package
$ rosrun package program.py
# "execute" that launch file
$ roslaunch package file.launch
Names, Namespaces and Remapping
- Everything in the ros world has a name that looks like a file path
- For example:
/cmd_vel
is a topic name
- To allow flexibility,m you can remap a name to another name on the command line, e.g.
$ ./image_view image:=right/image
roslaunch
- Many real ROS applications have multiple nodes
- To save time having to start each one separately
- (And for many other reasons)
- A .launch file contains instructions on what to launch and in what order
- You run it with the
roslaunch
command. It will start roscore
if necessary
- See TF Tutorial
- Coordinate system
- There will/can be many
- Some of the components might move (an arm for example)
- tf system periodically broadcasts the current relationship between coordinate systems
- Quaternions
Poses, Positions, and Orientations
- Handy and very common term to mean: 3d position and 3d orientation of something
- (Not velocity, just the position)
- Usually the transform between the robot coordinate frame and the maps coordinate frame
tf
- Frames: Essential and complicated concept
- Find the change in position and orientation between two coordinate frames
- High level: a way to compute relative coordinate systems
tf
is a central package of ROS which computes transformations for Frames
- If I know a position relative to the room, what is that position relative to the robot?