HOG2
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Directional2DEnvironment Class Reference

#include <Directional2DEnvironment.h>

Inheritance diagram for Directional2DEnvironment:
Inheritance graph
[legend]
Collaboration diagram for Directional2DEnvironment:
Collaboration graph
[legend]

Public Member Functions

 Directional2DEnvironment (Map *m, model envType=kVehicle, heuristicType heuristic=kExtendedPerimeterHeuristic)
 
virtual ~Directional2DEnvironment ()
 
void GetSuccessors (const xySpeedHeading &nodeID, std::vector< xySpeedHeading > &neighbors) const
 
void GetActions (const xySpeedHeading &nodeID, std::vector< deltaSpeedHeading > &actions) const
 
deltaSpeedHeading GetAction (const xySpeedHeading &s1, const xySpeedHeading &s2) const
 
virtual void ApplyAction (xySpeedHeading &s, deltaSpeedHeading dir) const
 
virtual void UndoAction (xySpeedHeading &s, deltaSpeedHeading dir) const
 
virtual OccupancyInterface< xySpeedHeading, deltaSpeedHeading > * GetOccupancyInfo ()
 
virtual bool InvertAction (deltaSpeedHeading &a) const
 
virtual double HCost (const xySpeedHeading &node1, const xySpeedHeading &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double HCost (const xySpeedHeading &) const
 Heuristic value between node and the stored goal. More...
 
virtual double GCost (const xySpeedHeading &node1, const xySpeedHeading &node2) const
 
virtual double GCost (const xySpeedHeading &node1, const deltaSpeedHeading &act) const
 
int GetNumAngles ()
 
void SetGoalTest (GoalTester *t)
 
bool GoalTest (const xySpeedHeading &node, const xySpeedHeading &goal) const
 
bool GoalTest (const xySpeedHeading &) const
 Goal Test if the goal is stored. More...
 
uint64_t GetStateHash (const xySpeedHeading &node) const
 
uint64_t GetActionHash (deltaSpeedHeading act) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const xySpeedHeading &l) const
 
virtual void OpenGLDraw (const xySpeedHeading &oldState, const xySpeedHeading &newState, float perc) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const xySpeedHeading &, const deltaSpeedHeading &) const
 
void GLDrawLine (const xySpeedHeading &a, const xySpeedHeading &b) const
 
MapGetMap ()
 
void SetHeuristicType (heuristicType theType)
 
virtual void GetNextState (const xySpeedHeading &currents, deltaSpeedHeading dir, xySpeedHeading &news) const
 
- Public Member Functions inherited from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const xySpeedHeading &stateID) const
 
virtual void StoreGoal (xySpeedHeading &s)
 Stores the goal for use by single-state HCost. More...
 
virtual void ClearGoal ()
 Clears the goal from memory. More...
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const xySpeedHeading &node1, const xySpeedHeading &node2, double parentHCost) const
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, xySpeedHeading &s) const
 
virtual double GetPathLength (std::vector< xySpeedHeading > &neighbors)
 
virtual double GetPathLength (const xySpeedHeading &start, std::vector< deltaSpeedHeading > &neighbors)
 
virtual void SetOccupancyInfo (OccupancyInterface< xySpeedHeading, deltaSpeedHeading > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const xySpeedHeading &, const char *) const
 
virtual void GLDrawPath (const std::vector< xySpeedHeading > &x) const
 
virtual void SetColor (const rgbColor &r) const
 
virtual void SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const
 
virtual void GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const
 
virtual rgbColor GetColor () const
 
virtual void Draw (Graphics::Display &display) const
 
virtual void Draw (Graphics::Display &display, const xySpeedHeading &) const
 
virtual void DrawLine (Graphics::Display &display, const xySpeedHeading &x, const xySpeedHeading &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< xySpeedHeading >
 Heuristic ()
 
virtual ~Heuristic ()
 

Protected Attributes

std::vector< dirHeuristicTableheuristics
 
std::vector< float > cosTable
 
std::vector< float > sinTable
 
Mapmap
 
- Protected Attributes inherited from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >
bool bValidSearchGoal
 
xySpeedHeading searchGoal
 
rgbColor color
 
GLfloat transparency
 

Private Member Functions

bool Legal (const xySpeedHeading &node1, const deltaSpeedHeading &act) const
 
void BuildHTable (dirHeuristicTable &t)
 
void BuildAngleTables ()
 
float mySin (int dir) const
 
float myCos (int dir) const
 
float LookupStateHash (const xySpeedHeading &s, const dirHeuristicTable &t) const
 
bool LookupStateHashIndex (const xySpeedHeading &s, int &index1, int &index2) const
 
float LookupStateHeuristic (const xySpeedHeading &s1, const xySpeedHeading &s2) const
 
void RotateCCW (xySpeedHeading &s, unsigned int rotation) const
 

Private Attributes

bool checkLegal
 
GoalTestertest
 
model motionModel
 
heuristicType hType
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< xySpeedHeading >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 

Detailed Description

Definition at line 113 of file Directional2DEnvironment.h.

Constructor & Destructor Documentation

◆ Directional2DEnvironment()

Directional2DEnvironment::Directional2DEnvironment ( Map m,
model  envType = kVehicle,
heuristicType  heuristic = kExtendedPerimeterHeuristic 
)

◆ ~Directional2DEnvironment()

Directional2DEnvironment::~Directional2DEnvironment ( )
virtual

Definition at line 40 of file Directional2DEnvironment.cpp.

References map.

Member Function Documentation

◆ ApplyAction()

void Directional2DEnvironment::ApplyAction ( xySpeedHeading s,
deltaSpeedHeading  dir 
) const
virtual

◆ BuildAngleTables()

void Directional2DEnvironment::BuildAngleTables ( )
private

Definition at line 1058 of file Directional2DEnvironment.cpp.

References cosTable, kBetterTank, kTank, motionModel, sinTable, and TWOPI.

Referenced by Directional2DEnvironment().

◆ BuildHTable()

void Directional2DEnvironment::BuildHTable ( dirHeuristicTable t)
private

◆ GCost() [1/2]

double Directional2DEnvironment::GCost ( const xySpeedHeading node1,
const deltaSpeedHeading act 
) const
virtual

◆ GCost() [2/2]

double Directional2DEnvironment::GCost ( const xySpeedHeading node1,
const xySpeedHeading node2 
) const
virtual

◆ GetAction()

deltaSpeedHeading Directional2DEnvironment::GetAction ( const xySpeedHeading s1,
const xySpeedHeading s2 
) const
virtual

◆ GetActionHash()

uint64_t Directional2DEnvironment::GetActionHash ( deltaSpeedHeading  act) const
virtual

◆ GetActions()

void Directional2DEnvironment::GetActions ( const xySpeedHeading nodeID,
std::vector< deltaSpeedHeading > &  actions 
) const
virtual

◆ GetMap()

Map* Directional2DEnvironment::GetMap ( )
inline

Definition at line 145 of file Directional2DEnvironment.h.

References map.

◆ GetNextState()

void Directional2DEnvironment::GetNextState ( const xySpeedHeading currents,
deltaSpeedHeading  dir,
xySpeedHeading news 
) const
virtual

◆ GetNumAngles()

int Directional2DEnvironment::GetNumAngles ( )

Definition at line 45 of file Directional2DEnvironment.cpp.

References kBetterTank, kHumanoid, kTank, kVehicle, and motionModel.

◆ GetOccupancyInfo()

virtual OccupancyInterface<xySpeedHeading,deltaSpeedHeading>* Directional2DEnvironment::GetOccupancyInfo ( )
inlinevirtual

◆ GetStateHash()

uint64_t Directional2DEnvironment::GetStateHash ( const xySpeedHeading node) const
virtual

◆ GetSuccessors()

void Directional2DEnvironment::GetSuccessors ( const xySpeedHeading nodeID,
std::vector< xySpeedHeading > &  neighbors 
) const
virtual

◆ GLDrawLine()

void Directional2DEnvironment::GLDrawLine ( const xySpeedHeading a,
const xySpeedHeading b 
) const
virtual

◆ GoalTest() [1/2]

bool Directional2DEnvironment::GoalTest ( const xySpeedHeading node) const
inlinevirtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.

Definition at line 136 of file Directional2DEnvironment.h.

◆ GoalTest() [2/2]

bool Directional2DEnvironment::GoalTest ( const xySpeedHeading node,
const xySpeedHeading goal 
) const
virtual

◆ HCost() [1/2]

virtual double Directional2DEnvironment::HCost ( const xySpeedHeading node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.

Definition at line 128 of file Directional2DEnvironment.h.

◆ HCost() [2/2]

double Directional2DEnvironment::HCost ( const xySpeedHeading node1,
const xySpeedHeading node2 
) const
virtual

◆ InvertAction()

bool Directional2DEnvironment::InvertAction ( deltaSpeedHeading a) const
virtual

◆ Legal()

bool Directional2DEnvironment::Legal ( const xySpeedHeading node1,
const deltaSpeedHeading act 
) const
private

◆ LookupStateHash()

float Directional2DEnvironment::LookupStateHash ( const xySpeedHeading s,
const dirHeuristicTable t 
) const
private

◆ LookupStateHashIndex()

bool Directional2DEnvironment::LookupStateHashIndex ( const xySpeedHeading s,
int &  index1,
int &  index2 
) const
private

◆ LookupStateHeuristic()

float Directional2DEnvironment::LookupStateHeuristic ( const xySpeedHeading s1,
const xySpeedHeading s2 
) const
private

◆ myCos()

float Directional2DEnvironment::myCos ( int  dir) const
private

Definition at line 1077 of file Directional2DEnvironment.cpp.

References cosTable.

Referenced by ApplyAction(), OpenGLDraw(), RotateCCW(), and UndoAction().

◆ mySin()

float Directional2DEnvironment::mySin ( int  dir) const
private

Definition at line 1072 of file Directional2DEnvironment.cpp.

References sinTable.

Referenced by ApplyAction(), OpenGLDraw(), RotateCCW(), and UndoAction().

◆ OpenGLDraw() [1/4]

void Directional2DEnvironment::OpenGLDraw ( ) const
virtual

Definition at line 639 of file Directional2DEnvironment.cpp.

References map, and Map::OpenGLDraw().

◆ OpenGLDraw() [2/4]

void Directional2DEnvironment::OpenGLDraw ( const xySpeedHeading l,
const deltaSpeedHeading  
) const
virtual

◆ OpenGLDraw() [3/4]

void Directional2DEnvironment::OpenGLDraw ( const xySpeedHeading l) const
virtual

◆ OpenGLDraw() [4/4]

void Directional2DEnvironment::OpenGLDraw ( const xySpeedHeading ,
const xySpeedHeading ,
float   
) const
virtual

◆ RotateCCW()

void Directional2DEnvironment::RotateCCW ( xySpeedHeading s,
unsigned int  rotation 
) const
private

◆ SetGoalTest()

void Directional2DEnvironment::SetGoalTest ( GoalTester t)
inline

Definition at line 134 of file Directional2DEnvironment.h.

References test.

◆ SetHeuristicType()

void Directional2DEnvironment::SetHeuristicType ( heuristicType  theType)
inline

Definition at line 146 of file Directional2DEnvironment.h.

References hType.

◆ UndoAction()

void Directional2DEnvironment::UndoAction ( xySpeedHeading s,
deltaSpeedHeading  dir 
) const
virtual

Member Data Documentation

◆ checkLegal

bool Directional2DEnvironment::checkLegal
private

Definition at line 160 of file Directional2DEnvironment.h.

Referenced by BuildHTable(), Directional2DEnvironment(), and Legal().

◆ cosTable

std::vector<float> Directional2DEnvironment::cosTable
protected

Definition at line 168 of file Directional2DEnvironment.h.

Referenced by BuildAngleTables(), and myCos().

◆ heuristics

std::vector<dirHeuristicTable> Directional2DEnvironment::heuristics
protected

Definition at line 165 of file Directional2DEnvironment.h.

Referenced by LookupStateHeuristic().

◆ hType

heuristicType Directional2DEnvironment::hType
private

◆ map

Map* Directional2DEnvironment::map
protected

◆ motionModel

model Directional2DEnvironment::motionModel
private

◆ sinTable

std::vector<float> Directional2DEnvironment::sinTable
protected

Definition at line 169 of file Directional2DEnvironment.h.

Referenced by BuildAngleTables(), and mySin().

◆ test

GoalTester* Directional2DEnvironment::test
private

Definition at line 161 of file Directional2DEnvironment.h.

Referenced by Directional2DEnvironment(), GoalTest(), and SetGoalTest().


The documentation for this class was generated from the following files: