Thinking through the navigation stuff... was thinking maybe it'd help to have steering correction that is non-linear with regard to the distance to the wall. Thankfully Grapher on the Mac makes it easy for a guy like yours truly to visualize some possibilities. I don't have it worked out and won't before tomorrow.
Rather than working out some complex equation, maybe a simple lookup table is easiest to concoct. What I'd want is minor steering correction (extremely long radius turn, so a small ratio of left to right speeds) for, let's say up to ±2cm distance, with increasingly harder (higher ratio left to right, shorter radius) turning for up to ±10cm distances. Beyond that, a routine that stops, searches for the wall angle, drives perpendicular to the wall and stops within the right range.
The other thought is, when you're driving a car and you want to change lanes, you don't just turn and hold your steering wheel. You turn it until you are starting to change direction at the rate you want, then you center the wheel, then turn in the opposite direction when you get into the correct lane. In correcting (especially large) distance to wall error, the robot should turn to correct distance errors but stop turning as it approaches a maximum rate of change in error, then turn the opposite way as the distance error grows low enough, seeking both 0 rate of change and 0 error. How would I get all this to work? I don't know for sure.
What I do now for sure is that once again I have no time to finish. Didn't this happen last time? A midterm that showed up right at the same time as the robotics contest? Hmph. So much for vindication... :)
So, will run Pokey as-is. I know he can get to the hard room with moderate consistency. I don't know if he can make it to room #2 let alone #3. #4 is right out. The candle scanning routine is no better than it was when it failed miserably last time. Ah well.
There's always next time :)
Meanwhile, the robotics expo / contest is going to be a LOT of fun with some cool vendor attendees and lots of robots to look at. Really looking forward to it!
assume the wall is on the right of the bot...
ReplyDeletepardon my C centric approach but if I remember correctly you programmed the bot in C so you should understand it alright
make 2 variables:
int distance_to_wall /* stores most recent measure of distance) */
int last_distance_to_wall /*stores the last recorded distance */
if distance_to_wall is too much {
if you're father away than last time,
(distance_to_wall > last_distance_to_wall) then turn right and go forward a bit, then measure again and start over
if you're closer than last time,
(distance_to_wall < last_distance_to_wall) go forward a bit more, then measure again and start over
}
if distance_to_all is too little {
... you get the idea
}
if you want you could also add more logic to determine how much closer you want it to be with each cycle, in order to avoid near-parallel driving when you're really far from the wall...
maybe use a multiplier derived from how large the error is. That would even give you a nice rounded turn :)
WOW that was a long comment lol
ReplyDelete