[Home]PerpendicularMovement

Robo Home | Changes | Preferences | AllPages

This is where you try to keep e.getBearing() in the ScannedRobotEvent at a right angle. That is, your heading is 90 degrees (or PI/2 radians) away from the direction towards the other bot.

Usually, but not entirely necessarily, practiced by Oscillators

Also practiced by bots that circle around the enemy, as in the Saturn series of bots - Iapetus?, Titan?, Calypso?, Pandora - check https://www.nineplanets.org to see where those names come from :-)

Used by very many bots because it gives easier opportunity for Dodging?.

Very boring movement style, but effective.

A variation is found in the FluidMovement implemented in Neptune, where you try to stay as perpendicular as possible to everything that matters: enemy bots, walls, enemy bullets (ShrapnelDodging). Kind of like toothpaste in a tube behaves when you squeeze it onto a toothbrush.

--tobe

Does anyone have a good method that keeps your bot at a set distance from another bot with BackAsFront? -- KID

You can use something like this. It is a bit rigid because it always uses the same angle (roughly 60 degrees) to get to its preferred distance, but you can always change it to your needs.

diveAngle = Utils.normalRelativeAngle(enemy.getBearing() + Math.PI/2);
defTurnAngle = Math.atan(Math.tan(diveAngle));
distDiff = enemy.getDistance() - DEFDISTANCE;  // DEFDISTANCE is preferred distance
adjustAngle = (diveAngle == defTurnAngle ? currDirection : -currDirection);
if (distDiff < 0) {
       adjustAngle *= 1;
   }
   else {
       adjustAngle *= -1;
   }
}
setTurnRightRadians(defTurnAngle + adjustAngle);
I use currDirection to go forwards or backwards, because I do not use negative distances. This is not the same as direction in BackAsFront ! -- GrubbmGait

I think this way is easier. I use it in Uba.

                    //You need these as a universal variables
                    double dir = 1;
                    static final double favorite = 200; //set Favorite to how far away you want to be!

                    //this goes in onScannedRobot
		    if(getDistanceRemaining() == 0){
			    dir=-dir;
			    setAhead(300*Math.random()*dir);
		    }
		    setTurnRight(t.getBearing() + 90 - 90*Math.random()*dir*
		    (t.getDistance()>favorite?1:-1));

Just set favorite to your favorite distance! --Bayen


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited February 17, 2006 20:24 EST by Bayen (diff)
Search: