Let's Make Robots!

Help me come up with a more clever way to detect opponents



I've built a minisumo-robot for a competition this saturday(http://www.robotchampion.se). It works quite ok, but I feel that my opponent detection is somewhat unoptimized.(Don't worry, I'll make a post with videos, pictures and such when the competition's over, no time for submissions right now, mah code needs optimizing!)

Right now I have two Sharp IR-sensors looking forward giving me a viewfield of about 120 degrees. I have an if-statement that turns left if the right sensor is closest and vice versa.

I feel that there's some clever mathematical solution to this though. Like making it turn more if the difference is bigger, I just don't know what sort of mathematical function I'm looking for, surely it must have a name right?

If you've done something similiar do share your math, I would be delighted to see how you solved it.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I'm currently thinking about some sort of PD-loop, but I don't think that's the best way to do it. Since a PD-loop is for maintaning a value within a certain range, something I don't want(I think).

You just have to reframe your problem.

You're probably right. I'm not sure how though.


I spent some time reading about trigonometrics today, maybe something that tries to keep the sides of the triangle that is the sensors detection range in some certain angle?

I've looked at things like triliteration, and it seems it's close to what I need. However, I don't know how to express this as a function or in programming. Has anyone done anything similiar and want to share their pseudocode with me? I just don't know where to look for examples really.