bebot - software installation guide · 2012-08-23 · dual-boot system: linux is installed as an...

38
HEINZ NIXDORF INSTITUTE University of Paderborn BeBot - Software Installation Guide Version 1.4

Upload: others

Post on 08-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

HEINZ NIXDORF INSTITUTEUniversity of Paderborn

BeBot - Software Installation Guide

Version 1.4

Page 2: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

BeBot - Software Installation Guide

Markus Koester,Stefan Herbrechtsmeier

Copyright c©2009 - 2011HEINZ NIXDORF INSTITUTE

University of PaderbornSystem and Circuit Technology

F”urstenallee 11D-33102 Paderborn, Germany

This work is licensed under the Creative Commons Attribution-Noncommercial-ShareAlike License. To view a copy of this license, visit

http://creativecommons.org/licenses/by-sa/3.0/ or send a letter toCreative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.

Page 3: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

i

Contents

1 BeBot Hardware 1

2 Installation of the Software Development Environment 32.1 Linux Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.1 Wubi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.2 VirtualBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 Software Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3 Software Development for BeBot 183.1 Connecting the BeBot with the Host System . . . . . . . . . . . . . . . . . 183.2 Settings for BeBot Programming in Eclipse . . . . . . . . . . . . . . . . . . 19

3.2.1 Download example source code . . . . . . . . . . . . . . . . . . . . 203.2.2 Create new C/C++ project . . . . . . . . . . . . . . . . . . . . . . 203.2.3 Setup cross compiler . . . . . . . . . . . . . . . . . . . . . . . . . . 203.2.4 Setup Player framework (optional) . . . . . . . . . . . . . . . . . . 223.2.5 Import source files . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.2.6 Compile project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.2.7 Setup file transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.2.8 Remote system exlporer . . . . . . . . . . . . . . . . . . . . . . . . 253.2.9 Setup remote debugging . . . . . . . . . . . . . . . . . . . . . . . . 25

3.3 Simulate the BeBot with Player/Stage . . . . . . . . . . . . . . . . . . . . 26

4 Installation and usage of the Build Environment 284.1 Build Environment Installation . . . . . . . . . . . . . . . . . . . . . . . . 284.2 Root File System Generation . . . . . . . . . . . . . . . . . . . . . . . . . 294.3 Cross Compiler Toolchain Generation . . . . . . . . . . . . . . . . . . . . . 29

5 System utilities 305.1 BeBot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5.1.1 Obstacle avoidance - avoid . . . . . . . . . . . . . . . . . . . . . . . 305.1.2 Wiimote remote control - wiibot . . . . . . . . . . . . . . . . . . . . 30

5.2 Player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.2.1 Object follower - follow . . . . . . . . . . . . . . . . . . . . . . . . . 30

5.3 FPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.3.1 Register setup - fpga . . . . . . . . . . . . . . . . . . . . . . . . . . 315.3.2 Expansion connector - /dev/firmware/fpga.bit . . . . . . . . . . . . 31

Page 4: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

ii Contents

6 System Update 336.1 USB device interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.2 Serial line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.3 Preperations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346.4 Flash programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Page 5: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

1

1 BeBot Hardware

This chapter provides a brief introduction to the hardware of the BeBot. An overview isgiven over the most important system specifications and the communication and naviga-tion possibilities.

The BeBot is based on a powerful ARM processor. The integrated CPU is an MarvellPXA270 at 520 MHz (cf. Figure 1.1). Additionally to the CPU the robot is equippedwith run-time reconfigurable hardware in form of an Field Programmable Gate Array(FPGA), which is directly connected to the camera module. Thus complex algorithmsuch as video processing can be efficiently implemented and executed in hardware. Theoperating system can be installed in 64MB flash memory (cf. Table 1.1) or alternativelyin a external USB memory stick. The whole system offers 64MB of internal RAM.

