Author Topic: Webbot lib with iRobot?  (Read 1187 times)

0 Members and 1 Guest are viewing this topic.

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Webbot lib with iRobot?
« on: September 09, 2010, 12:46:10 PM »
Hi all,
I was trying to simplify some of my code by using Webbotlib for my iRobot Create command module.  Thing is, I'm using WinAVR with PN, not AVR Studio.  Should it still work?  What would have to change in Webbot's instructions? Can anyone take a look at my code for some troubleshooting help?  Thanks in advance.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: Webbot lib with iRobot?
« Reply #1 on: September 09, 2010, 03:08:41 PM »
Webbot or someone more familiar can answer the WinAVR vs AVRStudio thing.

I will say this to save Webbot the trouble of looking it up, the Command Module is an Atmega168, so by today's standards space is a little tight, but it should fit (I think).

alternatively, you can just control the Irobot Create with another, more spacious and capable, microcontroller. Look at mine:

Axon 2 Irobot Create Force Field Test


I can help you interface another micro-controller, and I even have webbotlib compatible code to talk to the Create and read all it's sensors i'd be willing to share.
« Last Edit: September 09, 2010, 03:10:34 PM by madsci1016 »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: Webbot lib with iRobot?
« Reply #2 on: September 09, 2010, 03:17:37 PM »
I think I misunderstood what you are asking. Are you just trying to cut and paste webbotlib code into your own? What code exactly in your code is creating issues?

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Webbot lib with iRobot?
« Reply #3 on: September 09, 2010, 03:54:15 PM »
Sorry, I forgot to remove that pasted part from the code when I posted, I was just testing to make sure the directory linking wasn't causing the problem.  Nope, I'm just trying to use the libraries via standard #include and then call the functions in main to return values for sensors....It doesn't seem to compile though...

Compiling: AssistantRobot13F.c
avr-gcc -c -mmcu=atmega168 -I. -gdwarf-2 -DF_CPU=18432000UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=AssistantRobot13F.lst  -std=gnu99 -MD -MP -MF .dep/AssistantRobot13F.o.d AssistantRobot13F.c -o AssistantRobot13F.o
In file included from ./Sensors/Distance/../_sensor_common.h:39,
                 from ./Sensors/Distance/_distance_common.h:41,
                 from Sensors/Distance/Devantech/SRF05_Sonar.h:58,
                 from AssistantRobot13F.c:22:
./Sensors/Distance/../../libdefs.h:89:25: avr/common.h: No such file or directory
AssistantRobot13F.c: In function `SonarInitialize':
AssistantRobot13F.c:382: error: structure has no member named `distance'
AssistantRobot13F.c: In function `SonarRanging':
AssistantRobot13F.c:491: error: structure has no member named `distance'
AssistantRobot13F.c:492: error: structure has no member named `distance'
AssistantRobot13F.c:492: warning: unused variable `cm'
make.exe: *** [AssistantRobot13F.o] Error 1

in the variable structure sensor.distance.cm and in the functions distanceInit(sensor) and distanceRead(sensor).  I don't really know why its not recognizing 'distance'. 

As for using another microcontroller like AxonII, I'm unfortunately restricted by a class assignment (and the school's lack of money...:))

But thanks a lot for offering to share your code, I may just but one for hobby projects in the near future.

In the mean time, any help with this situation would be greatly appreciated!!

Thanks.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 110
Re: Webbot lib with iRobot?
« Reply #4 on: September 09, 2010, 04:34:54 PM »
Forget all the distance stuff, and WebbotLib,  thats not the root problem.

The main problem is that it cant find 'avr/common.h' which is part of WinAVR.
Am guessing that its not your PATH

Try re-installing WinAVR

Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
Re: Webbot lib with iRobot?
« Reply #5 on: September 09, 2010, 09:03:33 PM »
the Command Module is an Atmega168, so by today's standards space is a little tight, but it should fit (I think).

It does fit, but there is not much space left for the rest. I ran out of space after instantiating a servo and a range sensor.

Chelmi.

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Webbot lib with iRobot?
« Reply #6 on: September 10, 2010, 08:19:42 AM »
Webbot,

