this month I need to complete the LED and Battery testing…Here goes the video:
this month I need to complete the LED and Battery testing…Here goes the video:
Yesterday, when I discussed with my office mate on the issues of compiling the epuck using the linux laptop…he mentioned something brilliant i guess. Previously, I just compiled my code using the linuxboard in epuck. Jenny inform me that she never tested it in compiling the codes using laptop, but she only tested using Hello World program. I have tested with a simple hello world program and its work.But when i tested with the epuck codes it does not work as few library configuration is needed.
Googling and try to find an example that using eclipse to cross-compile and it works…
Here it goes:
Setting the path for the toolchain
Usually you will have installed a cross-toolchain into /usr/local, /opt or your home directory. In my case I have an Ångström armv5te eabi toolchain (created using “bitbake meta-toolchain” if you are curious – full details outside the scope of this tutorial) which is installed into /usr/local/angstrom/arm and the tools have the prefix arm-angstrom-linux-gnueabi-. Whether you are compiling from the command line or Eclipse, you will need to include the path to the toolchain binaries. I generally write a script file that sets the path and then loads Eclipse like this:
#!/bin/sh
PATH=/usr/local/angstrom/arm/bin:$PATH
$HOME/eclipse/eclipse -vm $HOME/jre1.6.0_12/bin/java
Creating a project
Start Eclipse and select File->New->C Project or File->New->C++ Project. You will have a choice of four project types: Executable, Shared Library, Static Library and Makefile project. With the first three Eclipse will look after building the program using its own internally-generated makefile: this tutorial is about how to set up Eclipse to use a cross-compiler in these cases. With a Makefile project you will provide the Makefile yourself and so you select the compiler and build options outside the Eclipse environment.
For the proposes of this tutorial, create a “Hello World ANSI C Project”. You will find that Eclipse compiles it automatically to produce an executable for your PC – which is not what you want.
Setting the cross compiler
For all project types except Makefile project, you need to tell Eclipse to use the cross compiler rather than the native gcc.
If you are using multiple configurations, Debug and Release for example, you need to do this for each of them.
Now, click on Project->Clean to force Eclipse to rebuild and you should find an executable in the Binaries folder of the type of your toolchain, arm/le in my case.
Setting the include parser
This next bit is optional since it only affects the way Eclipse parses #include directives but not the way the program is compiled. Select Project->Properties. Under C/C++ General, select Paths and Symbols. On the Includes tab, select GNU C and add the path as shown in the screen shot below:
Now, if you right-click a header file (stdio.h for example) and select Open Declaration, it will display the header from the cross toolchain, rather than the native one. This may not matter much for headers from libc, which are pretty much the same for every one, but it does make a difference for headers from other libraries that may be totally different or not even installed on your development PC.
Unfortunately it is not possible to remove the paths to the native headers, but normally it won’t be a problem because the indexer will look in the cross toolchain includes first.
How To Use the York EPucks
You will need:
* Epuck
* MicroSD card reader
* linux laptop or computer that you have root access to.
* USB to RS232 converter
* serial to robot cable described in http://lpuck.sourceforge.net/files/instruction_JC.pdf
To connect:
login: root
password: robot
Running player on the robot
Compiling code for the robot
cross compiler to compile your code on the computer and then copy the binary across onto the microSD card.
We tested the compiling on robots
> There is an interrupt (_LVDInterrupt) for low voltage detection on the dspic, > see datasheet "Section 9. Low Voltage Detect (LVD)". Below there is my code > segment where I implement the event "on_low_battery", which is fired by this > interrupt. > > > static void init_lvd(){ > on_low_battery=add_event(); > on_low_battery->check_function=always_true; > set_action(on_low_battery,lowBattery); > > //set interrupt prority -> 1 > > IPC10=(IPC10 & 0xFF1F) + 0x0020; > _LVDIE=0; > _LVDEN=1; > > //set voltage threshold -> 7 (<3.1 V, see datasheet p. 184) > > RCON=(RCON & 0xF0FF) +0x0700; > while(!_BGST); > _LVDIF=0; > _LVDIE=1; > } > > void __attribute__((interrupt, auto_psv)) _LVDInterrupt(void) > { > _LVDIF=0; > _LVDEN=0; > _LVDIE=0; > check(on_low_battery); > } > > //An example action > > void lowBattery(Event *e,void *arg){ > e_set_led(9,1); > } >
HAVE TO DO THE FOLLOWING:
Part 2:
Part 1:
Since we cannot really tested with real e-puck yet, listed are the tutorials that need to be completed by next week before updating the algorithm.
Previous issues: the *.o files cannot be read, resulting the following errors:
avoid.o(.text+0×0): In function `_readProximitySensors’:
: multiple definition of `_readProximitySensors’
avoid.o(.text+0×0): first defined here
beacon.o(.text+0×0): In function `_detectBeacon’:
it is basically the linker issues, -pic30 cannot really link with the generated *.o files.
Do refer to tutorial 1 & Swarm taxis files for more.
( The .hex file is generated but I changed the sound.c files…need to check back the changes )