Application int. Name Size Flash Memory Address RangeBootloader uboot 768kB 0x00000000 - 0x000c0000Bootloader Configuration Data env 256kB 0x000c0000 - 0x00100000Kernel kernel 3MB 0x00100000 - 0x00400000Root File System rootfs 40MB 0x00400000 - 0x02c00000User 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 abootloader and the standard operating system, the user can access the robot by a consolevia 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 USBstick 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-axisaccelerometer. In co-operation with the IR sensors and the camera the robot is capableof navigating in its environment. The 12 IR sensors (two on each side, one on each cornerof the robot) allow for a 360 object detection and distance measurement. The forwardfacing camera module enables to process image data of the environment.

Page 6: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2 1 BeBot Hardware

Figure 1.1: BeBot-Hardware: CPU (1), RAM (2), Flash (3), Bluetooth Module (4), Zig-Bee Module (5), FPGA (6), RS232 Port (7)

Page 7: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

3

2 Installation of the SoftwareDevelopment 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 areseveral different Linux distributions available. For the robot development a Kubuntu10.04 (http://www.kubuntu.org/) distribution is recommended. If you are familiarwith 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 separatepartition of the hard disk. When booting the computer the user can select whichoperating system to boot from a boot manager. This option is also referred to as adual-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 realizedby the Windows Ubuntu Installer (http://wubi-installer.org/).

Virtual machine: Virtualization is a technique that allows for installing multiple oper-ating 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 hard-ware. Although virtual machines do not achieve the performance of a real ma-chine, they offer a great flexibility to the user. There is no need to switch betweendifferent 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 Linuxusing Wubi or VirtualBox.

2.1.1 Wubi

Wubi is an officially supported Ubuntu installer for Windows users that can bring you tothe Linux world with a single click. Wubi allows you to install and uninstall Ubuntu asany 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 nameand password. The installation size of the Linux partition should be around 30GB toavoid a shortage in disk memory.

Page 8: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 Mi-crosystems. Targeted at server, desktop and embedded use, it is the only professional-quality virtualization solution that is Open Source Software. The following steps describethe installation of Kubuntu (Version 9.10) using VirtualBox (version 3.0.2). Basically, theinstallation can be done using the default settings. If custom settings are required theyare explicitly mentioned.

1. Download and install VirtualBoxGo to http://www.virtualbox.org/wiki/Downloads and download thelatest version of VirtualBox for your target platform. Do a full installation includingUSB Support and Networking. After the installation is finished start VirtualBox.The following window appears.

Page 9: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2.1 Linux Installation 5

2. Create a new virtual machineCreate a new virtual machine by clicking on New followed by Next. Enter thename of the virtual machine, e.g. Kubuntu-10.04-64. Select Linux for the operatingsystem and Ubuntu (64bit) for the version.

3. Specify the virtual memoryIn the next window you can specify the memory used by the virtual machine. Thebase memory size should be selected based on the available memory of the hostmachine. Select an amount, which is equal or larger than 1024 MB.

Page 10: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

6 2 Installation of the Software Development Environment

4. Specify the virtual hard diskThe following window is used to specify the virtual hard disk used in the virtualmachine. This can either be a real hard disk partition, or a large file on an existingpartition, which emulates the hard disk. Make sure that Boot Hard Disk (PrimaryMaster) is selected and choose Create new hard disk.

5. Select storage typeClick Next to proceed to the Virtual Disk Wizard. You can now select the harddisk storage type. A dynamically expanding storage initially occupies a very smallamount of space on your physical hard disk. It will grow dynamically (up to thesize specified) as the Guest OS claims disk space. A fixed-size storage does not growand occupies the amount of memory as the size of the virtual hard disk. SelectDynamically expanding storage.

Page 11: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2.1 Linux Installation 7

6. Specify the location and the size of the virtual diskThe size should be around 30 GB. Note that the file size of the virtual disk can growup to the size that you specify. So the file should be stored on a drive that offersenough space.

The next window shows a brief summary of the virtual hard disk. Verify yourspecification and click on Finish.

Page 12: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

8 2 Installation of the Software Development Environment

7. Modify the video memory of the graphics adapterClick on Display in the Details tab of the virtual machine. You can now select thevideo memory size and 3D acceleration. It is recommended to increase the size to64 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 ofyour virtual machine.

Page 13: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2.1 Linux Installation 9

8. Specify a shared folder for file exchangeIn order to allow for an easy file exchange between your host operating system andthe virtual machine, it is possible to add a shared folder. Click on Shared Folder inthe 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 operatingsystem. Enter vboxshare in the Folder Name field. Press OK to add the sharedfolder.

Page 14: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

10 2 Installation of the Software Development Environment

9. Enable a USB Bluetooth dongleThe integration of the Bluetooth hardware into the virtual machine is done byenable a USB Bluetooth dongle in the virtual machine. Click on USB in the Detailstab of the virtual machine. Click on to add a filter from devices and select thecorresponding Bluetooth USB Device. It could be necessary to restart your systemto 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 ISOimage of Kubuntu 10.04 for 64-bit. After downloading continue to install Kubuntu. Ifyou don’t use a virtual machine, you can proceed to step 2. If you use a virtual machinein VirtualBox, continue with the following steps:

1. Mount the ISO-image of KubuntuAfter specifying the virtual machine click on Storage in the Details tab. In thesettings window select the CD icon. Click on the folder icon to open the virtualmedia manager.

Page 15: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 virtualmedia manager.

Verify that the ISO image is selected to be mounted as CD/DVD Drive. Click onOK to leave the settings window. Switch on your virtual machine by clicking onStart. In VirtualBox you can switch the keyboard and mouse between the host

Page 16: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

12 2 Installation of the Software Development Environment

operating and the virtual machine by pressing the so called HOST-key. By defaultthis is the right CTRL-key of your keyboard. The HOST-key is also shown in theright corner of the status bar of VirtualBox. If necessary you can modify it in thesettings of VirtualBox.

2. Start the installation of KubuntuWhen booting from the Kubuntu installation CD, you first have to select the lan-guage for the installation program.

Go to Install Kubuntu and press Enter.

After the boot process is finished a Welcome window appears. Select your preferredlanguage for the installation and click on Forward. In the following window youneed to specify your local time zone and in the next window you have to select your

Page 17: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2.1 Linux Installation 13

keyboard layout. After that the Prepare disk space window is shown, where youneed to select your target disk.

In the following window you need to enter your user account data. To avoid en-tering the log in information at every start of Kubuntu, you can select the Log inautomatically option.

Page 18: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

14 2 Installation of the Software Development Environment

The next window shows a summary of your specification. Verify the settings andpress Install to start the installation process.

After the installation is finished the ISO-image must be removed in order to avoidrestarting the installation process at the next boot. Go to the menu of VirtualBoxand select Devices→CD/DVD Devices→Unmount CD/DVD Device.

Restart the virtual machine. After the boot sequence is finished you should see thefollowing screen.

Page 19: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2.1 Linux Installation 15

Before you install additional software you should update your system. Click onthe 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 theterminal:

sudo apt-get updatesudo apt-get upgrade

Restart the virtual machine.

VirtualBox Guest Additions

To improve the integration of the virtual machine in your host operating system you caninstall the so called Guest Additions. It enables an improved handling of the mouse, auto-matic screen resolution switching, clipboard functionality and shared folder functionality.

The installation compiles additional drivers for the virtual machine and therefor needa 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 tothe menu of VirtualBox and select Devices→Install Guest Additions... or press (HOST-key)+d. A window appears indicating a recently plugged in device. Click on VBOXADDI-TIONS .... Now the CD-ROM folder is shown. Do a right click on VBoxLinuxAdditions-amd64.run and choose Open With→Other...

Page 20: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 useraccount to start the installation. After the installation is finished you are asked to pressenter 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 onefrom 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 orcopy the following code in the terminal:

sudo mkdir -p /media/vboxshareecho "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 mountedto 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 BeBotare 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 developmentand 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.listecho "deb-src http://groups.uni-paderborn.de/sct/ubuntu/ lucid main" \| sudo tee -a /etc/apt/sources.list.d/uni-paderborn.listsudo apt-get updatesudo apt-get install player player-dev stage

Download the toolchain and extract it

Page 21: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

2.2 Software Installation 17

wget http://groups.uni-paderborn.de/sct/openrobotix/\x86_64-linux-armv5te-linux-gnueabi-toolchain-openrobotix.tar.bz2sudo tar -xvjf x86_64-linux-*-toolchain-openrobotix.tar.bz2 -C /

To start the software development environment Eclipse, go to the start menu and clickon Applications → Development → Eclipse. Additionally, you can start Eclipse from theterminal by entering eclipse. When starting Eclipse, the workspace folder requires to beselected. 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 remotedebugging and automatic file transfer to the BeBot. To install the plug-ins start Eclipseand go to Help→Install New Software.... The install window opens. In the Work Withfield enter http://download.eclipse.org/releases/galileo and press enter. Now a listof available plug-ins is loaded. When the download is finished, open the following folderand 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 andrestart Eclipse after the installation of the plug-ins. Now all necessary software compo-nents are installed and ready to use.

Page 22: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

18

3 Software Development for BeBot

This chapter is divided into two sections. Section 3.1 provides the necessary steps onhow to connect the BeBot to your host system. Section 3.2 describes the settings of aBeBot project in Eclipse, and how to compile and execute a simple example program onthe 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 IDof the BeBot. By using the network connection you can login on the BeBot via SSH tostart programs or transfer data to and from the BeBot. In order to connect to the robotvia SSH you always have to make sure that the Bluetooth PAN is established first. Inthe 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 PANconnections can be established quite fast.

First, you need to add the BeBot as a Bluetooth device to your computer. Thereare 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 involvethe following steps:

1. The Bluetooth interfaces of the BeBot and your PC must be switched on and theBluetooth software must be configured to scan for new devices.

2. Once the BeBot device is detected, it can be added by transmitting a passkey. Bydefault the passkey of the BeBot is 1234.

3. The personal area network service must be added and configured to use a staticIP-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 PersonalArea Networking (PAN). PAN provides ad hoc networking between the BeBot and thecomputer. First, the IP address of your Bluetooth PAN network adapter requires to beset to the static address 192.168.1.100 using subnet mask 255.255.255.0. Open a terminaland 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\

Page 23: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 othercomputer, you can change it to any available address in the address range 192.168.1.[100-255].

While the setting of the static IP address only needs to be done once, the followingsteps 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 con-nection to the BeBot.

1. Turn on the BeBot you want to connect to. Note: The start-up sequence of theBeBot 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 thatare in range. When the search is complete, the BeBot should appear in the deviceslist of the tool. A device that has discovery turned off cannot be detected during asearch.

4. Right click on the BeBot and select Pair. Now, you have to enter the passkey forthe BeBot. Enter 1234 and click OK. After entering the passkey, your computertries 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. Youshould now see:

root@bebotX:˜#

3.2 Settings for BeBot Programming in Eclipse

The integrated development environment Eclipse offers the CDT plug-in to enable thedevelopment of C/C++ projects. If you are unfamiliar with C/C++ development inEclipse, you can go to http://www.eclipse.org/cdt/ to get basic informationabout how to use the CDT plug-in of Eclipse for building, running and debugging aprogram. To develop programs for the BeBot, the standard settings for C projects requireto be modified such that the build process involves the compilation by the cross compilertoolchain. Before executing the resulting binary, it can be automatically transferred to theBeBot via an SSH connection. This is done by the Target Management (RSE) plug-in. Formore 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.

Page 24: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

20 3 Software Development for BeBot

3.2.1 Download example source code

Open a terminal window and download the example programs.

cd Downloadswget http://groups.uni-paderborn.de/sct/bebot/demo.cwget http://groups.uni-paderborn.de/sct/bebot/demo.cc

The C source (demo.c) code specify a program that rotate the BeBot at its positionand 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 importedinto a suitable Eclipse project.

3.2.2 Create new C/C++ project

Start Eclipse (Start menu Applications→Development→Eclipse IDE) and create a newproject. 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 twoconfigurations, one for development and debugging (Debug) and one for the final releaseof 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 clickManage Configurations.... In the Manager Configurations window click New.... In theCreate New Configuration window enter BeBot Debug as name, select Debug under Copysetting from behind Existing configuration and click OK. Repeat the last steps, but enter

Page 25: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

3.2 Settings for BeBot Programming in Eclipse 21

BeBot Release as name and select Release under Copy setting from. In the ManagerConfigurations window select BeBot Debug and click Set Active. Click OK to close thewindow. In the C/C++ Build window click behind Configuration and select [ Multipleconfigurations... ]. In the Select configurations window activate the two BeBot configu-rations and click OK. Open the Environment folder and click Add.... In the New variablewindow enter SDK_PATH as Name, /usr/local/angstrom/arm as Value and click OK. Re-peat this step for all the other variables from the following list.

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. ClickEdit... and remove it.

Open the Settings folder and select the Tool Settings tab. Here you can specify thecompiler and linker settings for your program. By default the compiler command isgcc (g++ for C++ project). Change the compiler command to ${TARGET_SYS}-gcc

(${TARGET_SYS}-g++ for C++ project).

Page 26: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 thecompiler 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 se-lect [ All configurations] behind Configuration. Go to Settings and select the Tool Set-tings tab. Select Miscellaneous under GCC C Compiler (GCC C++ Compiler) andadd ‘pkg-config --cflags playerc‘ (‘pkg-config --cflags playerc++‘ at the endof Other flags. Select Miscellaneous under GCC C Linker (GCC C++ Linker for C++project) and add ‘pkg-config --libs playerc‘ (‘pkg-config --libs playerc++‘ forC++ 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 homedirectory. Select the demo.c (demo.cc for C++ project) file in the folder. Make sure thatyour project is selected in the Into folder: field and click Finish.

Page 27: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

3.2 Settings for BeBot Programming in Eclipse 23

In the main window you can see the imported files by double-clicking on the projectfolder in the Project Explorer. Open demo.c (demo.cc for C++ project) by double-clickingon 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.

Page 28: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 bycreating 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 yourproject 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. Youcan change demo to the name of your project, but it is important to transfer the file tothe /media/ram/ folder on the BeBot.

Now the type of connection requires to be defined. Behind the Connection field click onNew.... In the New Connection window select Linux and click on Next. In the field HostName enter 192.168.1.X, where X must be replaced with the ID of your BeBot. Changethe Connection name to BeBotX and click Next. In the next window the subsysteminformation for files is defined. Select ssh.files in the Configuration list and click onNext. The following window defines the process handling. Select processes.shell.linux inthe Configuration list and click on Next. The next window is used to specify the shellprotocol. Select ssh.shells in the Configuration list and click on Next. Finally, the SSHterminals are specified. Make sure that ssh.terminals is selected and click on Finish. Youreturn to the Run Configurations window. Change the connection to BeBot and click onApply.

Before you run your program for the first time, you have to make sure that the Bluetoothconnection to the BeBot is established in your host operating system and that the PAN isinitialized. The necessary steps to connect to the PAN are described in Section 3.1. After

Page 29: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

3.2 Settings for BeBot Programming in Eclipse 25

establishing the Bluetooth connection you can run your program, by clicking on Run inthe Run Configurations window.

A login window appears, where you need to enter root as User ID and leave thePassword empty. You can select Save user ID and Save password to avoid any futurelogin windows. The binary is now executed on the BeBot and the output is directed tothe Console tab in the main window. A list of sensor data appears, which is updatedfrequently. If you hold your hand close to one side of the robot, some of the data ischanged significantly. To terminate the program click on . If you want to run yourprogram 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 listof processes of your BeBot. This can be done by the Remote System Explorer, which youcan 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 theRemote Systems list you can now double-click on BeBot to get a list of options. With theRemote 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 LaunchTerminal. The terminal is now started in a tab. To return to the C/C++ perspective goto 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 thefollowing the necessary steps are described to setup the remote debugging for the Be-Bot. From the main menu go to Run→Debug Configurations.... A Debug Configurationswindow opens, where you can see the settings for the remote connection, which you pre-viously specified. Go to the Debugger tab and change the debugger command in the GDBdebugger field to /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gdb.

Page 30: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

26 3 Software Development for BeBot

Click on Apply to save the settings. Start remote debugging your code by clickingon Debug. Now Eclipse asks you to switch to the Debug perspective. You can select toremember 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 onthe black arrow of to open a pull-down menu, where you can select BeBot Remote.

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

Page 31: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

3.3 Simulate the BeBot with Player/Stage 27

Page 32: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

28

4 Installation and usage of the BuildEnvironment

This chapter describes the installation of the build environment openRobotix / openEm-bedded. The environment allows the easy generation of software packages and image forthe system.

4.1 Build Environment Installation

Click on the start menu (Kickoff Application Launcher) and enter term in the searchfield. Press enter to open a terminal window and enter or copy the following code in theterminal.

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/recipescd openrobotixgit clone git://git.openembedded.org/openembeddedcd openembeddedgit checkout -b 2011.03-maintenance origin/2011.03-maintenancecd ..git clone git://git.openembedded.org/bitbakecd bitbakegit checkout -b 1.12 origin/1.12cd ..git clone git://git.berlios.de/openrobotixcp -r openrobotix/contrib/openrobotix/* build

Page 33: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 searchfield. Press enter to open a terminal window and enter or copy the following code in theterminal to generate the root file system (rootfs) and the Linux image (uImage).

cd ${HOME}/openrobotix/buildsource source-me.shbitbake openrobotix-image

4.3 Cross Compiler Toolchain Generation

Click on the start menu (Kickoff Application Launcher) and enter term in the searchfield. Press enter to open a terminal window and enter or copy the following code in theterminal to generate the cross compiler toolchain.

cd ${HOME}/openrobotix/buildsource source-me.shbitbake meta-toolchain-openrobotix

Page 34: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

30

5 System utilities

This chapter describes the system utilities of the BeBot operating system. They aredivided 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 startsrotating as long as there is a obstacle in front of the robot. The demo starts moving ifthe 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 robotcan be controlled by the directional pad or by the relative alignment of the controllertowards the earth together with pressing button B. The maximum speed of the robot canbe controlled with the + and - button. The connection of the Wiimote to the BeBot isestablished 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 bluecolored 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.

Page 35: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

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 1 2 SYS IO0SYS IO1 3 4 SYS IO2SYS IO3 5 6 GNDSYS IO4 7 8 SYS IO5SYS IO6 9 10 SYS IO7

GND 11 12 SYS IO8SYS IO9 13 14 SYS IO10SYS IO11 14 16 GNDSYS IO12 17 18 SYS IO13SYS IO14 19 20 SYS IO15

GND 21 22 SYS IO16SYS IO17 23 24 SYS IO18SYS IO19 25 26 GNDSYS IO20 27 28 SYS IO21SYS IO22 29 30 SYS IO23

GND 31 32 SYS IO24SYS IO25 33 34 SYS IO26SYS IO27 35 36 GNDSYS IO28 37 38 SYS IO29SYS IO30 39 40 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 configu-ration. This configuration offers three registers to read the input status, write the outputstatus and setup the output direction.

Page 36: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

32 5 System utilities

Address Description0x0 Input level register0x4 Output level register0x8 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

Page 37: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

33

6 System Update

This chapter describes the software update of the BeBot operating system. The update isdone via the bootloader of the system, a USB memory stick and the USB device interfaceor the serial line of the BeBot. The next section deals with the setup of a USB and serialline connection between the BeBot and a computer. Afterward the setup of the USBmemory 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 onthe left below the processor. The interface emulates a serial line when it is connected toa computer and the boot process of the bootloader (u-boot) is stopped by pressing thepower 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 theprocessor 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 awhite point. The serial interface in the bootloader (u-boot) is enabled by pressing theuser button (S3) above the processor during startup.

3.3 V 1 2 SYS RXDSYS TXD 3 4 SYS SDASYS 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 mustbe cross connected to the computer signals. The signals use a 3.3 V level and must belevel shifted before connected to a RS232 interface. This can be done with a MAX232 orcomparable chip.

The serial line use a 115200 baud, no parity and 8 bit configuration. Any serial terminalprogram can be used.

Page 38: BeBot - Software Installation Guide · 2012-08-23 · Dual-boot system: Linux is installed as an additional operating system in a separate partition of the hard disk. When booting

34 6 System Update

6.3 Preperations

A new root file system image (rootfs.jffs2) and Linux image (uImage) can be generatedwith the bitbake openrobotix-image. The bootloader (u-boot.bin) can be generated withbitbake 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 stickin 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 duringstartup of the BeBot to stop the boot process. Start the terminal program, insert theUSB 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.