Friday, September 01, 2006

Correcting Wheel Slippage Using the HiTechnic Compass

So, after having learned a few things on how to program using the HiTechnic compass sensor, I was itching to make the compass something really useful and really robotic.

One of the main challenges when driving robots, is to know where the robot is. One common approach is to count the number of times the wheels have turned. Then, to navigate back, just go back on your steps. You can make your robot navigate back taking the shortest route by using trigonometry. The principle described is generally referred to as odometry. But as you can guess, when the wheels slip, your calculated position is no longer accurate.

Usually, the robot doesn’t notice when a wheel is slipping. But if only one wheel is slipping, the robot while veer to the left or the right. And with the HiTechnic Compass, we can detect that.

So, the challenge I put to myself is this: build a robot that continuously corrects its heading such that it keeps driving straight even as its wheels slip.

To make testing a little easier, I decided to put different sized wheels on the robot. The robot will also veer off in a direction, and needs to compensate. The software is actually identical.

And here’s the result of the software. Notice the wheel size difference, and that changing the wheels halfway the movie requires the robot to adjust in a completely different direction.:



This was accomplished by this rather trivial piece of software:
Software to steer on compass


The basic working principle is that the difference between the compass heading and the start direction controls the steering. I multiply by 4 to increase the effect on the steering correction. And that’s it!

A few points to note:
  • I have not received a custom Compass sensor from HiTechnic yet, so for now I have built my own brick that returns the heading (0 – 359°) as one of its parameters. When the sensor from HiTechnic comes, I can simply replace the my brick with the official HiTechnic software brick.
  • The Debug brick simply puts a number on the screen, which is something I need all the time as well.
  • I’m starting to enjoy this My Brick feature. I’ll be exploring this feature more in the future.
So there it is, the first practical compass application. But off course, there is lots more that can be done using the compass. What would you do with a compass on your robot?

8 Comments:

At September 01, 2006 6:21 PM , Anonymous Anonymous said...

Can you show how you made the custom compass block? I have the new 4 motor multiplexer from mindsensors.com. For now the NBC code is a bit too much for me to learn. Is there a way to make my own multiplexer block?

 
At September 01, 2006 7:02 PM , Anonymous Anonymous said...

I quickly looked through the documentation for the Mindsensors multiplexer, and I think you can't make an NXT-G part in the same way as I did for the HiTechnic compass, which is to define a user defined MyBrick. But I don't have the MindSensors multiplexer, so I cannot experiment with the values returned.

That said, it certainly IS possible to define a custom NXT-G brick that drives the MindSensor multiplexer directly from NXT-G, just not with a MyBrick.

As it happens, I was investigating making custom bricks for something totally different. But I can tell you I'm still digging through the documentation published by Lego. I think I'll at least need the LabView software and some experience with it.

In short, I can't help you right now but this is something that will get resolved as time goes by.

Sorry, Filip.

PS. If anybody has experience with building custom bricks (NOT MyBricks), please leave me a note. I'd love to learn more.

 
At September 02, 2006 2:43 AM , Blogger Jason said...

Hi Filip

It shows that the video is no longer available :(

Jason

 
At September 02, 2006 10:59 AM , Anonymous Anonymous said...

Hi Jason,

At first I thought YouTube was just overloaded and it would a few minutes, then hours, ...

Now, I'm also trying to re-upload the video because it's almost been a full day and the video still isn't there.

Hope it works this time.

Filip.

 
At September 02, 2006 3:00 PM , Blogger Brian Davis said...

I noticed you edited your own icons for your MyBlocks and stampped the MyBlocks with them - that might be a useful thing to document for the community (hint hint)... Nice program solution to the problem as well. I've played with non-linear (quadratic) corrections based on the error as well, which works OK in some cases, overshoots in others.

--
Brian Davis

 
At September 02, 2006 11:28 PM , Anonymous Anonymous said...

Hi Brian,

I will publish about how to do that icon thingy. I'll bump it up to the second place in the list of things to write about. There is just no end to the kind of things to write about this set. Totally addictive.

Thanks also for checking back. In the future (make that far future), I'll have comment RSS feeds so that things will be easier to monitor. But that might well be two to three months in the future.

Filip.

 
At September 02, 2006 11:28 PM , Anonymous Anonymous said...

The YouTube delay is getting ridiculous.

 
At September 04, 2006 1:11 PM , Anonymous Anonymous said...

I published the Icon thing in this post.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home