Talk:Circular Targeting
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
- [View source↑]
- [History↑]
You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.