|
Re: Little help Please (with dead reconing code)
Ok, I don't have any exact code on hand, but our bot from last year ran on only dead reconing. There are a few things you need to take into concideration:
1) Timing vs. absolute positioning
2) Does the bot drift? Can you stop that?
3) Acceleration/deceleration and it's effect on the bot
Learning from last year, doing dead reconing based soley upon time is a bad idea. Our primary problem was drift. On paper, our timing worked, but because when we turned one motor wasn't powered, it drifted and threw everything off. In other words, saying pwm13 = 254 for half a second isn't a good idea.
What I would recoment would be a way of absolute postitioning. Instead of relying on time, give your bot a way to know exactly ( not using time x speed) of where it is. One way to do this is by using encoded sensors (such as in a mouse). By making your axis spin an encoded sensor that is hooked up to the FRC, the bot can tell how many revolutions it has traveled. By using some simple algebra using your wheel radius, you can find out how far you travel with each revolution.
You can also do a few neat things with this. For instance:
1) if your bot is stoped, and someone pushes it, the bot can sense that and pe programmed to fight back
2) you can use it to prevent drift. If pwm 13 is @ 127, and another is @ 254 (simulating a turn like a tank), then the bot can sense if it's drifting and can either prevent it by fighting back or can make up for it.
So basically, now that you're armed with this knowledge, you can beging to program some dead reconing code.
You can (using coded discs) tell the bot to go x number of revolutions @ a certain speed as opposed to telling your bot to travel at speed 254 for 2 seconds. I'm not sure how clear this is going to come across, but I'll be sure to check this thread again. Feel free to PM me.
~Brian
|