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

#include <ConfigEnvironment.h>

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

Public Member Functions

 ConfigEnvironment ()
 
virtual ~ConfigEnvironment ()
 
void AddObstacle (line2d obs)
 
void PopObstacle ()
 
void GetSuccessors (const recVec &nodeID, std::vector< recVec > &neighbors) const
 
void GetActions (const recVec &nodeID, std::vector< line2d > &actions) const
 
line2d GetAction (const recVec &s1, const recVec &s2) const
 
virtual void ApplyAction (recVec &s, line2d dir) const
 
virtual bool InvertAction (line2d &a) const
 
virtual double HCost (const recVec &) const
 Heuristic value between node and the stored goal. More...
 
virtual double HCost (const recVec &node1, const recVec &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double GCost (const recVec &node1, const recVec &node2) const
 
virtual double GCost (const recVec &node1, const line2d &act) const
 
bool GoalTest (const recVec &node, const recVec &goal) const
 
bool GoalTest (const recVec &) const
 Goal Test if the goal is stored. More...
 
uint64_t GetStateHash (const recVec &node) const
 
uint64_t GetActionHash (line2d act) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const recVec &l) const
 
virtual void OpenGLDraw (const recVec &, const line2d &) const
 
virtual void OpenGLDraw (const recVec &, const recVec &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void GetNextState (const recVec &currents, line2d dir, recVec &news) const
 
void StoreGoal (recVec &g)
 Stores the goal for use by single-state HCost. More...
 
void ClearGoal ()
 Clears the goal from memory. More...
 
bool IsGoalStored () const
 
- Public Member Functions inherited from SearchEnvironment< recVec, line2d >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const recVec &stateID) const
 
virtual void UndoAction (recVec &s, line2d a) const
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const recVec &node1, const recVec &node2, double parentHCost) const
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, recVec &s) const
 
virtual double GetPathLength (std::vector< recVec > &neighbors)
 
virtual double GetPathLength (const recVec &start, std::vector< line2d > &neighbors)
 
virtual OccupancyInterface< recVec, line2d > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< recVec, line2d > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const recVec &, const char *) const
 
virtual void GLDrawLine (const recVec &x, const recVec &y) const
 
virtual void GLDrawPath (const std::vector< recVec > &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 recVec &) const
 
virtual void DrawLine (Graphics::Display &display, const recVec &x, const recVec &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< recVec >
 Heuristic ()
 
virtual ~Heuristic ()
 

Private Member Functions

bool Legal (const recVec &a, const recVec &b) const
 
void DrawLine (line2d l) const
 

Private Attributes

recVec goal
 
std::vector< line2dobstacles
 
bool goal_stored
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< recVec >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 
- Protected Attributes inherited from SearchEnvironment< recVec, line2d >
bool bValidSearchGoal
 
recVec searchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

Definition at line 15 of file ConfigEnvironment.h.

Constructor & Destructor Documentation

◆ ConfigEnvironment()

ConfigEnvironment::ConfigEnvironment ( )

Definition at line 15 of file ConfigEnvironment.cpp.

References goal_stored.

◆ ~ConfigEnvironment()

ConfigEnvironment::~ConfigEnvironment ( )
virtual

Definition at line 20 of file ConfigEnvironment.cpp.

Member Function Documentation

◆ AddObstacle()

void ConfigEnvironment::AddObstacle ( line2d  obs)
inline

Definition at line 21 of file ConfigEnvironment.h.

References obstacles.

Referenced by RoboticArm::AddObstacle().

◆ ApplyAction()

void ConfigEnvironment::ApplyAction ( recVec s,
line2d  dir 
) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 118 of file ConfigEnvironment.cpp.

References line2d::end.

◆ ClearGoal()

void ConfigEnvironment::ClearGoal ( )
inlinevirtual

Clears the goal from memory.

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 54 of file ConfigEnvironment.h.

References goal_stored.

◆ DrawLine()

void ConfigEnvironment::DrawLine ( line2d  l) const
private

Definition at line 211 of file ConfigEnvironment.cpp.

References line2d::end, line2d::start, recVec::x, and recVec::y.

Referenced by OpenGLDraw().

◆ GCost() [1/2]

double ConfigEnvironment::GCost ( const recVec node1,
const line2d act 
) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 147 of file ConfigEnvironment.cpp.

References line2d::end, recVec::x, recVec::y, and recVec::z.

◆ GCost() [2/2]

double ConfigEnvironment::GCost ( const recVec node1,
const recVec node2 
) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 140 of file ConfigEnvironment.cpp.

References recVec::x, recVec::y, and recVec::z.

◆ GetAction()

line2d ConfigEnvironment::GetAction ( const recVec s1,
const recVec s2 
) const
virtual

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 110 of file ConfigEnvironment.cpp.

References d.

◆ GetActionHash()

uint64_t ConfigEnvironment::GetActionHash ( line2d  act) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 173 of file ConfigEnvironment.cpp.

References line2d::end, GetStateHash(), and line2d::start.

◆ GetActions()

void ConfigEnvironment::GetActions ( const recVec nodeID,
std::vector< line2d > &  actions 
) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 69 of file ConfigEnvironment.cpp.

References goal, Legal(), and obstacles.

◆ GetNextState()

void ConfigEnvironment::GetNextState ( const recVec currents,
line2d  dir,
recVec news 
) const
virtual

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 206 of file ConfigEnvironment.cpp.

References line2d::end.

◆ GetStateHash()

uint64_t ConfigEnvironment::GetStateHash ( const recVec node) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 159 of file ConfigEnvironment.cpp.

Referenced by GetActionHash().

◆ GetSuccessors()

void ConfigEnvironment::GetSuccessors ( const recVec nodeID,
std::vector< recVec > &  neighbors 
) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 24 of file ConfigEnvironment.cpp.

References goal, Legal(), and obstacles.

◆ GoalTest() [1/2]

bool ConfigEnvironment::GoalTest ( const recVec node) const
inlinevirtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 39 of file ConfigEnvironment.h.

◆ GoalTest() [2/2]

bool ConfigEnvironment::GoalTest ( const recVec node,
const recVec goal 
) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 154 of file ConfigEnvironment.cpp.

References fequal(), recVec::x, recVec::y, and recVec::z.

◆ HCost() [1/2]

virtual double ConfigEnvironment::HCost ( const recVec node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 30 of file ConfigEnvironment.h.

◆ HCost() [2/2]

double ConfigEnvironment::HCost ( const recVec node1,
const recVec node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< recVec, line2d >.

Definition at line 133 of file ConfigEnvironment.cpp.

References recVec::x, recVec::y, and recVec::z.

◆ InvertAction()

bool ConfigEnvironment::InvertAction ( line2d a) const
virtual

Implements SearchEnvironment< recVec, line2d >.

Definition at line 124 of file ConfigEnvironment.cpp.

References line2d::end, and line2d::start.

◆ IsGoalStored()

bool ConfigEnvironment::IsGoalStored ( ) const
inline

Definition at line 55 of file ConfigEnvironment.h.

◆ Legal()

bool ConfigEnvironment::Legal ( const recVec a,
const recVec b 
) const
private

Definition at line 89 of file ConfigEnvironment.cpp.

References obstacles.

Referenced by GetActions(), and GetSuccessors().

◆ OpenGLDraw() [1/4]

void ConfigEnvironment::OpenGLDraw ( ) const
virtual

Definition at line 179 of file ConfigEnvironment.cpp.

References DrawLine(), and obstacles.

◆ OpenGLDraw() [2/4]

void ConfigEnvironment::OpenGLDraw ( const recVec ,
const line2d  
) const
virtual

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 193 of file ConfigEnvironment.cpp.

◆ OpenGLDraw() [3/4]

virtual void ConfigEnvironment::OpenGLDraw ( const recVec ,
const recVec ,
float   
) const
inlinevirtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 49 of file ConfigEnvironment.h.

◆ OpenGLDraw() [4/4]

void ConfigEnvironment::OpenGLDraw ( const recVec l) const
virtual

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 186 of file ConfigEnvironment.cpp.

References recVec::x, recVec::y, and recVec::z.

◆ PopObstacle()

void ConfigEnvironment::PopObstacle ( )
inline

Definition at line 22 of file ConfigEnvironment.h.

References obstacles.

Referenced by RoboticArm::PopObstacle().

◆ StoreGoal()

void ConfigEnvironment::StoreGoal ( recVec s)
inlinevirtual

Stores the goal for use by single-state HCost.

Reimplemented from SearchEnvironment< recVec, line2d >.

Definition at line 53 of file ConfigEnvironment.h.

References goal, and goal_stored.

Referenced by RoboticArm::HCost().

Member Data Documentation

◆ goal

recVec ConfigEnvironment::goal
private

Definition at line 62 of file ConfigEnvironment.h.

Referenced by GetActions(), GetSuccessors(), and StoreGoal().

◆ goal_stored

bool ConfigEnvironment::goal_stored
private

Definition at line 66 of file ConfigEnvironment.h.

Referenced by ClearGoal(), ConfigEnvironment(), and StoreGoal().

◆ obstacles

std::vector<line2d> ConfigEnvironment::obstacles
private

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