Talk:Advancing Velocity

From Robowiki
Revision as of 23:11, 21 October 2010 by A.h.russ (talk | contribs) (Created page with 'I tried using the sign of the advancing velocity in CassiusClay version 1.9.6.10. But I think maybe I did that segmentation the wrong way. This is the relevant code: <pre> doubl…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I tried using the sign of the advancing velocity in CassiusClay version 1.9.6.10. But I think maybe I did that segmentation the wrong way. This is the relevant code:

	double approachVelocity = e.getVelocity() * -Math.cos(e.getHeadingRadians() - enemyBearing);
	wave.approachSignIndex = 1 + (approachVelocity == 0 ? 0 : PUtils.sign(approachVelocity));

-- PEZ

This is how I calculate advancing velocity, so assuming enemyBearing above is the abs bearing then it's exactly the same.

	double advancingvelocity = -Math.cos(firedAt.getValue(firedAt.heading, stepsBack)-PulsarMax.robotStats.getAbsBearingTo(firedAt, stepsBack))*firedAt.getValue(firedAt.velocity, stepsBack);

Clearer:

	double advancingvelocity = -Math.cos(enemyHeading-absBearingToEnemy)*enemyVelocity;

But most of all I think comparing that double to 0 is way to restrictive. Have some margin instead perhaps? This is coming from somone with 50 less score of course though...

-- Pulsar

Yes, I always forget about the danger in comparing doubles to 0. But in this case it might hold since it's a true zero value in the velocity reading I want to check for. I'll test with some debug outputting now. Thanks! -- PEZ

Yup. You are entirely right. I get very few hits in the middle bucket the above way. In fact I get exactly what I asked for when thinking zero velocity would be the mid bucket. That's not very good... -- PEZ

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.

There are no threads on this page yet.