Embedded Motion Control 2013: Difference between revisions
Jlunenburg (talk | contribs) No edit summary |
No edit summary |
||
Line 70: | Line 70: | ||
= Goal = | = Goal = | ||
{{: | {{:Embedded_Motion_Control_2013/Goal}} | ||
= Hardware = | = Hardware = | ||
Line 77: | Line 77: | ||
= Installation = | = Installation = | ||
{{: | {{:Embedded_Motion_Control_2013/Installation}} | ||
=Getting Started= | =Getting Started= | ||
Line 89: | Line 89: | ||
= FAQ = | = FAQ = | ||
{{: | {{:Embedded_Motion_Control_2013/FAQ}} |
Revision as of 15:39, 30 August 2013
Guide towards the assignment
'A-MAZE-ING JAZZ'
Introduction
This course is about software design and how to apply this in the context of autonomous robots. The accompanying assignment is about applying this knowledge to a real-life robotics task in which ROS will be the standard software framework.
Course Schedule
Lectures will be given on Mondays from 10.45 - 12.30 in Gemini-Zuid 3A12. The course schedule is as follows:
September, 4th | Introduction | Assignment and basic computer setup |
September, 11th | Localization | C++ and ROS Concepts |
September, 18th | Navigation | Software design |
September 25th | Corridor competition | |
October, 2nd | Separation of Concerns: the 5 C's | |
October 9th | State estimation | Whole-body motion planning and control |
October 16th | Intelligent agents | |
October 23th | Final competition |
Pico test schedule, maze
In order to test your software on the Pico robot, each group has one one hour time slot a week available, on either Wednesday or Thursday. You can reserve your test slot in the table below. Make sure to keep at least one hour in between you slot and the previous and next ones, since Pico needs some time to recharge in between the time slots!
Date | Time | Group |
Wednesday June, 13th | 09:00 - 10:00 | Group 9 |
Slides
The slides of the various lectures will be available a.s.a.p.
Goal
The goal of the assignment is to get the real-time concepts in embedded software design operational.
The concrete task that has to be solved is to let the PICO robot find his way out of a maze. The final demonstration by each participating group of 4-5 students will be performed during a contest, the winner of which is the group that exits the maze in the shortest amount of time. To prepare for this competition the following guidelines have to be considered:
- to test with PICO and to prepare for the final contest, a simulator will be made available that mimics the in and outputs to the real robot. Specifics of this simulator will be presented in the first lecture on September 4th
- the maze of the final competition will be constructed just before the competition. The maze presented in the simulator is therefore different from the real one used in the final contest.
- both on the real and simulated PICO robot, three sources of sensor information will be available to perceive the environment and to derive the state of the robot:
- laserdata provided by the forward pointing laser scanner,
- images captured by the monocular camera,
- odometry provided by the base controller
- the robot can be actuated by sending information to the base controller
- during the final contest, it is highly imperative that the PICO robot refrains from colliding with the walls in the maze. Colliding with the walls will result in severe time-penalties.
- the walls of the maze will contain several types of pointers to the exit, which can potentially help PICO to speed up execution of the task Click here for a pdf file containing the arrow we will use. We also captured PICO's camera topics in a bag file while the robot was looking at the arrow. You can play this bag file as follows:
rosbag play 2013-10-08-15-35-04.bag
The topics /pico/camera and /pico/camera_info should then become available. For example, while playing the bag file, userosrun image_view image_view image:=/pico/camera
to view the camera images.
Corridor Competition
An intermediate review will be held on May 16th, during the corridor competition. During this challenge the students have to let the robot drive through a corridor and then take the first exit. The precise location of this exit will not be given in advance. Some facts:
During the final contest, the groups are expected to give a short (5 minute) presentation about their progress and design decisions. During the corridor competition no presentation is expected.
Hardware
The moving Jazz robot with monocular camera and laser range finder with a working ROS interface. In addition, we provide a Jazz simulator for offline testing.
Installation
This manual describes how to the install the necessary and sufficient software to start programming the Pico robot.
Ubuntu
Download Ubuntu 12.04 using these direct links: 32-bit or 64-bit. Then go to this page and follow the instructions to create a bootable USB stick. Reboot your computer with the newly created USB stick, and install Ubuntu. If you want to keep using Windows next to Ubuntu the most easy way is to have a dual-boot system, i.e., during startup you can choose to boot either Ubuntu or Windows. Of course you can also bring your notebook to the ICT servicedesk and ask them to install Ubuntu (but mention that you need version 12.04, not 14.04).
Ubuntu Terminal
Most of your interaction with Ubuntu will be done through the terminal, the number-one way of interacting with Ubuntu using your keyboard. A terminal can be started as follows: Application -> Accessories -> Terminal, or by pressing ctrl-alt-t. It might be a good idea to drag the terminal icon in the menu to the Ubuntu panel, as you will be using it a lot. Read more
ROS
In this project we will use the Robotic Operating System (ROS) which aids the testing and development of robot software. ROS provides a nice open-source framework for dealing with the communication between and management of different modules, and comes with a large amount of software that can be used out of the box, including device drivers, libraries, low- and high-level software, visualizers and more. More information about ROS and its goals can be found here.
We will be using ROS Groovy. Install ROS Groovy using the installation instructions on the ROS wiki. After the installation, you should do the ROS tutorials. The ROS tutorial can be found here. In some of the tutorials you can choose between catkin and rosbuild (for example in this tutorial. Make sure you select rosbuild (above the content text box).
Before you continue, make sure you understand the basic ROS concepts, such as:
- package
- node
- topic
- subscriber
- publisher
- message
- callback function
- ...
In addition it is important to know the concept of the ROS_PACKAGE_PATH. ROS_PACKAGE_PATH is a variable which informs ROS on the location of your packages. ROS will only be able to find packages which are located in a folder which is part of your package path! To print the value of the ROS_PACKAGE_PATH variable, you can simply type:
echo $ROS_PACKAGE_PATH
in a terminal.
SVN
In this project, an SVN will be used for sharing and versioning the software within your group. Every group has its own space on the SVN, and an account which has only permissions for that particular part. Make sure you read the following SVN instruction carefully! Not reading them might cost you a lot of time in the end!
Environment Set-up
So far we've installed ROS and created a local copy of the SVN. However, before you can start working, you need to do some additional set-ups to make sure Ubuntu knows where to find all ROS-related packages, scripts, etc. More specifically, every time you start up a terminal, the correct environment variables need to be set. The file .bashrc in your home directory is your friend: it's a script which runs every time a a new terminal is opened. We basically need to add some lines to this file, so open the file with a text editor:
gedit ~/.bashrc
Append the following text to the end of the file:
source /opt/ros/groovy/setup.bash
This will set-up all ROS-related scripts etc. every time you open a terminal. Furthermore, ROS needs to known where your software is located. Therefore, also add the following command to ~/.bashrc:
export ROS_PACKAGE_PATH=~/ros/emc:$ROS_PACKAGE_PATH
That's it. Next time you open a terminal, .bashrc is executed, which will in turn execute the script and set the path specified. This command tells ROS to look in the emc/ros folder whenever it is looking for your code. Since the script only runs when a new terminal is opened, the changes are not active in your current terminal. If you want to see it working directly without starting a new terminal, explicitly source .bashrc from the terminal:
source ~/.bashrc
This command forces the terminal to reload all variables without restarting the terminal. To see whether it worked, try one of commands that are now at your disposal. For example, change your directory to the roscpp package:
roscd roscpp
Integrated Development Environments
To keep the code in your packages clear and manageable, it is advised to use an Integrated Development Environment (IDE) to edit your C++ code. Two editors that are commonly used are Qt Creator and Eclipse. Both of these editors have the advantage of understanding you code up to some extend. This means they can be used to, e.g., autocomplete names of variables and functions or get compilation error message in a nice way. We recommand using Qt or Eclipse. Continue here.
Gazebo
We will use the robot simulator [Gazebo] to simulate the PICO robot and its environment. This includes simulation of the physics and sensors of the robot. To install Gazebo:
- Open a terminal (ctrl-alt-t)
- Setup your computer to accept software from packages.osrfoundation.org:
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'
- Retrieve and install the keys for the Gazebo repositories:
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
- Update apt-get and install Gazebo.
sudo apt-get update
sudo apt-get install gazebo
- Initialize.
gzserver
Wait until you get a message like Publicized address: ....
You can try if your Gazebo installation was successfull by either executing a gazebo client on a seperate terminal:
gzclient
Or by running the program alone:
gazebo
Getting Started
To get started, please do the following tutorials:
- C++ tutorial
- ROS tutorial Note that you have already installed and configured your ROS environment, so you can skip the first tutorial. It is advised to work in your group folder, i.e., ~/ros/group_?.
- Getting started with the Jazz simulator
- Using Jazz
FAQ
Ubuntu
I try connect to the svn but I need the GNOME keyring password.
- Go to console
cd ~/.subversion
nano config
- Go to [auth] and enter below [auth] the following "password-stores =".
- Press ctrl+x and save the file with the same name (config).
- Open a new console and now it works fine.
I start the jazz_simulator but my maze is blinking very fast (HP Elitebook 8540w).
- Go to "System" --> "Administration" --> "Hardware Drivers".
- Remove the "ATI/AMD proprietary FGLRX graphics driver" (Ubuntu recommended to install this)
- Restart Ubuntu
Gazebo
Gazebo keeps crashing
- Try to run it in gdb: enter
gdb gzserver
to start gdb and enterrun
to actually start the server. The same holds for the client (visualization):gdb gzclient
and again typerun
to start it.
PICO does not drive and does not publish any odometry
- Try rosmaking pico-gazebo with pre-cleaning:
rosmake pico_gazebo --pre-clean
RViz
RViz gives a segmentation fault and crashes
Try to run RViz in gdb:
gdb /opt/ros/groovy/lib/rviz/rviz
And then type
run
You can load an RViz configuration using File -> Open Config and then navigating to the correct file, e.g. in pico_visualization.
I cannot display odometry information in RViz
In order to visualize the odometry information, RViz needs a tf (transform) from /odom to /base_footprint which is not published by the simulated controller. Since this tf is not available on the real robot either, we will not add it to the simulator. If you really want to visualize the information, or need the transform for some other reason, you will have to publish the tf yourself. See http://ros.org/wiki/tf for more info.
I've got an error with RViz and it doesn't start
If the error looks like this:
The program 'rviz' received an X Window System error. This probably reflects a bug in the program. The error was 'BadDrawable (invalid Pixmap or Window parameter)'. (Details: serial 22 error_code 9 request_code 136 minor_code 3) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) [rviz-6] process has died [pid 1978, exit code 1].
The following solutions can be tried:
In section 3.4 Segfault during startup from RViz troubleshooting page.
Open a terminal without Gazebo running and just type:
export OGRE_RTT_MODE=Copy
If this does not work, just follow the next steps:
1 rosrun rviz rviz --sync ( add the --sync it even says in the error message) 2 don't give up even with sync it will fail,maybe...try it 2-3 times 3 if it still fails do rosmake rviz rviz and repeat step 1
Graphics drivers issues
Using the wrong graphics drivers may cause Gazebo and/or rviz to crash. To solve this problem, please follow the following steps:
- First try installing/updating the graphics driver using Hardware Drivers (System->Administration->Hardware Drivers)
- When this does not solve the problem and you are using an ATI video card (for e.g. the 'shuttle' PC):
- If installed, uninstall the proprietary ATI driver in Ubuntu
- Download the Xorg ATI driver install script from http://www.2shared.com/file/meVhVXNB/ati-driver-installer-11-12-x86.html
- Install the driver with
- >> sudo ./http://www.2shared.com/file/meVhVXNB/ati-driver-installer-11-12-x86.run
- Select the default options
- Restart PC
You can test the driver from working properly by launching AMIGO in Gazebo and looking at the pointcloud data. This data should be refreshed when AMIGO for instance drives around or if you draw a big block in front of AMIGO.
Global Q&A
Group 2
Q: Can it be assumed that all corners are 90 degrees?
A: Yes, it can (but be aware that in practice it may be 88 or 92 degrees as well...).
Q: Do arrows insinuate driving direction only or do they provide information on next crossroads as well?
A: The camera can only look in front of the robot meaning that arrows to the left or right in a corridor are hard to recognize. They will be placed in spots where you drive towards them. They only give information about the driving direction at the location of the arrow.
Group 1 - Wouter
Q: There was a ubuntu update (2013-10-11) which also updated gazebo, now my I cannot spawn any maps anymore.
A: To be certain; first remove all folders from ~/ros/emc/general/. Then do svn update. Now make all the nodes rosmake jazz_description jazz_gazebo jazz_visualization tue_gazebo_plugins gazebo_map_spawner. You should be able to spawn mazes again by now. However when you start rviz you will see that pico has errors regarding the RobotModel and the LaserScan, to fix this set the fixed frame in Global Options to /pico/base instead of /pico/odom
Image_view
Q: When trying the command :rosrun image_view image_view image:=/pico/asusxtion/rgb/image_color
i get the following response:
[rospack] Error: stack/package image_view not found
A: You need to install image_view:
sudo apt-get install ros-groovy-image-view