Commit 6cc07497 authored by drallensmith's avatar drallensmith

Revert "Trying to deal with 'Violated Feature Bounds' errors for self, ball...

Revert "Trying to deal with 'Violated Feature Bounds' errors for self, ball position - match documentation" - compatibility worries
Will experiment with low-level features while consulting re errors

This reverts commit 76209cdb.
parent ad2f94bc
...@@ -36,45 +36,32 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -36,45 +36,32 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
// Allow the agent to go 10% over the playfield in any direction // Allow the agent to go 10% over the playfield in any direction
float tolerance_x = .1 * SP.pitchHalfLength(); float tolerance_x = .1 * SP.pitchHalfLength();
float tolerance_y = .1 * SP.pitchHalfWidth(); float tolerance_y = .1 * SP.pitchHalfWidth();
// figure up min, max x, y
float min_x = 0; // Depends on offense vs defense
float max_x = 0;
if (playingOffense) {
min_x = -tolerance_x;
max_x = SP.pitchHalfLength() + tolerance_x;
} else {
min_x = -SP.pitchHalfLength()-tolerance_x;
max_x = tolerance_x;
}
float min_y = -SP.pitchHalfWidth() - tolerance_y;
float max_y = SP.pitchHalfWidth() + tolerance_y;
// Feature[0]: X-postion // Feature[0]: X-postion
// Feature[1]: Y-position if (playingOffense) {
if (valid(self)) { addNormFeature(self_pos.x, -tolerance_x, SP.pitchHalfLength() + tolerance_x);
addNormFeature(self_pos.x, min_x, max_x);
addNormFeature(self_pos.y, min_y, max_y);
} else { } else {
addFeature(FEAT_INVALID); addNormFeature(self_pos.x, -SP.pitchHalfLength()-tolerance_x, tolerance_x);
addFeature(FEAT_INVALID);
} }
// Feature[1]: Y-Position
addNormFeature(self_pos.y, -SP.pitchHalfWidth() - tolerance_y,
SP.pitchHalfWidth() + tolerance_y);
// Feature[2]: Self Angle // Feature[2]: Self Angle
addNormFeature(self_ang, -M_PI, M_PI); // Check for validity? addNormFeature(self_ang, -M_PI, M_PI);
float r; float r;
float th; float th;
// Features about the ball // Features about the ball
const BallObject& ball = wm.ball(); Vector2D ball_pos = wm.ball().pos();
if (ball.rposValid()) { angleDistToPoint(self_pos, ball_pos, th, r);
Vector2D ball_pos = ball.pos(); // Feature[3] and [4]: (x,y) postition of the ball
angleDistToPoint(self_pos, ball_pos, th, r); if (playingOffense) {
// Feature[3] and [4]: (x,y) postition of the ball addNormFeature(ball_pos.x, -tolerance_x, SP.pitchHalfLength() + tolerance_x);
addNormFeature(ball_pos.x, min_x, max_x);
addNormFeature(ball_pos.y, min_y, max_y);
} else { } else {
addFeature(FEAT_INVALID); addNormFeature(ball_pos.x, -SP.pitchHalfLength()-tolerance_x, tolerance_x);
addFeature(FEAT_INVALID);
} }
addNormFeature(ball_pos.y, -SP.pitchHalfWidth() - tolerance_y, SP.pitchHalfWidth() + tolerance_y);
// Feature[5]: Able to kick // Feature[5]: Able to kick
addNormFeature(self.isKickable(), false, true); addNormFeature(self.isKickable(), false, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment