Buzzbot – Odometry Task

Now that I have my Interrupts working on the the PIO Port, I have successfully adapted some code to provide Odometry for Buzzbot, based on reading the wheel encoders.    

This odometry task provides me with the following data:

  • Buzzbots Location in 2D Space (X and Y cooridinates).
  • Current Heading in Degees.
  • Average distance travelled in centimeters.
  • Angle of rotation about the axis.

I would like now to get the motor contol going, so at least I can get some basic movement, then the next step will then get some behaviour happening.    The PID combined with the odometry will allow me to command Buzzbot to drive to a specific X, Y Location, so I can do some calibration on the odometry to see how accurate it is.

All these tasks run under the FreeRTOS (http://www.freertos.org).

Interrupts on makecontroller now working

Finally worked out how to use the GPIO interrupts on the AT91SAM7X, which is the brain of the makecontroller.  A couple of “gotchas” along the way, especially for a newby to these beasts like me, which as usual, after I’ve finally worked it out I look back see how simple it was lol.

 The three main “gotchas” were:

  1. The ISR needs to be in its own .c file and the filename appended to the ARM_SRC section in the makefile.  Reason: All IRQ need to be compiled in ARM mode
  2. In the ISR I needed to Read the Interrupt Status register, PIOB_ISR, I was not dodin gthis and so it would process  the IRQ once and never again.  By reading the ISR it clears it and allows interrupts on the PIO to re-occur.
  3. The very last thing in the ISR is to renable the AIC so that interrupts will be processed upon exit

Here is the code:

make.c 
gpio_isr.c

 

 

Interrupts – Steep Learning Curve

Well have the controller setup and have uploaded the demo code, all working 🙂  Now down too some serious work in getting buzzbot connected to the board. 

The Board is based on the AT91SAM7X MPU, of which I have absolutely no experience, so the learning curve begins (right at the bottom).  First thing I want to do is get the interrupts for the two wheel encoders working.  From my initial research I gather that any of the inputs on the GPIO can generate an interrupt on a state change, exactly what I want.  So now more research on how to make it happen using the ARM7 GCC tools I’ve installed, all demo code is compiling and working ok.

Looks like my starting point is some examples found here http://gandalf.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html 

Make Controller

My new Make controller arrived today from www.makethings.com/makecontrollerkit  Talk about fast delivery, just ordered it last week and arrived here in Western Australia today woohoo….

This impressive board seems to have pretty good specs, and from my initial look at it I’m pretty impressed by the features for the price.

Makecontroller

Using the Embedded AT91SAM7X which is Based on the 32bit ARM7 core with 256K Flash, 55MHZ

Has heaps of buffered I/O bought out for easy access on the controller board, or you can pull off the Controller board get access to heaps more, although unbuffered, I/O. 

 Ethernet Port, USB, CAN Network, RS232.

 x8 10bit Analog Inputs

 x8 digital Out, with PWM

 x4 Servo Motor Connections

 x4 Status LEDS

I’ve just downloaded the the demo and could access the board from a browser via the ethernet.  Tonight I’ll look at putting it on Buzzbot.