Talk:Circular Targeting

From Robowiki
Jump to navigation Jump to search

General discussion

Does anyone have a good way to put the iterative predicitive stuff (ala the NCLP) into an ExtendsRobot bot? --Alphax

FOR loops --UnderDark

Thank you, Captain Obvious.

The problem is that it's useful to have scans on consecutive ticks for that. You could either stop your bot and try and get two consecutive scans, or if the other bot is really moving in a roughly even curve, you can find the change in heading and divide it by the number of ticks between observations.

Of course, you should probably just use an AdvancedRobot, or not do circular targeting - if you're trying to enter it into a competition where only ExtendsRobot is allowed, none of your opponents will be moving in curves. -- Kawigi

double TurnRate = (Math.abs(Heading1-Heading2))/(Math.abs(TimeOfHeading1-TimeOfHeading2));

Hope this helps --UnderDark

Here is a play on Circular Targeting, it uses math only, its the Orbit gun from my nanobot Orbit (expanded of course, which wasn't an easy task). This piece of code could maybe be changed into a circle gun by putting something into the aimAngle calculation. (and calculating where that center is).

Orbit's Gun

double absoluteBearing = e.getBearingRadians() + getHeadingRadians();
double lateralVelocity = e.getVelocity() * Math.sin(e.getHeadingRadians() - absoluteBearing);
double bulletSpeed = (20 - 3 * bulletPower);
double distance = e.getDistance();
double circularTravel = absoluteBearing + lateralVelocity / bulletSpeed;
double aimAngle = Math.atan2(distance * Math.sin(circularTravel), distance * Math.cos(circularTravel));
turnGunRightRadians(Utils.normalRelativeAngle(-getGunHeadingRadians() + aimAngle));
  • I'm pretty sure this is just linear targeting. In this equation, aimAngle will always equal circularTravel. -- Simonton
    • Hrm dang, I reversed a equation of a circle to help get that. There must be a way to deloop the loop in a circle gun, its just math! But again simonton is far better at delooping things then I am. --Chase-san

Are there any super-small noniterative nanobotish circular targeting methods? Awesomeness 00:26, 2 May 2009 (UTC)

Sort of. With a little care, you can get circle like aim off a linear cannon if you nudge the lead value based on distance and a sin/cos value. Not 100% accurate, but should hit fairly often. This was done way long ago when we had a nano challenge to hit spinbot. Turns out pattern matching makes it obsolete anyways. --Miked0801 04:54, 2 May 2009 (UTC)
There are no threads on this page yet.