Check out the new projects site for A-i-S

Sunday, July 20, 2008

The dawn...

Today I set up the Mega168v Board to control the servos.

I also remounted all the boards to be more secure.

I also switched in 4xAAA for the previous 4xAA battery pack to lower the centre of gravity.

Tomorrow I hope to look to the Procyon "cmdline" example to receive UART input properly using Procyon.

I suspect I will attach my own function to be a handler for when UART data is in the UART buffer.

Wednesday, July 16, 2008

Channelling Mother Earth

Seems I have a problem with the Earth.....the Earthing of my bot that is.....

At first glance the dodgy connection on the UART is causing it but I think that is a smoke screen for an earthing issue elsewhere that is related to the Mega32 reset pin not letting it start up on occasion (especially when the ISP head isn't plugged in to control the reset pin).


Apart from that, tonight I've started implementing better collision avoidance. I'm using random numbers between 0-9 to determine what behaviour to implement when an obstacle is detected.

I chose to use a range so that I could weight the probability of which behaviour occurred as well as have the resolution in decision making to add new behaviours (like a little bit left, bit more left than that etc etc).

That is the plan, I am sure I'll need to iron out a few bugs before it works as expected.

Sunday, July 13, 2008

The machinations of thought

Well my machine can think.....sort of.....

I got the re-worked code to operate satisfactorily.

Using FreeRTOS tasks I've created a modular set of code for my bot. Every 300ms the sensors are checked, every 400 the motor driver board is updated and every 300 ms the main "thought" logic is applied.

Yes so far I have 3 FreeRTOS tasks running, the maximum for a Mega32 is said to be around ten.

I do have an issue with portTICK_RATE_MS which is only kludged at this stage. I still don't quite get where this MACRO is set and how. I am using it to convert from CPU ticks to millieseconds and from what is coming out on UART I'm guess the MS calculation is about 50% slow. I changed configTICK_RATE_HZ to 1000 from 200 but I'm still unsure exactly what this effects. (Note I have set the correct clock rate of 16Mhz so no errors should be coming from there).

Oh well, time to put it to one side and do something else this evening, I've cleaned up the code, documented it, extended it to about 600 lines in the main program (up by 200), ironed out some logic bugs and ensured the glue logic to motors and IR sensors works as expected.

All in all quite a good effort, accelerometer to be next or maybe just proper collision avoidance and handling.

Note about FreeRTOS tasks

Just a quick about FreeRTOS tasks.

Don't forget that if the highest priority task runs wihtout a delay in it, it will stomp all over any lower priority tasks.

Saturday, July 12, 2008

Return to normal scheduling...

Well I got back to coding for my "Think tank" today (Think Tamiya track base with a Mega32 on it).

I was happy with the functionality of the code when I left it previously. I had included FreeRTOS to create tasks to drive and poll distance sensors. So today I decided to clean the code up considerably and document it properly.

Now I've done that I'm able to start implementing "behaviour". This will be the task for tomorrow. I also hope to implement the tilt sensor tomorrow.

Still not sure how I'm going to create the code for the servos just yet. FreeRTOS seems pretty happy at the moment so I don't think I'll tinker with FreeRTOS' timer code. I'll have to play with Procyon's timer code or just write my own from scratch. This decision will be influenced by how many servos I think I will end up controlling. I actually think I'll create a "daughter board" which acts on UART commands to control servos.

BTW having a 19" monitor on my development machine is so much better than the old 15". I am not squinting as much and can actually see all of AVRStudio in one view :)

Arduino bandwagon - I'm on it...

Ok every man and his dog is talking about the AVR based Arduino platform. Admittedly I haven't played with this yet but have seen that it is a) Easily to use b) Truly open source.

So with that in mind I thought what the heck and ordered an Arduino Decilima (sp?) from Little Bird Electronics today. A bit pricey but there are in Australia so hopefully it won't take too long to arrive.

Rs Media and friends

Well a couple of weeks ago I was at the DJ's outlet store and saw RS Medias on sale for $150 so I grabbed one.

I haven't looked into these or similar Robosapiens before. I did like the fact that it had a Linux OS proudly proclaimed on the box but didn't like the fact that when I got home, I found that they had failed to release meaningful source code.

I have also had issues getting the software to work on Windows 2K or Vista. I'll try XP when I get a chance.

A further annoying thing is that there was a proper SDK released at a Java trade show a while back but the SDK was not released to the public. There is talk that maybe they will release it. This is tantalisingly annoying - there is a CD out there that lets you play with the VGA camera, microphones, and bipedal motion but you can't buy / beg /borrow or steal it.


Apart from that, it is pretty amazing - does chew through the batteries pretty quickly though.