Commit 560e917d authored by Matthew Hausknecht's avatar Matthew Hausknecht

Removed normalization of high-level hfo features.

parent 94c1d9a3
...@@ -41,16 +41,12 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -41,16 +41,12 @@ 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();
if (playingOffense) { // Feature[0]: Xpostion // Feature[0]: Xpostion
addNormFeature(self_pos.x, -tolerance_x, SP.pitchHalfLength() + tolerance_x); addFeature(self_pos.x);
} else {
addNormFeature(self_pos.x, -SP.pitchHalfLength()-tolerance_x, tolerance_x);
}
// Feature[1]: YPosition // Feature[1]: YPosition
addNormFeature(self_pos.y, -SP.pitchHalfWidth() - tolerance_y, addFeature(self_pos.y);
SP.pitchHalfWidth() + tolerance_y);
// Feature[2]: Self Angle // Feature[2]: Self Angle
addNormFeature(self_ang, -2*M_PI, 2*M_PI); addFeature(self_ang);
float r; float r;
float th; float th;
...@@ -58,11 +54,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -58,11 +54,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
Vector2D ball_pos = wm.ball().pos(); Vector2D ball_pos = wm.ball().pos();
angleDistToPoint(self_pos, ball_pos, th, r); angleDistToPoint(self_pos, ball_pos, th, r);
// Feature[3]: Dist to ball // Feature[3]: Dist to ball
addNormFeature(r, 0, maxR); addFeature(r);
// Feature[4]: Ang to ball // Feature[4]: Ang to ball
addNormFeature(th, -2*M_PI, 2*M_PI); addFeature(th);
// Feature[5]: Able to kick // Feature[5]: Able to kick
addNormFeature(self.isKickable(), false, true); addFeature(self.isKickable());
// features about distance to goal center // features about distance to goal center
Vector2D goalCenter(SP.pitchHalfLength(), 0); Vector2D goalCenter(SP.pitchHalfLength(), 0);
...@@ -71,18 +67,18 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -71,18 +67,18 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
} }
angleDistToPoint(self_pos, goalCenter, th, r); angleDistToPoint(self_pos, goalCenter, th, r);
// Feature[6]: Goal Center Distance // Feature[6]: Goal Center Distance
addNormFeature(r, 0, maxR); // Distance to goal center addFeature(r);
// Feature[7]: Angle to goal center // Feature[7]: Angle to goal center
addNormFeature(th, -2*M_PI, 2*M_PI); // Ang to goal center addFeature(th);
// Feature[8]: largest open goal angle // Feature[8]: largest open goal angle
addNormFeature(calcLargestGoalAngle(wm, self_pos), 0, M_PI); addFeature(calcLargestGoalAngle(wm, self_pos));
// Feature [9+T]: teammate's open angle to goal // Feature [9+T]: teammate's open angle to goal
int detected_teammates = 0; int detected_teammates = 0;
for (PlayerCont::const_iterator it=teammates.begin(); it != teammates.end(); ++it) { for (PlayerCont::const_iterator it=teammates.begin(); it != teammates.end(); ++it) {
const PlayerObject& teammate = *it; const PlayerObject& teammate = *it;
if (valid(teammate) && detected_teammates < numTeammates) { if (valid(teammate) && detected_teammates < numTeammates) {
addNormFeature(calcLargestGoalAngle(wm, teammate.pos()), 0, M_PI); addFeature(calcLargestGoalAngle(wm, teammate.pos()));
detected_teammates++; detected_teammates++;
} }
} }
...@@ -94,8 +90,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -94,8 +90,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
// dist to our closest opp // dist to our closest opp
if (numOpponents > 0) { if (numOpponents > 0) {
calcClosestOpp(wm, self_pos, th, r); calcClosestOpp(wm, self_pos, th, r);
addNormFeature(r, 0, maxR); addFeature(r);
//addNormFeature(th,-M_PI,M_PI);
// teammates dists to closest opps // teammates dists to closest opps
detected_teammates = 0; detected_teammates = 0;
...@@ -104,7 +99,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -104,7 +99,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
if (valid(teammate) && detected_teammates < numTeammates) { if (valid(teammate) && detected_teammates < numTeammates) {
//addNormFeature(calcClosestOpp(wm,teammate.pos),0,maxR); //addNormFeature(calcClosestOpp(wm,teammate.pos),0,maxR);
calcClosestOpp(wm, teammate.pos(), th, r); calcClosestOpp(wm, teammate.pos(), th, r);
addNormFeature(r, 0, maxR); addFeature(r);
//addNormFeature(th,-M_PI,M_PI); //addNormFeature(th,-M_PI,M_PI);
detected_teammates++; detected_teammates++;
} }
...@@ -120,7 +115,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -120,7 +115,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
for (PlayerCont::const_iterator it=teammates.begin(); it != teammates.end(); ++it) { for (PlayerCont::const_iterator it=teammates.begin(); it != teammates.end(); ++it) {
const PlayerObject& teammate = *it; const PlayerObject& teammate = *it;
if (valid(teammate) && detected_teammates < numTeammates) { if (valid(teammate) && detected_teammates < numTeammates) {
addNormFeature(calcLargestTeammateAngle(wm, self_pos, teammate.pos()),0,M_PI); addFeature(calcLargestTeammateAngle(wm, self_pos, teammate.pos()));
detected_teammates++; detected_teammates++;
} }
} }
...@@ -135,8 +130,8 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -135,8 +130,8 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
const PlayerObject& teammate = *it; const PlayerObject& teammate = *it;
if (valid(teammate) && detected_teammates < numTeammates) { if (valid(teammate) && detected_teammates < numTeammates) {
angleDistToPoint(self_pos, teammate.pos(), th, r); angleDistToPoint(self_pos, teammate.pos(), th, r);
addNormFeature(r,0,maxR); addFeature(r);
addNormFeature(th,-M_PI,M_PI); addFeature(th);
detected_teammates++; detected_teammates++;
} }
} }
...@@ -147,7 +142,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -147,7 +142,7 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
} }
assert(featIndx == numFeatures); assert(featIndx == numFeatures);
checkFeatures(); // checkFeatures();
//std::cout << "features: " << features.rows(0,ind-1).t(); //std::cout << "features: " << features.rows(0,ind-1).t();
return feature_vec; return feature_vec;
} }
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