Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

RestrictedVisionPerceptor Class Reference

#include <restrictedvisionperceptor.h>

Inheritance diagram for RestrictedVisionPerceptor:

Inheritance graph
[legend]
Collaboration diagram for RestrictedVisionPerceptor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RestrictedVisionPerceptor ()
virtual ~RestrictedVisionPerceptor ()
bool Percept (boost::shared_ptr< oxygen::PredicateList > predList)
void SetNoiseParams (float sigma_dist, float sigma_phi, float sigma_theta, float cal_error_abs)
 Set the noise parameters of the vision perceptor.
void SetSenseMyPos (bool sense)
 Turn sensing of agent position on/off.
void AddNoise (bool add_noise)
 Turn noise off/on.
void SetStaticSenseAxis (bool static_axis)
 Turn senses relative to the X-axis of the team off/on.
void SetViewCones (unsigned int hAngle, unsigned int vAngle)
 Set the visible area of the perceptor.
void SetPanRange (int lower, int upper)
 Set the pan range.
void SetTiltRange (int lower, int upper)
 Set the tilt range.
void SetPanTilt (float pan, float tilt)
 Set the view angles.
void ChangePanTilt (float pan, float tilt)
 Add values to the current view angles.
float GetPan () const
 Get the horizontal view direction.
float GetTilt () const
 Get the horizontal view direction.

Protected Types

typedef boost::shared_ptr<
salt::NormalRNG<> > 
NormalRngPtr
typedef std::list< ObjectDataTObjectList

Protected Member Functions

virtual bool ConstructInternal ()
 constructs the internal ray collider
void SetupVisibleObjects (TObjectList &visibleObjects)
 prepares a list of visible objects
bool StaticAxisPercept (boost::shared_ptr< oxygen::PredicateList > predList)
 Percept implementation for a static relative axis.
bool DynamicAxisPercept (boost::shared_ptr< oxygen::PredicateList > predList)
 Percept implementation relative to the current orientation of the RestrictedVisionPerceptor node.
bool CheckOcclusion (const salt::Vector3f &my_pos, const ObjectData &od) const
 Checks if the given object is occluded, seen from from my_pos.
void AddSense (oxygen::Predicate &predicate, ObjectData &od) const
 constructs a sense entry for the given object in the given predicate
void ApplyNoise (ObjectData &od) const
 applies noise to the setup ObjectData
virtual void OnLink ()
 This method is called, when the hierarchy object has been linked to a parent.
virtual void OnUnlink ()
 This rountine is called, before the hierarchy object is removed from the parent.

Protected Attributes

salt::Vector3f mError
 vision calibration error
bool mSenseMyPos
 true, if the absolute position of the agent is sensed.
float mSigmaDist
 sigma for random measurement error (distance)
float mSigmaTheta
 sigma for random measurement error (horizontal angle)
float mSigmaPhi
 sigma for random measurement error (latitudal angle)
float mCalErrorAbs
 absolute maximum value of the calibration error
bool mAddNoise
 flag if we should noisify the data
bool mStaticSenseAxis
 flag if the senses are always relative to the X-axis of the team, default true
unsigned int mHViewCone
 horizontal opening of the vision cone
unsigned int mVViewCone
 vertical opening of the vision cone
float mPan
 horizontal view direction in degrees
int mPanLower
 the lower bound for the horizontal view direction in degrees
int mPanUpper
 the upper bound for the horizontal view direction in degrees
float mTilt
 vertical view direction in degrees
int mTiltLower
 the lower bound for the vertical view direction in degrees
int mTiltUpper
 the upper bound for the vertical view direction in degrees
boost::shared_ptr< oxygen::RayCollidermRay
 ray collider to check occlusion
NormalRngPtr mDistRng
 random number generator for distance errors
NormalRngPtr mThetaRng
 random number generator for angle errors
NormalRngPtr mPhiRng
 random number generator for angle errors
boost::shared_ptr< oxygen::ScenemActiveScene
boost::shared_ptr< oxygen::TransformmTransformParent
 a reference to the next transorm parent
boost::shared_ptr< oxygen::SceneServermSceneServer
 a reference to the scene server
boost::shared_ptr< AgentStatemAgentState
 a reference to the agent state

Classes

struct  ObjectData

Detailed Description

Definition at line 32 of file restrictedvisionperceptor.h.


Member Typedef Documentation

typedef boost::shared_ptr<salt::NormalRNG<> > RestrictedVisionPerceptor::NormalRngPtr [protected]
 

Definition at line 35 of file restrictedvisionperceptor.h.

typedef std::list<ObjectData> RestrictedVisionPerceptor::TObjectList [protected]
 

Definition at line 63 of file restrictedvisionperceptor.h.


Constructor & Destructor Documentation

RestrictedVisionPerceptor::RestrictedVisionPerceptor  ) 
 

Definition at line 34 of file restrictedvisionperceptor.cpp.

References SetNoiseParams(), SetPanRange(), SetPanTilt(), oxygen::Perceptor::SetPredicateName(), SetTiltRange(), and SetViewCones().

Here is the call graph for this function:

RestrictedVisionPerceptor::~RestrictedVisionPerceptor  )  [virtual]
 

Definition at line 49 of file restrictedvisionperceptor.cpp.

References mDistRng, mPhiRng, and mThetaRng.


Member Function Documentation

void RestrictedVisionPerceptor::AddNoise bool  add_noise  ) 
 

Turn noise off/on.

Parameters:
add_noise flag if noise should be used at all.

Definition at line 170 of file restrictedvisionperceptor.cpp.

References mAddNoise.

void RestrictedVisionPerceptor::AddSense oxygen::Predicate predicate,
ObjectData od
const [protected]
 

constructs a sense entry for the given object in the given predicate

Definition at line 232 of file restrictedvisionperceptor.cpp.

References zeitgeist::ParameterList::AddList(), zeitgeist::ParameterList::AddValue(), RestrictedVisionPerceptor::ObjectData::mDist, RestrictedVisionPerceptor::ObjectData::mObj, RestrictedVisionPerceptor::ObjectData::mPhi, RestrictedVisionPerceptor::ObjectData::mTheta, oxygen::Predicate::parameter, and ObjectState::PT_Player.

Referenced by DynamicAxisPercept(), and StaticAxisPercept().

Here is the call graph for this function:

void RestrictedVisionPerceptor::ApplyNoise ObjectData od  )  const [protected]
 

applies noise to the setup ObjectData

Definition at line 261 of file restrictedvisionperceptor.cpp.

References mAddNoise, RestrictedVisionPerceptor::ObjectData::mDist, mDistRng, RestrictedVisionPerceptor::ObjectData::mPhi, mPhiRng, RestrictedVisionPerceptor::ObjectData::mTheta, and mThetaRng.

Referenced by DynamicAxisPercept(), and StaticAxisPercept().

void RestrictedVisionPerceptor::ChangePanTilt float  pan,
float  tilt
 

Add values to the current view angles.

Parameters:
pan the horizontal view angle in degrees (0 degrees is the x-axis towards the opponent side)
tilt is the vertical view angle in degrees (0 degrees is the angle parallel to the floor)

Definition at line 133 of file restrictedvisionperceptor.cpp.

References mPan, mTilt, and SetPanTilt().

Here is the call graph for this function:

bool RestrictedVisionPerceptor::CheckOcclusion const salt::Vector3f my_pos,
const ObjectData od
const [protected]
 

Checks if the given object is occluded, seen from from my_pos.

Definition at line 471 of file restrictedvisionperceptor.cpp.

Referenced by StaticAxisPercept().

bool RestrictedVisionPerceptor::ConstructInternal  )  [protected, virtual]
 

constructs the internal ray collider

Reimplemented from zeitgeist::Object.

Definition at line 182 of file restrictedvisionperceptor.cpp.

References zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), and mRay.

Here is the call graph for this function:

bool RestrictedVisionPerceptor::DynamicAxisPercept boost::shared_ptr< oxygen::PredicateList predList  )  [protected]
 

Percept implementation relative to the current orientation of the RestrictedVisionPerceptor node.

Definition at line 339 of file restrictedvisionperceptor.cpp.

References zeitgeist::ParameterList::AddList(), AddSense(), zeitgeist::ParameterList::AddValue(), ApplyNoise(), zeitgeist::ParameterList::Clear(), SoccerBase::FlipView(), salt::gAbs(), zeitgeist::Object::GetLog(), salt::gNormalizeRad(), salt::gRadToDeg(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), mAddNoise, mAgentState, mError, mHViewCone, RestrictedVisionPerceptor::ObjectData::mObj, RestrictedVisionPerceptor::ObjectData::mPhi, oxygen::Perceptor::mPredicateName, RestrictedVisionPerceptor::ObjectData::mRelPos, mSenseMyPos, RestrictedVisionPerceptor::ObjectData::mTheta, mTransformParent, mVViewCone, oxygen::Predicate::name, oxygen::Predicate::parameter, and SetupVisibleObjects().

Referenced by Percept().

Here is the call graph for this function:

float RestrictedVisionPerceptor::GetPan  )  const
 

Get the horizontal view direction.

Returns:
the pan angle in degrees

Definition at line 139 of file restrictedvisionperceptor.cpp.

References mPan.

Referenced by StaticAxisPercept().

float RestrictedVisionPerceptor::GetTilt  )  const
 

Get the horizontal view direction.

Returns:
the tilt angle in degrees

Definition at line 145 of file restrictedvisionperceptor.cpp.

References mTilt.

Referenced by StaticAxisPercept().

void RestrictedVisionPerceptor::OnLink  )  [protected, virtual]
 

This method is called, when the hierarchy object has been linked to a parent.

At that point, traversal can commence. It can be overridden to support custom 'link' behavior.

Reimplemented from zeitgeist::Leaf.

Definition at line 151 of file restrictedvisionperceptor.cpp.

References SoccerBase::GetActiveScene(), SoccerBase::GetAgentState(), SoccerBase::GetTransformParent(), mActiveScene, mAgentState, and mTransformParent.

Here is the call graph for this function:

void RestrictedVisionPerceptor::OnUnlink  )  [protected, virtual]
 

This rountine is called, before the hierarchy object is removed from the parent.

It can be overridden to support custom 'unlink' behavior.

Reimplemented from zeitgeist::Leaf.

Definition at line 159 of file restrictedvisionperceptor.cpp.

References mActiveScene, mAgentState, mDistRng, mPhiRng, mThetaRng, and mTransformParent.

bool RestrictedVisionPerceptor::Percept boost::shared_ptr< oxygen::PredicateList predList  )  [virtual]
 

Returns:
true, if valid data is available and false otherwise.

Implements oxygen::Perceptor.

Definition at line 452 of file restrictedvisionperceptor.cpp.

References DynamicAxisPercept(), mActiveScene, mAgentState, mStaticSenseAxis, mTransformParent, and StaticAxisPercept().

Here is the call graph for this function:

void RestrictedVisionPerceptor::SetNoiseParams float  sigma_dist,
float  sigma_phi,
float  sigma_theta,
float  cal_error_abs
 

Set the noise parameters of the vision perceptor.

This will always create new calibration error values. The random noise added each step is normally distributed around 0.0. The (fixed) calibration error is calculated once for each axis. It is uniformly distributed between -cal_error_abs and cal_error_abs and added to the "camera" coordinates.

Parameters:
sigma_dist the sigma for the distance error distribution
sigma_phi the sigma for the horizontal angle error distribution
sigma_theta the sigma for the latitudal angle error distribution
cal_error_abs absolute value of the maximum calibration error along each axis.

Definition at line 57 of file restrictedvisionperceptor.cpp.

References mCalErrorAbs, mDistRng, mError, mPhiRng, mSigmaDist, mSigmaPhi, mSigmaTheta, and mThetaRng.

Referenced by RestrictedVisionPerceptor().

void RestrictedVisionPerceptor::SetPanRange int  lower,
int  upper
 

Set the pan range.

As long as the agents have no inherent direction and 0 degrees horizontally is always directed towards the opponent side, it does not make much sense to restrict the pan range other than to a fixed angle, which disables panning effectively. A range of 360 degrees (e.g. from -180 to 180) means no restriction.

Parameters:
lower lower bound (in degrees)
upper upper bound (in degrees)

Definition at line 84 of file restrictedvisionperceptor.cpp.

References salt::gNormalizeDeg(), mPanLower, and mPanUpper.

Referenced by RestrictedVisionPerceptor().

Here is the call graph for this function:

void RestrictedVisionPerceptor::SetPanTilt float  pan,
float  tilt
 

Set the view angles.

Parameters:
pan the horizontal view angle in degrees (0 degrees is the x-axis towards the opponent side)
tilt is the vertical view angle in degrees (0 degrees is the angle parallel to the floor)

Definition at line 124 of file restrictedvisionperceptor.cpp.

References gClampAngleDeg(), salt::gNormalizeDeg(), mPan, mPanLower, mPanUpper, mTilt, mTiltLower, and mTiltUpper.

Referenced by ChangePanTilt(), and RestrictedVisionPerceptor().

Here is the call graph for this function:

void RestrictedVisionPerceptor::SetSenseMyPos bool  sense  ) 
 

Turn sensing of agent position on/off.

Definition at line 511 of file restrictedvisionperceptor.cpp.

References mSenseMyPos.

void RestrictedVisionPerceptor::SetStaticSenseAxis bool  static_axis  ) 
 

Turn senses relative to the X-axis of the team off/on.

Definition at line 176 of file restrictedvisionperceptor.cpp.

References mStaticSenseAxis.

void RestrictedVisionPerceptor::SetTiltRange int  lower,
int  upper
 

Set the tilt range.

Contrary to the pan range, it makes much sense to restrict the tilt range. However, a range of 360 degrees (e.g. from -180 to 180) means no restriction.

Parameters:
lower lower bound (in degrees)
upper upper bound (in degrees)

Definition at line 99 of file restrictedvisionperceptor.cpp.

References salt::gNormalizeDeg(), mTiltLower, and mTiltUpper.

Referenced by RestrictedVisionPerceptor().

Here is the call graph for this function:

void RestrictedVisionPerceptor::SetupVisibleObjects TObjectList visibleObjects  )  [protected]
 

prepares a list of visible objects

Definition at line 197 of file restrictedvisionperceptor.cpp.

References zeitgeist::Node::begin(), zeitgeist::Node::end(), zeitgeist::Object::GetLog(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), mActiveScene, RestrictedVisionPerceptor::ObjectData::mDist, RestrictedVisionPerceptor::ObjectData::mObj, RestrictedVisionPerceptor::ObjectData::mRelPos, and mTransformParent.

Referenced by DynamicAxisPercept(), and StaticAxisPercept().

Here is the call graph for this function:

void RestrictedVisionPerceptor::SetViewCones unsigned int  hAngle,
unsigned int  vAngle
 

Set the visible area of the perceptor.

Definition at line 77 of file restrictedvisionperceptor.cpp.

References mHViewCone, and mVViewCone.

Referenced by RestrictedVisionPerceptor().

bool RestrictedVisionPerceptor::StaticAxisPercept boost::shared_ptr< oxygen::PredicateList predList  )  [protected]
 

Percept implementation for a static relative axis.

Definition at line 273 of file restrictedvisionperceptor.cpp.

References zeitgeist::ParameterList::AddList(), AddSense(), zeitgeist::ParameterList::AddValue(), ApplyNoise(), CheckOcclusion(), zeitgeist::ParameterList::Clear(), SoccerBase::FlipView(), salt::gAbs(), salt::gArcCos(), salt::gArcTan2(), GetPan(), GetTilt(), salt::gNormalizeDeg(), salt::gRadToDeg(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), mAddNoise, mAgentState, RestrictedVisionPerceptor::ObjectData::mDist, mError, mHViewCone, RestrictedVisionPerceptor::ObjectData::mPhi, oxygen::Perceptor::mPredicateName, RestrictedVisionPerceptor::ObjectData::mRelPos, mSenseMyPos, RestrictedVisionPerceptor::ObjectData::mTheta, mTransformParent, mVViewCone, oxygen::Predicate::name, oxygen::Predicate::parameter, and SetupVisibleObjects().

Referenced by Percept().

Here is the call graph for this function:


Member Data Documentation

boost::shared_ptr<oxygen::Scene> RestrictedVisionPerceptor::mActiveScene [protected]
 

Definition at line 223 of file restrictedvisionperceptor.h.

Referenced by OnLink(), OnUnlink(), Percept(), and SetupVisibleObjects().

bool RestrictedVisionPerceptor::mAddNoise [protected]
 

flag if we should noisify the data

Definition at line 189 of file restrictedvisionperceptor.h.

Referenced by AddNoise(), ApplyNoise(), DynamicAxisPercept(), and StaticAxisPercept().

boost::shared_ptr<AgentState> RestrictedVisionPerceptor::mAgentState [protected]
 

a reference to the agent state

Definition at line 229 of file restrictedvisionperceptor.h.

Referenced by DynamicAxisPercept(), OnLink(), OnUnlink(), Percept(), and StaticAxisPercept().

float RestrictedVisionPerceptor::mCalErrorAbs [protected]
 

absolute maximum value of the calibration error

Definition at line 187 of file restrictedvisionperceptor.h.

Referenced by SetNoiseParams().

NormalRngPtr RestrictedVisionPerceptor::mDistRng [protected]
 

random number generator for distance errors

Definition at line 217 of file restrictedvisionperceptor.h.

Referenced by ApplyNoise(), OnUnlink(), SetNoiseParams(), and ~RestrictedVisionPerceptor().

salt::Vector3f RestrictedVisionPerceptor::mError [protected]
 

vision calibration error

Definition at line 175 of file restrictedvisionperceptor.h.

Referenced by DynamicAxisPercept(), SetNoiseParams(), and StaticAxisPercept().

unsigned int RestrictedVisionPerceptor::mHViewCone [protected]
 

horizontal opening of the vision cone

Definition at line 197 of file restrictedvisionperceptor.h.

Referenced by DynamicAxisPercept(), SetViewCones(), and StaticAxisPercept().

float RestrictedVisionPerceptor::mPan [protected]
 

horizontal view direction in degrees

Definition at line 201 of file restrictedvisionperceptor.h.

Referenced by ChangePanTilt(), GetPan(), and SetPanTilt().

int RestrictedVisionPerceptor::mPanLower [protected]
 

the lower bound for the horizontal view direction in degrees

Definition at line 203 of file restrictedvisionperceptor.h.

Referenced by SetPanRange(), and SetPanTilt().

int RestrictedVisionPerceptor::mPanUpper [protected]
 

the upper bound for the horizontal view direction in degrees

Definition at line 205 of file restrictedvisionperceptor.h.

Referenced by SetPanRange(), and SetPanTilt().

NormalRngPtr RestrictedVisionPerceptor::mPhiRng [protected]
 

random number generator for angle errors

Definition at line 221 of file restrictedvisionperceptor.h.

Referenced by ApplyNoise(), OnUnlink(), SetNoiseParams(), and ~RestrictedVisionPerceptor().

boost::shared_ptr<oxygen::RayCollider> RestrictedVisionPerceptor::mRay [protected]
 

ray collider to check occlusion

Definition at line 214 of file restrictedvisionperceptor.h.

Referenced by ConstructInternal().

boost::shared_ptr<oxygen::SceneServer> RestrictedVisionPerceptor::mSceneServer [protected]
 

a reference to the scene server

Definition at line 227 of file restrictedvisionperceptor.h.

bool RestrictedVisionPerceptor::mSenseMyPos [protected]
 

true, if the absolute position of the agent is sensed.

Definition at line 178 of file restrictedvisionperceptor.h.

Referenced by DynamicAxisPercept(), SetSenseMyPos(), and StaticAxisPercept().

float RestrictedVisionPerceptor::mSigmaDist [protected]
 

sigma for random measurement error (distance)

Definition at line 181 of file restrictedvisionperceptor.h.

Referenced by SetNoiseParams().

float RestrictedVisionPerceptor::mSigmaPhi [protected]
 

sigma for random measurement error (latitudal angle)

Definition at line 185 of file restrictedvisionperceptor.h.

Referenced by SetNoiseParams().

float RestrictedVisionPerceptor::mSigmaTheta [protected]
 

sigma for random measurement error (horizontal angle)

Definition at line 183 of file restrictedvisionperceptor.h.

Referenced by SetNoiseParams().

bool RestrictedVisionPerceptor::mStaticSenseAxis [protected]
 

flag if the senses are always relative to the X-axis of the team, default true

Definition at line 194 of file restrictedvisionperceptor.h.

Referenced by Percept(), and SetStaticSenseAxis().

NormalRngPtr RestrictedVisionPerceptor::mThetaRng [protected]
 

random number generator for angle errors

Definition at line 219 of file restrictedvisionperceptor.h.

Referenced by ApplyNoise(), OnUnlink(), SetNoiseParams(), and ~RestrictedVisionPerceptor().

float RestrictedVisionPerceptor::mTilt [protected]
 

vertical view direction in degrees

Definition at line 207 of file restrictedvisionperceptor.h.

Referenced by ChangePanTilt(), GetTilt(), and SetPanTilt().

int RestrictedVisionPerceptor::mTiltLower [protected]
 

the lower bound for the vertical view direction in degrees

Definition at line 209 of file restrictedvisionperceptor.h.

Referenced by SetPanTilt(), and SetTiltRange().

int RestrictedVisionPerceptor::mTiltUpper [protected]
 

the upper bound for the vertical view direction in degrees

Definition at line 211 of file restrictedvisionperceptor.h.

Referenced by SetPanTilt(), and SetTiltRange().

boost::shared_ptr<oxygen::Transform> RestrictedVisionPerceptor::mTransformParent [protected]
 

a reference to the next transorm parent

Definition at line 225 of file restrictedvisionperceptor.h.

Referenced by DynamicAxisPercept(), OnLink(), OnUnlink(), Percept(), SetupVisibleObjects(), and StaticAxisPercept().

unsigned int RestrictedVisionPerceptor::mVViewCone [protected]
 

vertical opening of the vision cone

Definition at line 199 of file restrictedvisionperceptor.h.

Referenced by DynamicAxisPercept(), SetViewCones(), and StaticAxisPercept().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:40:00 2006 for rcssserver3d by  doxygen 1.4.4