When I do reinstall WinAVR, should I put it within the same folder as the webbot lib? How do I link the two of them?

Thanks.

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Webbot lib with iRobot?
« Reply #7 on: September 10, 2010, 10:02:41 AM »
Ok I've reinstalled it in C:\WinAVR and if just put #include <avr/common.h> in another piece of otherwise operational code, it says that the directory cannot be found.  What's going on?  Does anyone just have that header that they can send me?

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 110
Re: Webbot lib with iRobot?
« Reply #8 on: September 10, 2010, 03:40:02 PM »
No - don't put them in the same directory - they are two different libraries that do different things.
What you need to do is tell AVRStudio where these libraries are located.
The WebbotLib mannual tells you how to do that for WebbotLib (and appears to be working ok according to your stack trace)
Your problem is that it isn't find WinAVR.
From a DOS command prompt try typing 'set' and then checking the contents of the PATH variable - it should contain several entries starting with C:\WinAVR.

If it doesn't then try uninstalling WinAVR and AVRStudio.
Then install WinAVR first followed by AVRStudio
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Webbot lib with iRobot?
« Reply #9 on: September 12, 2010, 02:59:00 PM »
Webbot,

Even after reinstalling WinAVR and using AVR studio, there seems to be something wrong.  I ran your sample code "Hello world" as instructed in your manual:

 
Code: [Select]
]// Place any #define statements here before you include ANY other files
 
// You must ALWAYS specify the board you are using
// These are all in the 'sys' folder e.g.
#include "sys/atmega168.h" // I am using an atmega168
 
// Now include any other files that are needed here
#include "uart.h"
#include "rprintf.h"
 
// Now create any global variables such as motors, servos, sensors etc
 
// This routine is called once only and allows you to do set up the hardware
// Dont use any 'clock' functions here - use 'delay' functions instead
void appInitHardware(void){
    // Set UART0 to 19200 baud
    uartInit(UART0, 19200);
    // Tell rprintf to output to UART0
    rprintfInit(&uart0SendByte);
}
// This routine is called once to allow you to set up any other variables in your program
// You can use 'clock' function here.
// The loopStart parameter has the current clock value in ÁS
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
    return 0; // dont pause after
}
 
// This routine is called repeatedly - its your main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
    rprintf("Hello world\n");
    return 1000000; // wait for 1 second before calling me again. 1000000us = 1 second
}
Only changing the name to match my microcontroller, I'm still getting these errors...

C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../libdefs.h:89:25: avr/common.h: No such file or directory
C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../dev/ATmega168.h:298: error: initializer element is not constant
C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../dev/ATmega168.h:298: error: (near initialization for `Uarts[0]._uart_.oneWire')
C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../dev/ATmega168.h:298: error: initializer element is not constant
C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../dev/ATmega168.h:298: error: (near initialization for `Uarts[0]._uart_')
C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../dev/ATmega168.h:298: error: initializer element is not constant
C:\IshwaryaAVR\IshWebbotProj1\..\..\webbotlib/sys/../dev/ATmega168.h:298: error: (near initialization for `Uarts[0]')


Would you know why this is happening or how to fix it?  PLEASE let me know.  Until then, looks like I'm going to abandon the WebbotLib and go old school... :)


Thanks.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 110
Re: Webbot lib with iRobot?
« Reply #10 on: September 12, 2010, 04:53:51 PM »
I've no idea.

Your program is including all the WebbotLib files ok but the compiler can't find the WinAVR files for some reason. That's to do with your compiler - WebbotLib doesn't make any kind of assumptions about where these files are (as its nothing to do with WebbotLib).

ie your problem is not WebbotLib but just other AVRSudio/WinAVR poblems.

Hence the reason saying 'no idea' - as its not really anything to do with my library as to why the compiler cant find someboby elses code - eq in your case 'avr/common.h' which is part of WinAVR.

Sorry I cant help you any further.

Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Webbot lib with iRobot?
« Reply #11 on: September 12, 2010, 08:37:11 PM »
That's no problem....Thanks for all the help you've given me!  I was planning to use your library to control a sonar, but I'll just code for a hardware timer...it should be ok.  Thanks again!

 


Get Your Ad Here

data_list