Society of Robots - Robot Forum

Software => Software => Topic started by: robotguy on October 27, 2009, 11:08:39 AM

Title: WebBotLib and Sharp GP2D12 sensor
Post by: robotguy on October 27, 2009, 11:08:39 AM
I've been starting to work on my robot control software using WebbotLib, but am having some difficulties getting some code to compile.  This problem may or may not relate directly to Webbot, since the error may not be generated by a problem in the library. I'm using v1.10 of Webbot.

Code: [Select]
#include "sys/axon.h" // The Society of Robots Axon Microcontroller
#include "Sensors\Distance\Ping\PingSonar.h"
#include "Sensors\Distance\Sharp\GP2D12.h"

// Now include any other files that are needed here
#include "uart.h"
#include "rprintf.h"
#include "walter-webbot.h"

// My functions, definitions, and procedures

PingSonar ping[8] = { MAKE_PingSonar(F0),
MAKE_PingSonar(F1),
MAKE_PingSonar(F2),
MAKE_PingSonar(F3),
MAKE_PingSonar(F4),
MAKE_PingSonar(F5),
MAKE_PingSonar(F6),
MAKE_PingSonar(F7)
};


// A test
typedef struct servo_def {
unsigned int position;
int pulse;
} SERVO;

SERVO servo[32];

Sharp_GP2D12 ir[8] = { MAKE_Sharp_GP2D12(K0),
MAKE_Sharp_GP2D12(K1),
MAKE_Sharp_GP2D12(K2),
MAKE_Sharp_GP2D12(K3),
MAKE_Sharp_GP2D12(K4),
MAKE_Sharp_GP2D12(K5),
MAKE_Sharp_GP2D12(K6),
MAKE_Sharp_GP2D12(K7)
};

I am getting the following error on compile:

e:/devel/winavr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5\libc.a(floatsisf.o): In function `__floatunsisf':
(.text.fplib+0x0): multiple definition of `__floatunsisf'
e:/devel/winavr/bin/../lib/gcc/avr/4.3.2/avr5\libgcc.a(_usi_to_sf.o):(.text+0x0): first defined here
make: *** [walter.elf] Error 1
Build failed with 1 errors and 0 warnings...

This error seems to have something to do with the declaration of the Sharp GP2D12 sensor array I have.  The PING sensor declaration compiles perfectly and works. If I remove the Sharp declaration, everything compiles perfectly. Is there a solution for this problem?

8-Dale
Title: Re: WebBotLib and Sharp GP2D12 sensor
Post by: Webbot on October 27, 2009, 04:12:09 PM
Can you PM me with source code etc - much easier to work out if its me or compiler, etc

Thanks
Title: Re: WebBotLib and Sharp GP2D12 sensor
Post by: Webbot on October 27, 2009, 04:21:03 PM
sorry for double post but its kinda unrelated - in so far as it relates to a 'problem' in avr-gcc rather than this individual post about WebbotLib.

Looking at WebbotLib manual 'Getting Started' then it shows you how to include the libraries for:
WebbotLib for the processor you need
libm
libc

The last two libs are required for floating point.

Make sure that in the 'window' the libraries are listed in that EXACT order (don't ask me why! - strange avr-gcc issue ! )
If not then 'nudge' them up/down to be in that order and try again.



Title: Re: WebBotLib and Sharp GP2D12 sensor
Post by: robotguy on October 27, 2009, 04:24:38 PM
The last two libs are required for floating point.

Make sure that in the 'window' the libraries are listed in that EXACT order (don't ask me why! - strange avr-gcc issue ! )
If not then 'nudge' them up/down to be in that order and try again.
I will double check this the next time I boot into Windows.

8-Dale
Title: Re: WebBotLib and Sharp GP2D12 sensor
Post by: robotguy on October 27, 2009, 05:04:15 PM
Looking at WebbotLib manual 'Getting Started' then it shows you how to include the libraries for:
WebbotLib for the processor you need
libm
libc
I've double checked everything and it appears I have everything setup correctly.  It's a little unclear in the Webbot documentation just how many libraries I should have in the right pane of the libraries window.

I have: libm, libc, two libprintf, two libscanf, and libWebbotAtmega640. All in that order. I can't tell which of the libprintf and libscanf libraries are in which order because the text is too small for me to read exactly. It looks like I have everything set correctly.

I still can't get the code for the Sharp GP2D12 to compile.

8-Dale
Title: Re: WebBotLib and Sharp GP2D12 sensor
Post by: Webbot on October 27, 2009, 05:21:19 PM
avr-gcc seems to be somewhat fussy about the order of stuff (ie nothing to do with WebbotLib).

As per my manual: try changing the libs to be:
libWebbotATMega640
libm
libc
(remove the others)
in exactly that running order. Remove libprintf and libscanf for now.

Does that work.

If not then add libprintf, libscanf (which I guess must be used by your code - not WebbotLib) to the 'bottom' of the list



Title: Re: WebBotLib and Sharp GP2D12 sensor
Post by: robotguy on October 27, 2009, 10:41:30 PM
avr-gcc seems to be somewhat fussy about the order of stuff (ie nothing to do with WebbotLib).

As per my manual: try changing the libs to be:
libWebbotATMega640
libm
libc
(remove the others)
in exactly that running order. Remove libprintf and libscanf for now.

Does that work.
This worked! I removed the libprintf and libscanf libraries and ordered things as you specified. Thanks!

8-Dale