AURobotServers  4
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
UObstacleGroup Class Reference

#include <uobstacle.h>

Inheritance diagram for UObstacleGroup:
Inheritance graph

Public Member Functions

void clear ()
 
virtual const char * getDataType ()
 
int getMaxObstsCnt ()
 
UObstaclegetNewObst ()
 
UObstaclegetObstacle (int idx)
 
UObstaclegetObstacle (unsigned long oSerial, bool mayCreate, int *obstacleIndex)
 
int getObstsCnt ()
 
UPoseTime getPoseFirst ()
 
UPoseTime getPoseLast ()
 
UPoseTimegetPPoseFirst ()
 
UPoseTimegetPPoseLast ()
 
unsigned long getSerial ()
 
void logAll (unsigned int serial, FILE *logo)
 
virtual UObstaclemakeNewObst ()
 
void print (const char *prestr)
 
void print (const char *prestr, char *buff, const int buffCnt, bool detail)
 
void removeAllObsts ()
 
void removeInvalid (UTime before, int hitLimit)
 
void removeObst (int idx)
 
void setPoseFirst (UPoseTime pose)
 
void setPoseLast (UPoseTime pose)
 
void setSerial (unsigned long value)
 
 UObstacleGroup ()
 
 ~UObstacleGroup ()
 
- Public Member Functions inherited from ULock
bool lock ()
 
void lockInit ()
 
void post ()
 
bool tryLock ()
 
bool tryWait ()
 
 ULock ()
 
void unlock ()
 
bool wait ()
 
 ~ULock ()
 
- Public Member Functions inherited from UDataBase
bool isA (const char *typeString)
 
virtual bool isAlsoA (const char *typeString)
 
virtual void snprint (const char *preString, char *buff, const int buffCnt)
 
 UDataBase ()
 
virtual ~UDataBase ()
 

Static Public Attributes

static const int MAX_OBSTACLES = 500
 

Protected Attributes

unsigned long nextObstSerial
 
UObstacleobsts [MAX_OBSTACLES]
 
int obstsCnt
 
UPoseTime poseFirst
 
UPoseTime poseLast
 
unsigned long serial
 

Detailed Description

Obstacle group, that — within reason — can be assumed to have same reference coordinate system, based on odometry. That is, systematic errors in pose within group, can not be corrected for.

Constructor & Destructor Documentation

UObstacleGroup::UObstacleGroup ( )

Constructor

References UObstacle::clear(), and UObstacle::serial.

UObstacleGroup::~UObstacleGroup ( )

Destructor

Member Function Documentation

void UObstacleGroup::clear ( void  )
virtual const char* UObstacleGroup::getDataType ( )
inlinevirtual

Get (end) type of this structure

Reimplemented from UDataBase.

int UObstacleGroup::getMaxObstsCnt ( )
inline

Get maximum obstacle count

UObstacle * UObstacleGroup::getNewObst ( )

Get a pointer to a new obstacle added to the list. The obstacle is created if none is available. If no more space, then NULL is returned.

References UObstacle::clear(), and UObstacle::setSerial().

Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), UResMapObst::getNearObstacles(), and USmlTag::getObstacleGroup().

UObstacle* UObstacleGroup::getObstacle ( int  idx)
inline
UObstacle * UObstacleGroup::getObstacle ( unsigned long  oSerial,
bool  mayCreate,
int *  obstacleIndex 
)

Get obstacle with this serial number. If the serial number is not found and 'mayCreate' then a new obstacle is added. Returns a pointer to the found obstacle, and the obstacle index number in 'obstacleIndex' (if 'obstacleIndex' is not NULL). Returns NULL if no more space.

References UObstacle::setSerial().

int UObstacleGroup::getObstsCnt ( )
inline
UPoseTime UObstacleGroup::getPoseFirst ( )
inline
UPoseTime UObstacleGroup::getPoseLast ( )
inline
UPoseTime* UObstacleGroup::getPPoseFirst ( )
inline

Get ref to first pose in this group

Referenced by USmlTag::getObstacleGroup().

UPoseTime* UObstacleGroup::getPPoseLast ( )
inline
unsigned long UObstacleGroup::getSerial ( )
inline
void UObstacleGroup::logAll ( unsigned int  serial,
FILE *  logo 
)

Log all obstacle in group to - matlab oriented - file

References UObstacle::logObst().

Referenced by UObj3dPool::getObstGrp(), UObstaclePool::getObstGrp(), and UResLaserIfObst::handleObstGrp().

virtual UObstacle* UObstacleGroup::makeNewObst ( )
inlinevirtual

This is where new obstacles are created, the function is virtual, so it may be changed to a more special obstacle type

Returns
pointer to the newly created obstacle

Reimplemented in UObstacleGroupLaser, and UObj3dGroup.

References UObstacle::UObstacle().

void UObstacleGroup::print ( const char *  prestr)

Print status

References UObstacle::print().

Referenced by UResObstacle::snprint(), and UResObj3d::snprint().

void UObstacleGroup::print ( const char *  prestr,
char *  buff,
const int  buffCnt,
bool  detail 
)

Print obstacle group to string. If detail is true, then print details for each obstacle too. Returns result in buff, a char buffer of length buffCnt.

References UObstacle::isValid().

void UObstacleGroup::removeAllObsts ( )

Remove all obstacles in one go, without clearing the start and end poses.

References ULock::lock(), and ULock::unlock().

Referenced by UObj3dPool::clear(), and UObstaclePool::clear().

void UObstacleGroup::removeInvalid ( UTime  before,
int  hitLimit 
)

Remove invalid obstacles. Do a timeout of obstacles valid only once. , i.e earlier than this time.

References UObstacle::getHits(), UObstacle::getPPoseLast(), and UPoseTime::t.

Referenced by ULaserScan::findNearObstacles(), UObj3dPool::getObstGrp(), and UObstaclePool::getObstGrp().

void UObstacleGroup::removeObst ( int  idx)

Remove this obstacle from list of active obstacles. Swaps with last obstacle in list and then reducec count of obstacles.

Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), and USmlTag::getObstacleGroup().

void UObstacleGroup::setPoseFirst ( UPoseTime  pose)
inline

Get first pose in this group

Referenced by UObj3dPool::getObstGrp(), and UObstaclePool::getObstGrp().

void UObstacleGroup::setPoseLast ( UPoseTime  pose)
inline

Get first pose in this group

void UObstacleGroup::setSerial ( unsigned long  value)
inline

Member Data Documentation

const int UObstacleGroup::MAX_OBSTACLES = 500
static

Number of possible obstacles in a group

Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), and USmlTag::getObstacleGroup().

unsigned long UObstacleGroup::nextObstSerial
protected
UObstacle* UObstacleGroup::obsts[MAX_OBSTACLES]
protected

List of obstacles (on heap)

Referenced by UObstacleGroupLaser::addObstPoly(), and UObj3dGroup::addObstPoly().

int UObstacleGroup::obstsCnt
protected

Number of used obstacles

Referenced by UObstacleGroupLaser::addObstPoly(), and UObj3dGroup::addObstPoly().

UPoseTime UObstacleGroup::poseFirst
protected

First poseTime that contributed to this obstacle

UPoseTime UObstacleGroup::poseLast
protected

Latest poseTime that contributed to this obstacle

Referenced by UObstacleGroupLaser::addObstPoly(), and UObj3dGroup::addObstPoly().

unsigned long UObstacleGroup::serial
protected

Group serial number - the serial number is used when updating to ensure the correct group is updated.

Referenced by UObstacleGroupLaser::addObstPoly().


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