Commit 28277174 authored by Matthew Hausknecht's avatar Matthew Hausknecht Committed by GitHub

Merge pull request #81 from cshNtu/master

Fix the computation of maximum distance within playable area
parents 5b14b7d0 9e460ba0
...@@ -9,6 +9,9 @@ __WARNING: HFO is not actively maintained!__ We accept pull requests and bug fix ...@@ -9,6 +9,9 @@ __WARNING: HFO is not actively maintained!__ We accept pull requests and bug fix
[Half Field Offense in RoboCup 2D Soccer](http://www.cs.utexas.edu/~AustinVilla/sim/halffieldoffense/) is a subtask in RoboCup simulated soccer, modeling a situation in which the offense of one team has to get past the defense of the opposition in order to shoot goals. This repository offers the ability to quickly and easily interface your learning agent with the HFO domain. Interfaces are provided for C++ and Python. [Half Field Offense in RoboCup 2D Soccer](http://www.cs.utexas.edu/~AustinVilla/sim/halffieldoffense/) is a subtask in RoboCup simulated soccer, modeling a situation in which the offense of one team has to get past the defense of the opposition in order to shoot goals. This repository offers the ability to quickly and easily interface your learning agent with the HFO domain. Interfaces are provided for C++ and Python.
NOTE: The previous distances, normalized to a range of -1 to 1, returned in the two state spaces were being divided by a too-small maximum distance; the correction for this should be accounted for in existing code. (An example of such a correction can be seen in `./example/high_level_custom_agent.py`.)
## Dependencies ## Dependencies
- Boost-system, filesystem - Boost-system, filesystem
- Qt4 [Required for SoccerWindow2 visualizer]: To not build the visualizer, add cmake flag `-DBUILD_SOCCERWINDOW=False` - Qt4 [Required for SoccerWindow2 visualizer]: To not build the visualizer, add cmake flag `-DBUILD_SOCCERWINDOW=False`
......
...@@ -341,8 +341,11 @@ features. ...@@ -341,8 +341,11 @@ features.
red-rectangle shows the boundaries of the reported positions, red-rectangle shows the boundaries of the reported positions,
which exceed the play field boundaries by 10\% in each which exceed the play field boundaries by 10\% in each
direction. Positions exceeding this rectangle are bounded (via direction. Positions exceeding this rectangle are bounded (via
min/max) to the edges of the rectangle. All distance features are min/max) to the edges of the rectangle. (Note that this does
normalized against the max HFO distance shown in orange.} \textbf{not} mean that agents are limited to this rectangle;
low-level movement actions (Section \ref{sec:low_level_actions})
can go outside it.) All distance features are normalized against
the max HFO distance shown in orange.}
\label{fig:playfieldCoords} \label{fig:playfieldCoords}
\end{figure} \end{figure}
...@@ -430,8 +433,8 @@ the common 'atan2' function as $atan2(\alpha_1, \alpha_2)$. ...@@ -430,8 +433,8 @@ the common 'atan2' function as $atan2(\alpha_1, \alpha_2)$.
\subsubsection{Proximity Features} \subsubsection{Proximity Features}
\textit{Proximity features} encode the proximity of the agent to an \textit{Proximity features} encode the proximity of the agent to an
object of interest. Unless otherwise indicated, they are normalized object of interest. Unless otherwise indicated, they are normalized
against the maximum possible distance in the HFO playfield (defined as against the maximum possible distance in the in-bounds HFO playfield (defined as
$\sqrt{l^2 + w^2}$ where $l,w$ are the length and width of the HFO $\sqrt{l^2 + w^2}$ where $l,w$ are the length and width of the in-bounds HFO
playfield). A maximum proximity of 1 indicates the agent is co-located playfield). A maximum proximity of 1 indicates the agent is co-located
with the object of interest, while a minimum proximity of -1 indicates with the object of interest, while a minimum proximity of -1 indicates
that the agent is across the field from the object of interest. that the agent is across the field from the object of interest.
...@@ -533,7 +536,7 @@ low-level features: ...@@ -533,7 +536,7 @@ low-level features:
The HFO domain provides support for both low-level primitive actions, The HFO domain provides support for both low-level primitive actions,
mid-level, and high-level strategic actions. Low-level, parameterized mid-level, and high-level strategic actions. Low-level, parameterized
actions are provided for locomotion and kicking. Mid-level actions are actions are provided for locomotion and kicking. Mid-level actions are
still mostly parameterized but capture high-level activities such as still mostly parameterized but capture higher-level activities such as
dribbling. Finally, high-level discrete, strategic actions are dribbling. Finally, high-level discrete, strategic actions are
available for moving, shooting, passing and dribbling. Control of the available for moving, shooting, passing and dribbling. Control of the
agent's head and gaze is not provided and follows Agent2D's default agent's head and gaze is not provided and follows Agent2D's default
...@@ -549,7 +552,7 @@ faithfully report which action spaces were used. ...@@ -549,7 +552,7 @@ faithfully report which action spaces were used.
100] where negative values move backwards. The relative direction 100] where negative values move backwards. The relative direction
of movement is given in degrees and varies between [-180,180] with 0 of movement is given in degrees and varies between [-180,180] with 0
degrees being a forward dash and 90 degrees dashing to the agent's degrees being a forward dash and 90 degrees dashing to the agent's
right side. Note, dashing does not turn the agent.} right side. Note that dashing does not turn the agent.}
\item{\textbf{Turn}(degrees): Turns the agent in the \item{\textbf{Turn}(degrees): Turns the agent in the
specified direction. Valid values range between [-180, 180] degrees specified direction. Valid values range between [-180, 180] degrees
where 90 degrees turns the agent to directly to its right side.} where 90 degrees turns the agent to directly to its right side.}
......
...@@ -33,7 +33,7 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm, ...@@ -33,7 +33,7 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
const PlayerPtrCont& teammates = wm.teammatesFromSelf(); const PlayerPtrCont& teammates = wm.teammatesFromSelf();
const PlayerPtrCont& opponents = wm.opponentsFromSelf(); const PlayerPtrCont& opponents = wm.opponentsFromSelf();
float maxR = sqrtf(SP.pitchHalfLength() * SP.pitchHalfLength() float maxR = sqrtf(SP.pitchHalfLength() * SP.pitchHalfLength()
+ SP.pitchHalfWidth() * SP.pitchHalfWidth()); + SP.pitchWidth() * SP.pitchWidth());
// features about self pos // features about self pos
// 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();
......
...@@ -105,16 +105,16 @@ LowLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm, ...@@ -105,16 +105,16 @@ LowLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
rcsc::Vector2D cornerBotLeft(0, pitchHalfWidth); rcsc::Vector2D cornerBotLeft(0, pitchHalfWidth);
addLandmarkFeatures(cornerBotLeft, self_pos, self_ang); addLandmarkFeatures(cornerBotLeft, self_pos, self_ang);
// Distances to the edges of the playable area // Distances to being out of bounds (OOB)
if (self.posValid()) { if (self.posValid()) {
// Distance to Left field line // Distance to being OOB over the Left field line
addDistFeature(self_pos.x, pitchHalfLength); addDistFeature(self_pos.x, (1.1*pitchHalfLength));
// Distance to Right field line // Distance to being OOB over the Right field line
addDistFeature(pitchHalfLength - self_pos.x, pitchHalfLength); addDistFeature(pitchHalfLength - self_pos.x, (1.1*pitchHalfLength));
// Distance to top field line // Distance to being OOB over the Top field line
addDistFeature(pitchHalfWidth + self_pos.y, pitchWidth); addDistFeature(pitchHalfWidth + self_pos.y, (1.05*pitchWidth));
// Distance to Bottom field line // Distance to being OOB over the Bottom field line
addDistFeature(pitchHalfWidth - self_pos.y, pitchWidth); addDistFeature(pitchHalfWidth - self_pos.y, (1.05*pitchWidth));
} else { } else {
addFeature(0); addFeature(0);
addFeature(0); addFeature(0);
......
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