improving obstacle detection with trigonometry -
29-01-2004
I am improving my BotWalkPath() function, and for that, I have decided to make the obstacle detection radius vary not only on the bot's speed, but also on the direction. Currently the bot checks for obstacle in front of him, on the left, and on the right. Obviously not behind, since it can't see them.
I want the detection radii (latin, 2nd declination ?) be function of the direction the bot is moving towards. That's to say, if the bot is strafing right, the obstacle detection radius on the right should be greater than the obstacle detection radius in front, and of course even greater than the one on the left, which should be near zero (since the bot is NOT moving left but RIGHT).
A little drawing will help (attached).
The bot is the red thingy.
The RED arrow is where the bot is LOOKING
The GREEN arrow is where the bot is MOVING
The 3 blue dots are where the bot's points of obstacle detection should be : since the bot is moving right, and a bit forward, the detection point on the right should be far away from the bot, and the detection point in front should be closer to the bot (since the bot is moving right MORE than it is moving forward), while the detection point on the left should be very close to the bot.
This is pretty much trigonometry, as seen in the triangle in the bottom right corner of the sketch. I know angle alpha, I know V (it's the velocity of the bot), what I want to know is d, the distance ahead of the bot at which I should put my detection point. If I can do that for the forward point, I will be able to do it for the left and right points as well.
But since I'm legendary good at math, and especially at trigo, gentlemen I beg for your help.
And also feel free to discuss on the idea itself ; is it good, is it bad, what can be improved, etc., etc.
RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
Last edited by Pierre-Marie Baty; 29-01-2004 at 16:33..
Reason: changed thread title to something more relevant
|