BeBot documentation - Heinz Nixdorf Institut

Transcription

BeBot documentation - Heinz Nixdorf Institut
HEINZ NIXDORF INSTITUTE
University of Paderborn
BeBot - Software Installation Guide
Version 1.4
BeBot - Software Installation Guide
Markus Koester,
Stefan Herbrechtsmeier
c
Copyright 2009
- 2011
HEINZ NIXDORF INSTITUTE
University of Paderborn
System and Circuit Technology
F”urstenallee 11
D-33102 Paderborn, Germany
This work is licensed under the Creative Commons Attribution-Noncommercial-Share
Alike License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to
Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
i
Contents
1 BeBot Hardware
1
2 Installation of the Software Development Environment
2.1 Linux Installation . . . . . . . . . . . . . . . . . . . .
2.1.1 Wubi . . . . . . . . . . . . . . . . . . . . . . .
2.1.2 VirtualBox . . . . . . . . . . . . . . . . . . .
2.2 Software Installation . . . . . . . . . . . . . . . . . .
3 Software Development for BeBot
3.1 Connecting the BeBot with the Host System
3.2 Settings for BeBot Programming in Eclipse .
3.2.1 Download example source code . . .
3.2.2 Create new C/C++ project . . . . .
3.2.3 Setup cross compiler . . . . . . . . .
3.2.4 Setup Player framework (optional) .
3.2.5 Import source files . . . . . . . . . .
3.2.6 Compile project . . . . . . . . . . . .
3.2.7 Setup file transfer . . . . . . . . . . .
3.2.8 Remote system exlporer . . . . . . .
3.2.9 Setup remote debugging . . . . . . .
3.3 Simulate the BeBot with Player/Stage . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
3
4
16
.
.
.
.
.
.
.
.
.
.
.
.
18
18
19
20
20
20
22
22
23
24
25
25
26
4 Installation and usage of the Build Environment
28
4.1 Build Environment Installation . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2 Root File System Generation . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Cross Compiler Toolchain Generation . . . . . . . . . . . . . . . . . . . . . 29
5 System utilities
5.1 BeBot . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.1 Obstacle avoidance - avoid . . . . . . . . . . .
5.1.2 Wiimote remote control - wiibot . . . . . . . .
5.2 Player . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.1 Object follower - follow . . . . . . . . . . . . .
5.3 FPGA . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.1 Register setup - fpga . . . . . . . . . . . . . .
5.3.2 Expansion connector - /dev/firmware/fpga.bit
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
30
30
30
30
30
30
30
31
31
ii
6 System Update
6.1 USB device interface
6.2 Serial line . . . . . .
6.3 Preperations . . . . .
6.4 Flash programming .
Contents
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
33
33
33
34
34
1
1 BeBot Hardware
This chapter provides a brief introduction to the hardware of the BeBot. An overview is
given over the most important system specifications and the communication and navigation possibilities.
The BeBot is based on a powerful ARM processor. The integrated CPU is an Marvell
PXA270 at 520 MHz (cf. Figure 1.1). Additionally to the CPU the robot is equipped
with run-time reconfigurable hardware in form of an Field Programmable Gate Array
(FPGA), which is directly connected to the camera module. Thus complex algorithm
such as video processing can be efficiently implemented and executed in hardware. The
operating system can be installed in 64MB flash memory (cf. Table 1.1) or alternatively
in a external USB memory stick. The whole system offers 64MB of internal RAM.
Application
int. Name
Size Flash Memory Address Range
Bootloader
uboot
768kB
0x00000000 - 0x000c0000
Bootloader Configuration Data env
256kB
0x000c0000 - 0x00100000
Kernel
kernel
3MB
0x00100000 - 0x00400000
Root File System
rootfs
40MB
0x00400000 - 0x02c00000
User Data
data
20MB
0x02c00000 - 0x04000000
Table 1.1: Address ranges of the flash memory
The robot can communicate with the outside world in different ways. In the initial state
(without any operating system) the robot offers a serial link (RS232). After installing a
bootloader and the standard operating system, the user can access the robot by a console
via the RS232 link. Additionally, the robot can be accessed via Bluetooth and SSH (cf.
Chapter 3) if the operating system is configured accordingly. By using a WLAN USB
stick the robot is able to establish a WiFi connection.
The drive and position of the robot in space is captured by a gyroscope and a 3-axis
accelerometer. In co-operation with the IR sensors and the camera the robot is capable
of navigating in its environment. The 12 IR sensors (two on each side, one on each corner
of the robot) allow for a 360 object detection and distance measurement. The forward
facing camera module enables to process image data of the environment.
2
1 BeBot Hardware
Figure 1.1: BeBot-Hardware: CPU (1), RAM (2), Flash (3), Bluetooth Module (4), ZigBee Module (5), FPGA (6), RS232 Port (7)
3
2 Installation of the Software
Development Environment
This chapter descrips the installation of the software development environment.
2.1 Linux Installation
The development tools of the BeBot are based on a Linux operating system. There are
several different Linux distributions available. For the robot development a Kubuntu
10.04 (http://www.kubuntu.org/) distribution is recommended. If you are familiar
with Linux, you can use Ubuntu 10.04 (http://www.ubuntu.com/) as well. Basically,
there are two options to install the Linux OS:
Dual-boot system: Linux is installed as an additional operating system in a separate
partition of the hard disk. When booting the computer the user can select which
operating system to boot from a boot manager. This option is also referred to as a
dual-boot system. If the original OS of the target computer is Microsoft Windows,
the installation of Linux in a separate file of the Windows partition can be realized
by the Windows Ubuntu Installer (http://wubi-installer.org/).
Virtual machine: Virtualization is a technique that allows for installing multiple operating systems within an existing operating system. This is done by a program,
which is referred as a virtual machine. It emulates a computer with all its hardware. Although virtual machines do not achieve the performance of a real machine, they offer a great flexibility to the user. There is no need to switch between
different operating systems. Free tools for virtual machines are VMware (http:
//www.vmware.com) and VirtualBox (http://www.virtualbox.org).
The following section provides a step-by-step tutorial for installing Kubuntu Linux
using Wubi or VirtualBox.
2.1.1 Wubi
Wubi is an officially supported Ubuntu installer for Windows users that can bring you to
the Linux world with a single click. Wubi allows you to install and uninstall Ubuntu as
any other Windows application, in a simple and safe way.
Go to http://wubi-installer.org/ and download the latest version of Wubi.
Start Wubi and select your installation size, desktop environment, language, user name
and password. The installation size of the Linux partition should be around 30GB to
avoid a shortage in disk memory.
4
2 Installation of the Software Development Environment
2.1.2 VirtualBox
VirtualBox Installation
VirtualBox is a general-purpose virtual machine for x86 hardware offered from Sun Microsystems. Targeted at server, desktop and embedded use, it is the only professionalquality virtualization solution that is Open Source Software. The following steps describe
the installation of Kubuntu (Version 9.10) using VirtualBox (version 3.0.2). Basically, the
installation can be done using the default settings. If custom settings are required they
are explicitly mentioned.
1. Download and install VirtualBox
Go to http://www.virtualbox.org/wiki/Downloads and download the
latest version of VirtualBox for your target platform. Do a full installation including
USB Support and Networking. After the installation is finished start VirtualBox.
The following window appears.
2.1 Linux Installation
5
2. Create a new virtual machine
Create a new virtual machine by clicking on New followed by Next. Enter the
name of the virtual machine, e.g. Kubuntu-10.04-64. Select Linux for the operating
system and Ubuntu (64bit) for the version.
3. Specify the virtual memory
In the next window you can specify the memory used by the virtual machine. The
base memory size should be selected based on the available memory of the host
machine. Select an amount, which is equal or larger than 1024 MB.
6
2 Installation of the Software Development Environment
4. Specify the virtual hard disk
The following window is used to specify the virtual hard disk used in the virtual
machine. This can either be a real hard disk partition, or a large file on an existing
partition, which emulates the hard disk. Make sure that Boot Hard Disk (Primary
Master) is selected and choose Create new hard disk.
5. Select storage type
Click Next to proceed to the Virtual Disk Wizard. You can now select the hard
disk storage type. A dynamically expanding storage initially occupies a very small
amount of space on your physical hard disk. It will grow dynamically (up to the
size specified) as the Guest OS claims disk space. A fixed-size storage does not grow
and occupies the amount of memory as the size of the virtual hard disk. Select
Dynamically expanding storage.
2.1 Linux Installation
7
6. Specify the location and the size of the virtual disk
The size should be around 30 GB. Note that the file size of the virtual disk can grow
up to the size that you specify. So the file should be stored on a drive that offers
enough space.
The next window shows a brief summary of the virtual hard disk. Verify your
specification and click on Finish.
8
2 Installation of the Software Development Environment
7. Modify the video memory of the graphics adapter
Click on Display in the Details tab of the virtual machine. You can now select the
video memory size and 3D acceleration. It is recommended to increase the size to
64 MB to allow for larger video resolutions when working with the virtual machine.
Click OK to return to the main window, which shows a summary of the settings of
your virtual machine.
2.1 Linux Installation
9
8. Specify a shared folder for file exchange
In order to allow for an easy file exchange between your host operating system and
the virtual machine, it is possible to add a shared folder. Click on Shared Folder in
the Details tab of the virtual machine. Click on to add a new shared folder.
In the Folder Path field enter the path of the shared folder for your host operating
system. Enter vboxshare in the Folder Name field. Press OK to add the shared
folder.
10
2 Installation of the Software Development Environment
9. Enable a USB Bluetooth dongle
The integration of the Bluetooth hardware into the virtual machine is done by
enable a USB Bluetooth dongle in the virtual machine. Click on USB in the Details
to add a filter from devices and select the
tab of the virtual machine. Click on
corresponding Bluetooth USB Device. It could be necessary to restart your system
to enable the VirtualBox windows driver for the USB device.
Now, your virtual machine is ready for the installation of the Linux OS.
Kubuntu Installation
Go to releases.ubuntu.com/kubuntu/lucid/ and download the latest Desktop CD ISO
image of Kubuntu 10.04 for 64-bit. After downloading continue to install Kubuntu. If
you don’t use a virtual machine, you can proceed to step 2. If you use a virtual machine
in VirtualBox, continue with the following steps:
1. Mount the ISO-image of Kubuntu
After specifying the virtual machine click on Storage in the Details tab. In the
settings window select the CD icon. Click on the folder icon to open the virtual
media manager.
2.1 Linux Installation
11
In the virtual media manager click on Add and select the ISO image of Kubuntu,
which you have downloaded. Click Select to mount the image and to exit the virtual
media manager.
Verify that the ISO image is selected to be mounted as CD/DVD Drive. Click on
OK to leave the settings window. Switch on your virtual machine by clicking on
Start. In VirtualBox you can switch the keyboard and mouse between the host
12
2 Installation of the Software Development Environment
operating and the virtual machine by pressing the so called HOST-key. By default
this is the right CTRL-key of your keyboard. The HOST-key is also shown in the
right corner of the status bar of VirtualBox. If necessary you can modify it in the
settings of VirtualBox.
2. Start the installation of Kubuntu
When booting from the Kubuntu installation CD, you first have to select the language for the installation program.
Go to Install Kubuntu and press Enter.
After the boot process is finished a Welcome window appears. Select your preferred
language for the installation and click on Forward. In the following window you
need to specify your local time zone and in the next window you have to select your
2.1 Linux Installation
13
keyboard layout. After that the Prepare disk space window is shown, where you
need to select your target disk.
In the following window you need to enter your user account data. To avoid entering the log in information at every start of Kubuntu, you can select the Log in
automatically option.
14
2 Installation of the Software Development Environment
The next window shows a summary of your specification. Verify the settings and
press Install to start the installation process.
After the installation is finished the ISO-image must be removed in order to avoid
restarting the installation process at the next boot. Go to the menu of VirtualBox
and select Devices→CD/DVD Devices→Unmount CD/DVD Device.
Restart the virtual machine. After the boot sequence is finished you should see the
following screen.
2.1 Linux Installation
15
Before you install additional software you should update your system. Click on
the start menu (Kickoff Application Launcher) and enter term in the search field.
Press enter to open a terminal window and enter or copy the following code in the
terminal:
sudo apt-get update
sudo apt-get upgrade
Restart the virtual machine.
VirtualBox Guest Additions
To improve the integration of the virtual machine in your host operating system you can
install the so called Guest Additions. It enables an improved handling of the mouse, automatic screen resolution switching, clipboard functionality and shared folder functionality.
The installation compiles additional drivers for the virtual machine and therefor need
a build environment. Install it via a terminal and the following command.
sudo apt-get install build-essential
The installation is done by an ISO-image, which is provided by VirtualBox. Go to
the menu of VirtualBox and select Devices→Install Guest Additions... or press (HOSTkey)+d. A window appears indicating a recently plugged in device. Click on VBOXADDITIONS .... Now the CD-ROM folder is shown. Do a right click on VBoxLinuxAdditionsamd64.run and choose Open With→Other...
16
2 Installation of the Software Development Environment
In the Open with field enter kdesudo (in Ubuntu use gksudo instead) and click on OK.
Wait for the terminal window to appear. In the terminal enter the password of your user
account to start the installation. After the installation is finished you are asked to press
enter to close the window and restart your virtual machine.
Before you restart the machine you can create a shared folder that is linked to the one
from your host operating system. Click on the start menu (Kickoff Application Launcher)
and enter term in the search field. Press enter to open a terminal window and enter or
copy the following code in the terminal:
sudo mkdir -p /media/vboxshare
echo "vboxshare /media/vboxshare vboxsf uid=1000,gid=1000 0 0" \
| sudo tee -a /etc/fstab
Now a target folder in your virtual machine (\media\vboxshare) is created and mounted
to the shared folder of your host operating system. An entry in the \etc\fstab is created,
which automatically mounts the shared folder on each start of Kubuntu.
Restart your virtual machine to enable the guest additions and the shared folder.
2.2 Software Installation
In the following the necessary steps to install the design software package for the BeBot
are described. The package includes the following components:
• ARM cross compiler toolchain, which is based on the GNU compiler,
• Robot simulation platform Player/Stage.
• Integrated development environment Eclipse, which is used for software development
and debugging,
First install all necessary packages.
sudo apt-get install build-essential eclipse bluez-compat blueman subversion
Restart your system to enable all installed software.
The toolchain and robot software can be installed via an additional package source
echo "deb http://groups.uni-paderborn.de/sct/ubuntu/ lucid main" \
| sudo tee -a /etc/apt/sources.list.d/uni-paderborn.list
echo "deb-src http://groups.uni-paderborn.de/sct/ubuntu/ lucid main" \
| sudo tee -a /etc/apt/sources.list.d/uni-paderborn.list
sudo apt-get update
sudo apt-get install player player-dev stage
Download the toolchain and extract it
2.2 Software Installation
17
wget http://groups.uni-paderborn.de/sct/openrobotix/\
x86_64-linux-armv5te-linux-gnueabi-toolchain-openrobotix.tar.bz2
sudo tar -xvjf x86_64-linux-*-toolchain-openrobotix.tar.bz2 -C /
To start the software development environment Eclipse, go to the start menu and click
on Applications → Development → Eclipse. Additionally, you can start Eclipse from the
terminal by entering eclipse. When starting Eclipse, the workspace folder requires to be
selected. Here you can use the default folder or you can generate and select a new folder.
If you want your developed programs to be accessible from your host operating system,
you can generate and use a new folder in your shared folder.
In Eclipse some additional plug-ins require to be installed in order to allow for remote
debugging and automatic file transfer to the BeBot. To install the plug-ins start Eclipse
and go to Help→Install New Software.... The install window opens. In the Work With
field enter http://download.eclipse.org/releases/galileo and press enter. Now a list
of available plug-ins is loaded. When the download is finished, open the following folder
and select the listed plug-ins:
• Mobile and Device Development
– Eclipse C/C++ Remote Launch
– Remote System Explorer End-User Runtime
– Remote System Explorer User Actions
– Target Management Terminal
• Programming Languages
– Eclipse C/C++ Development Tools
Click on Next twice and accept the terms of the license agreements. Click Finish and
restart Eclipse after the installation of the plug-ins. Now all necessary software components are installed and ready to use.
18
3 Software Development for BeBot
This chapter is divided into two sections. Section 3.1 provides the necessary steps on
how to connect the BeBot to your host system. Section 3.2 describes the settings of a
BeBot project in Eclipse, and how to compile and execute a simple example program on
the BeBot.
3.1 Connecting the BeBot with the Host System
The BeBot is connected to the host system via a Bluetooth personal area network (PAN).
The BeBot becomes accessible via the IP-address 192.168.1.X, while X denotes the ID
of the BeBot. By using the network connection you can login on the BeBot via SSH to
start programs or transfer data to and from the BeBot. In order to connect to the robot
via SSH you always have to make sure that the Bluetooth PAN is established first. In
the following the preliminary steps are described to setup the Bluetooth PAN. Usually,
this setup is done only once and the system stores the settings, such that future PAN
connections can be established quite fast.
First, you need to add the BeBot as a Bluetooth device to your computer. There
are several Bluetooth vendors offering different drivers and software for the connection.
However, the procedures to add a device are very similar with each vendor and involve
the following steps:
1. The Bluetooth interfaces of the BeBot and your PC must be switched on and the
Bluetooth software must be configured to scan for new devices.
2. Once the BeBot device is detected, it can be added by transmitting a passkey. By
default the passkey of the BeBot is 1234.
3. The personal area network service must be added and configured to use a static
IP-address, e.g., 192.168.1.100 with subnet mask 255.255.255.0
Before adding the BeBot to your Bluetooth devices, you must configured the Personal
Area Networking (PAN). PAN provides ad hoc networking between the BeBot and the
computer. First, the IP address of your Bluetooth PAN network adapter requires to be
set to the static address 192.168.1.100 using subnet mask 255.255.255.0. Open a terminal
and run the following command.
echo -e "auto bnep0\n\
iface bnep0 inet static\n\
\taddress 192.168.1.100\n\
\tnetmask 255.255.255.0\n\
3.2 Settings for BeBot Programming in Eclipse
19
\tnetwork 192.168.1.0" \
| sudo tee -a /etc/network/interfaces
Note: If the IP address 192.168.1.100 is already in use by another adapter on an other
computer, you can change it to any available address in the address range 192.168.1.[100255].
While the setting of the static IP address only needs to be done once, the following
steps need to be performed whenever you connect a new BeBot to your host system.
You can use the graphical Bluetooth manager Blueman to establish a Bluetooth connection to the BeBot.
1. Turn on the BeBot you want to connect to. Note: The start-up sequence of the
BeBot takes a few seconds until the Bluetooth device is ready for a connection.
2. Start Blueman (Start menu Applications→Settings→Bluetooth Manager)
3. Select Adapter→Search. Now your computer searches for discoverable devices that
are in range. When the search is complete, the BeBot should appear in the devices
list of the tool. A device that has discovery turned off cannot be detected during a
search.
4. Right click on the BeBot and select Pair. Now, you have to enter the passkey for
the BeBot. Enter 1234 and click OK. After entering the passkey, your computer
tries to connect to the device to verify the passkey. When the passkey is correct,
the pairing is complete.
5. Right click on the BeBot and select Network Access Point.
You can connect to your BeBot via SSH by open a terminal and entering ssh [email protected],
where X is the ID of your BeBot. Leave the password empty to start the session. You
should now see:
root@bebotX:˜#
3.2 Settings for BeBot Programming in Eclipse
The integrated development environment Eclipse offers the CDT plug-in to enable the
development of C/C++ projects. If you are unfamiliar with C/C++ development in
Eclipse, you can go to http://www.eclipse.org/cdt/ to get basic information
about how to use the CDT plug-in of Eclipse for building, running and debugging a
program. To develop programs for the BeBot, the standard settings for C projects require
to be modified such that the build process involves the compilation by the cross compiler
toolchain. Before executing the resulting binary, it can be automatically transferred to the
BeBot via an SSH connection. This is done by the Target Management (RSE) plug-in. For
more information about the target management plug-in, go to http://www.eclipse.
org/dsdp/tm/. In the following the project settings are specified for a simple C project.
The steps to create a C project and how to import existing C source files are described.
20
3 Software Development for BeBot
3.2.1 Download example source code
Open a terminal window and download the example programs.
cd Downloads
wget http://groups.uni-paderborn.de/sct/bebot/demo.c
wget http://groups.uni-paderborn.de/sct/bebot/demo.cc
The C source (demo.c) code specify a program that rotate the BeBot at its position
and displays the IR sensor values of the BeBot and on screen. The C++ source code
(demo.cc) specify a Player implementation. In the next step the source file is imported
into a suitable Eclipse project.
3.2.2 Create new C/C++ project
Start Eclipse (Start menu Applications→Development→Eclipse IDE) and create a new
project. In Eclipse click on File→New→C Project or C++ Project. In the C Project
(C++ Project) window enter a project name, e.g. demo, and leave the other settings.
By clicking on Next you get a list of preconfigured configurations. By default there are two
configurations, one for development and debugging (Debug) and one for the final release
of your program (Release). Click on Finish to create the project.
3.2.3 Setup cross compiler
In the main menu go to Project→Properties. Open the C/C++ Build folder and click
Manage Configurations.... In the Manager Configurations window click New.... In the
Create New Configuration window enter BeBot Debug as name, select Debug under Copy
setting from behind Existing configuration and click OK. Repeat the last steps, but enter
3.2 Settings for BeBot Programming in Eclipse
21
as name and select Release under Copy setting from. In the Manager
Configurations window select BeBot Debug and click Set Active. Click OK to close the
window. In the C/C++ Build window click behind Configuration and select [ Multiple
configurations... ]. In the Select configurations window activate the two BeBot configurations and click OK. Open the Environment folder and click Add.... In the New variable
window enter SDK_PATH as Name, /usr/local/angstrom/arm as Value and click OK. Repeat this step for all the other variables from the following list.
BeBot Release
SDK PATH /usr/local/angstrom/arm
TARGET SYS arm-angstrom-linux-gnueabi
PATH ${SDK_PATH}/bin:${PATH}*
PKG CONFIG PATH ${SDK_PATH}/${TARGET_SYS}/usr/lib/pkgconfig
PKG CONFIG SYSROOT DIR ${SDK_PATH}/${TARGET_SYS}
* Eclipse automatically add the current value of the PATH to the PATH variable. Click
Edit... and remove it.
Open the Settings folder and select the Tool Settings tab. Here you can specify the
compiler and linker settings for your program. By default the compiler command is
gcc (g++ for C++ project). Change the compiler command to ${TARGET_SYS}-gcc
(${TARGET_SYS}-g++ for C++ project).
22
3 Software Development for BeBot
Select GCC C Linker and change the linker command to ${TARGET_SYS}-gcc (${TARGET_SYS}-g++
for C++ project). Finally, select GCC Assembler and change the assembler command to
${TARGET_SYS}-as. Click on Apply and close the window by clicking on OK. Now the
compiler is changed to the cross compiler.
3.2.4 Setup Player framework (optional)
In the main menu go to Project→Properties. Open the C/C++ Build folder and select [ All configurations] behind Configuration. Go to Settings and select the Tool Settings tab. Select Miscellaneous under GCC C Compiler (GCC C++ Compiler) and
add ‘pkg-config --cflags playerc‘ (‘pkg-config --cflags playerc++‘ at the end
of Other flags. Select Miscellaneous under GCC C Linker (GCC C++ Linker for C++
project) and add ‘pkg-config --libs playerc‘ (‘pkg-config --libs playerc++‘ for
C++ project) at the end of Linker flags.Click OK to take over the changes.
3.2.5 Import source files
In the main menu go to File→Import. In the Import window open the General folder,
select File System and click on Next. Browse to the source files Downloads in your home
directory. Select the demo.c (demo.cc for C++ project) file in the folder. Make sure that
your project is selected in the Into folder: field and click Finish.
3.2 Settings for BeBot Programming in Eclipse
23
In the main window you can see the imported files by double-clicking on the project
folder in the Project Explorer. Open demo.c (demo.cc for C++ project) by double-clicking
on the file in the Project Explorer. The source file shows the main function of the example.
3.2.6 Compile project
To compile the project click on
or go to Project→Build All.
24
3 Software Development for BeBot
Now a binary is compiled, which can be transferred and executed on the BeBot.
3.2.7 Setup file transfer
Eclipse is configured to allow for an automatic file transfer to the BeBot. This can done by
creating a suitable run configuration. In the main menu go to Run→Run Configurations....
Double-click on C/C++ Remote Application and wait for the configuration to be created.
Now, enter a name for the configuration, e.g. BeBot Remote. In the Main tab select your
project and specify the corresponding C/C++ application by clicking on Search Project.
Change the Remote Absolute File Path for C/C++ Application to /media/ram/demo. You
can change demo to the name of your project, but it is important to transfer the file to
the /media/ram/ folder on the BeBot.
Now the type of connection requires to be defined. Behind the Connection field click on
New.... In the New Connection window select Linux and click on Next. In the field Host
Name enter 192.168.1.X, where X must be replaced with the ID of your BeBot. Change
the Connection name to BeBotX and click Next. In the next window the subsystem
information for files is defined. Select ssh.files in the Configuration list and click on
Next. The following window defines the process handling. Select processes.shell.linux in
the Configuration list and click on Next. The next window is used to specify the shell
protocol. Select ssh.shells in the Configuration list and click on Next. Finally, the SSH
terminals are specified. Make sure that ssh.terminals is selected and click on Finish. You
return to the Run Configurations window. Change the connection to BeBot and click on
Apply.
Before you run your program for the first time, you have to make sure that the Bluetooth
connection to the BeBot is established in your host operating system and that the PAN is
initialized. The necessary steps to connect to the PAN are described in Section 3.1. After
3.2 Settings for BeBot Programming in Eclipse
25
establishing the Bluetooth connection you can run your program, by clicking on Run in
the Run Configurations window.
A login window appears, where you need to enter root as User ID and leave the
Password empty. You can select Save user ID and Save password to avoid any future
login windows. The binary is now executed on the BeBot and the output is directed to
the Console tab in the main window. A list of sensor data appears, which is updated
frequently. If you hold your hand close to one side of the robot, some of the data is
changed significantly. To terminate the program click on . If you want to run your
program again, you can now click on the black arrow of
to open a pull-down menu.
Click on BeBot Remote to run your program on the BeBot.
3.2.8 Remote system exlporer
Beside running a program, you can also start an SSH terminal connection or view the list
of processes of your BeBot. This can be done by the Remote System Explorer, which you
can access from the main menu of Eclipse. Go to Window→Open Perspective→Other....
In the Open Perspective window select Remote System Explorer and click on OK. In the
Remote Systems list you can now double-click on BeBot to get a list of options. With the
Remote System Explorer you can
• transfer files by SFTP,
• view or kill shell processes,
• launch a shell,
• or launch an SSH terminal.
E.g., to open an SSH terminal, do a right click on Ssh Terminals and select Launch
Terminal. The terminal is now started in a tab. To return to the C/C++ perspective go
to Window→Open Perspective→Other... and select C/C++.
3.2.9 Setup remote debugging
If you want to debug your code you can use a remote connection to the BeBot. In the
following the necessary steps are described to setup the remote debugging for the BeBot. From the main menu go to Run→Debug Configurations.... A Debug Configurations
window opens, where you can see the settings for the remote connection, which you previously specified. Go to the Debugger tab and change the debugger command in the GDB
debugger field to /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gdb.
26
3 Software Development for BeBot
Click on Apply to save the settings. Start remote debugging your code by clicking
on Debug. Now Eclipse asks you to switch to the Debug perspective. You can select to
remember your decision and click on Yes. Now the debugging perspective is opened,
where you can remotely debug your code.
To terminate your program you can click on . For future debugging you can click on
to open a pull-down menu, where you can select BeBot Remote.
the black arrow of
3.3 Simulate the BeBot with Player/Stage
Before you can start your simulation you have to download the BeBot simulation models.
Open a terminal and run the following command.
svn checkout svn://svn.berlios.de/openrobotix/playerstage/trunk/worlds
You can start the simulation with the command.
player worlds/bebot.cfg
3.3 Simulate the BeBot with Player/Stage
27
28
4 Installation and usage of the Build
Environment
This chapter describes the installation of the build environment openRobotix / openEmbedded. The environment allows the easy generation of software packages and image for
the system.
4.1 Build Environment Installation
Click on the start menu (Kickoff Application Launcher) and enter term in the search
field. Press enter to open a terminal window and enter or copy the following code in the
terminal.
Change the default shell to bash by reconfigure dash and answer with No.
sudo dpkg-reconfigure dash
Install all required packages.
sudo apt-get install sed wget cvs subversion git-core \
coreutils unzip texi2html texinfo docbook-utils \
gawk python-pysqlite2 diffstat help2man make gcc \
build-essential g++ desktop-file-utils chrpath
Setup the build environment.
cd ${HOME}
mkdir -p openrobotix/build/recipes
cd openrobotix
git clone git://git.openembedded.org/openembedded
cd openembedded
git checkout -b 2011.03-maintenance origin/2011.03-maintenance
cd ..
git clone git://git.openembedded.org/bitbake
cd bitbake
git checkout -b 1.12 origin/1.12
cd ..
git clone git://git.berlios.de/openrobotix
cp -r openrobotix/contrib/openrobotix/* build
4.2 Root File System Generation
29
4.2 Root File System Generation
Click on the start menu (Kickoff Application Launcher) and enter term in the search
field. Press enter to open a terminal window and enter or copy the following code in the
terminal to generate the root file system (rootfs) and the Linux image (uImage).
cd ${HOME}/openrobotix/build
source source-me.sh
bitbake openrobotix-image
4.3 Cross Compiler Toolchain Generation
Click on the start menu (Kickoff Application Launcher) and enter term in the search
field. Press enter to open a terminal window and enter or copy the following code in the
terminal to generate the cross compiler toolchain.
cd ${HOME}/openrobotix/build
source source-me.sh
bitbake meta-toolchain-openrobotix
30
5 System utilities
This chapter describes the system utilities of the BeBot operating system. They are
divided into three parts BeBot, Player and FPGA.
5.1 BeBot
The BeBot utilities use the BeBot hardware direct via the bebot.h header.
5.1.1 Obstacle avoidance - avoid
This utility moves the robot forward until it detects a obstacle at the front and it starts
rotating as long as there is a obstacle in front of the robot. The demo starts moving if
the two back sensors are covered and stops moving if the four front sensors are covered.
5.1.2 Wiimote remote control - wiibot
This utility enables the BeBot to remote controlled by a Nintendo Wiimote. The robot
can be controlled by the directional pad or by the relative alignment of the controller
towards the earth together with pressing button B. The maximum speed of the robot can
be controlled with the + and - button. The connection of the Wiimote to the BeBot is
established by pressing 1 and 2 together.
5.2 Player
The Player utilities use the BeBot hardware via the Player framework.
5.2.1 Object follower - follow
This utility uses the camera and a blobfinder of the Player framework to follow a blue
colored object. The object color is defined via the blobfinder module of the player server.
5.3 FPGA
This utilities use the hardware configuration and data interface to interact with the FPGA.
Configuration
The FPGA can be configuration by copy a bit steam to the em /dev/cpld node.
5.3 FPGA
31
Communication
The data interface use the /dev/fpga node to communicate with the FPGA.
5.3.1 Register setup - fpga
This utility allows read and write of FPGA registers via command line.
Read register value from address ADDR
fpga ADDR
Write value VALUE to register address ADDR
fpga ADDR VALUE
5.3.2 Expansion connector - /dev/firmware/fpga.bit
The FPGA has a expansion connector on the right side of the robot.
3.3 V
SYS IO1
SYS IO3
SYS IO4
SYS IO6
GND
SYS IO9
SYS IO11
SYS IO12
SYS IO14
GND
SYS IO17
SYS IO19
SYS IO20
SYS IO22
GND
SYS IO25
SYS IO27
SYS IO28
SYS IO30
1
3
5
7
9
11
13
14
17
19
21
23
25
27
29
31
33
35
37
39
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
SYS IO0
SYS IO2
GND
SYS IO5
SYS IO7
SYS IO8
SYS IO10
GND
SYS IO13
SYS IO15
SYS IO16
SYS IO18
GND
SYS IO21
SYS IO23
SYS IO24
SYS IO26
GND
SYS IO29
SYS IO31
Table 5.1: Expansion connector on the BeBot
This can be used as inputs and outputs with the default /lib/firmware/fpga.bit configuration. This configuration offers three registers to read the input status, write the output
status and setup the output direction.
32
5 System utilities
Address
Description
0x0
Input level register
0x4
Output level register
0x8
Output direction register
Table 5.2: Expansion connector configuration register
Configure the FPGA with the default bit stream
cp /lib/firmware/fpga.bit /dev/cpld
Read input level of the pins
fpga 0x0
Configure outputs via bit mask VALUE
fpga 0x8 VALUE
Enable outpus via bit mask VALUE
fpga 0x4 VALUE
33
6 System Update
This chapter describes the software update of the BeBot operating system. The update is
done via the bootloader of the system, a USB memory stick and the USB device interface
or the serial line of the BeBot. The next section deals with the setup of a USB and serial
line connection between the BeBot and a computer. Afterward the setup of the USB
memory stick is described. The last section descries the interaction with the bootloader
6.1 USB device interface
The mini USB connector of the USB device interface (P19) is located at the front on
the left below the processor. The interface emulates a serial line when it is connected to
a computer and the boot process of the bootloader (u-boot) is stopped by pressing the
power button (S4) below the board at the front beside the reset button during startup.
6.2 Serial line
The connector of the serial line (P9) is located between the Bluetooth chip and the
processor direct at the corner of the board (see figure ??) and uses a Header, 1.27mm,
6 Way. The pinning is displayed in table 6.1 and pin one is at the top market with a
white point. The serial interface in the bootloader (u-boot) is enabled by pressing the
user button (S3) above the processor during startup.
3.3 V
1 2 SYS RXD
SYS TXD 3 4 SYS SDA
SYS SCL 5 6
GND
Table 6.1: Serial connector on the BeBot
The signal names of the serial line describe the function at the processor and must
be cross connected to the computer signals. The signals use a 3.3 V level and must be
level shifted before connected to a RS232 interface. This can be done with a MAX232 or
comparable chip.
The serial line use a 115200 baud, no parity and 8 bit configuration. Any serial terminal
program can be used.
34
6 System Update
6.3 Preperations
A new root file system image (rootfs.jffs2) and Linux image (uImage) can be generated
with the bitbake openrobotix-image. The bootloader (u-boot.bin) can be generated with
bitbake virtual/bootloader. The generated files are located in the oe/tmp/..../deploy/..
directory. The files have to be copied on a windows (FAT) formated USB memory stick
in the root directory with the names mentioned above.
6.4 Flash programming
Press the power button (S4) below the board at the front beside the reset button during
startup of the BeBot to stop the boot process. Start the terminal program, insert the
USB memory stick in the left connector (P18) below the processor.
Don’t switch off or reset the device or interrupt the update process!
Update the bootloader (u-boot.bin) only if you really need to update it and you are
sure your image is functional!
run program_usb_u-boot
Update the Linux image (uImage)
run program_usb_uImage
Update the root file system (rootfs.jffs2)
run program_usb_rootfs
Restart the BeBot
reset
The first setup can take some time, don’t power off or reset the device.