Difference between revisions of "Talk:Advancing Velocity"

From Robowiki
Jump to navigation Jump to search
(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…')
 
m (fix link)
 
Line 1: Line 1:
 +
== Migrated from old wiki ==
 +
 
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:
 
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>
 
<pre>
Line 4: Line 6:
 
wave.approachSignIndex = 1 + (approachVelocity == 0 ? 0 : PUtils.sign(approachVelocity));
 
wave.approachSignIndex = 1 + (approachVelocity == 0 ? 0 : PUtils.sign(approachVelocity));
 
</pre>
 
</pre>
-- [[PEZ]]
+
-- [[User:PEZ|PEZ]]
  
 
This is how I calculate advancing velocity, so assuming enemyBearing above is the abs bearing then it's exactly the same.
 
This is how I calculate advancing velocity, so assuming enemyBearing above is the abs bearing then it's exactly the same.
Line 16: Line 18:
 
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...
 
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]]
+
-- [[User:Pulsar|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]]
+
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! -- [[User:PEZ|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]]
+
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... -- [[User:PEZ|PEZ]]

Latest revision as of 04:20, 22 October 2010

Migrated from old wiki

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