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

#include <uobstaclepool.h>

Inheritance diagram for UObstaclePool:
Inheritance graph

Public Member Functions

bool addObst (ULaserScan *scan, UPoseTime odoPose, int idx1, int idx2, bool outdoorObsts, bool horizontalScan, bool ignoreIfFixed)
 
bool addObst (UPolygon *poly, UPoseTime odoPose, bool outdoorObsts, bool horizontalScan, bool ignoreIfFixed)
 
UObstacleGroupLaseradvanceNewGroup ()
 
void clear ()
 
void clearGrp (int idx)
 
UObstacleGroupgetFixeds ()
 
UObstacleGroupLasergetGroup (int fromNewest)
 
int getGroupsCnt ()
 
virtual void getObstacleGroupSettings (UObstacleGroupLaser *og)
 
UObstacleGroupLasergetObstGrp (UPoseTime pt)
 
virtual void obstDataUpdated (UTime poseTime)
 
bool pointsToPolygon (ULaserScan *scan, UPoseTime odoPose, int idx1, int idx2, UPolygon *p40, bool outdoorObsts, bool horizontalScan)
 
void print (const char *prestr)
 
void setFixedObstacles (UObstacleGroup *fixedObstGrp)
 
void setLogFile (FILE *logFile)
 
void setNewGrpDist (double value)
 
void setNewGrpTime (double value)
 
 UObstaclePool ()
 
virtual ~UObstaclePool ()
 

Static Public Attributes

static const int MAX_OBSTACLE_GROUPS = 100
 

Protected Attributes

UObstacleGroupfixeds
 
UObstacleGroupLasergroups [MAX_OBSTACLE_GROUPS]
 
int groupsCnt
 
FILE * logo
 
int newest
 
double newGroupTime
 
double newGrpDist
 
unsigned long nextSerial
 

Detailed Description

Historic updated obstacles, divided into groups

Author
Christian Andersen

Constructor & Destructor Documentation

UObstaclePool::UObstaclePool ( )

Constructor

UObstaclePool::~UObstaclePool ( )
virtual

Destructor

Member Function Documentation

bool UObstaclePool::addObst ( ULaserScan scan,
UPoseTime  odoPose,
int  idx1,
int  idx2,
bool  outdoorObsts,
bool  horizontalScan,
bool  ignoreIfFixed 
)

Add an obstacle, using this scan and this index interval

Parameters
scanlaserscan
odoPoseis the odoPose at scantime
idx1is first measurement of obstacle
idx2is last measurment in obstacle
outdoorObstacleallows more separation if true
ignoreIfFixedwhen true, then all obstacles that overlaps fixed obstacles gets ignored.
horizontalScanif false, then tilted and allows correlation of rough grass areas
Returns
true if added

References UObstacleGroupLaser::addObst().

Referenced by ULaserScan::findNearObstacles(), and UResLobst::sendAsObstacles().

bool UObstaclePool::addObst ( UPolygon poly,
UPoseTime  odoPose,
bool  outdoorObsts,
bool  horizontalScan,
bool  ignoreIfFixed 
)

Add an obstacle to obstacle group, and advance to new group as intended

Parameters
polyobstacle polygon to add
odoPoseis the odoPose at scantime
outdoorObstacleallows more separation if true
horizontalScanif false, then tilted and allows correlation of rough grass areas
ignoreIfFixedwhen true, then all obstacles that overlaps fixed obstacles gets ignored.
Returns
true if added

References UObstacleGroupLaser::addObstPoly(), UObstacle::getMargin(), and UPolygon::isOverlappingXYconvex().

UObstacleGroupLaser * UObstaclePool::advanceNewGroup ( )

Advance to next obstacle group, and return pointer to new cleared group.

References UObstacleGroup::clear(), UObstacleGroup::setSerial(), and UObstacleGroupLaser::UObstacleGroupLaser().

void UObstaclePool::clear ( void  )

Clear all obstacles from obstacle pool, that is remove all obstacles from all groups, but maintain the groups with pose and other informations.

References UObstacleGroup::getPoseLast(), and UObstacleGroup::removeAllObsts().

Referenced by UFunctionPassable::handleObstGet().

void UObstaclePool::clearGrp ( int  idx)

Clear all obstacles from obstacle group. The 'idx' is the group to clear, idx = 0 clears the newest group and idx 1..N clears corresponding older groups.

References UObstacleGroup::getPoseLast().

Referenced by UFunctionPassable::handleObstGet().

UObstacleGroup* UObstaclePool::getFixeds ( )
inline

Get pointer to obstacle group with near fixed obstacles

Referenced by UFunctionPassable::makePoly(), and UFunctionPassable::sendObstacles().

UObstacleGroupLaser * UObstaclePool::getGroup ( int  fromNewest)
int UObstaclePool::getGroupsCnt ( )
inline
void UObstaclePool::getObstacleGroupSettings ( UObstacleGroupLaser og)
virtual

Load parameter values from current settings pool to this obstacle group

Reimplemented in UResObstacle.

UObstacleGroupLaser * UObstaclePool::getObstGrp ( UPoseTime  pt)
void UObstaclePool::obstDataUpdated ( UTime  poseTime)
virtual

Obstacle data is updated - tell resource

Reimplemented in UResObstacle.

Referenced by ULaserScan::findNearObstacles().

bool UObstaclePool::pointsToPolygon ( ULaserScan scan,
UPoseTime  odoPose,
int  idx1,
int  idx2,
UPolygon p40,
bool  outdoorObsts,
bool  horizontalScan 
)

Convert parts of a laserscan to a convex polygon. The measurements are converted to odometry coordinates on return.

Parameters
scanis the laserscan
odoPoseis the odometry pose at the time of the scan
idx1,idx2is the first and last measurement to be converted into an obstacle polygon.
p40is the destination polygon for the result.
outdoorObstsif frue, then horizontal obstacles and tilted sensor is assumed, and an extra point is added to the polygon to allow better correlation.
horizontalScanif true, then scan is assumed to be horizontal.
Returns
true if a valid polygon is created.

References UPolygon::add(), UPolygon::extractConvexTo(), UPolygon::getPoints(), UPolygon::getPointsCnt(), ULaserScan::getPos(), UObstacleGroupLaser::getPosePrev(), UPose::getPoseToMap(), UPosRot::getRtoMMatrix(), ULaserScan::getSensorPose(), UPolygon::removeNearVertex(), UPosRot::setPhi(), UPosRot::setZ(), and UPosition::x.

void UObstaclePool::print ( const char *  prestr)

Add a series of UPosition positions as an obstacle. The position need not be orderd. A new obstacle group will be added as needed. At least one point is needed and no more than 400 can be handled. If 'firmObst' then obstacle hit count is set to 2 to avoid beeing removed if not correlated. Returns true if successful. Print status to console

void UObstaclePool::setFixedObstacles ( UObstacleGroup fixedObstGrp)
inline

Set group of fixed obstacles

void UObstaclePool::setLogFile ( FILE *  logFile)

Set obstacle logfile

void UObstaclePool::setNewGrpDist ( double  value)
inline

Set distance traveled by robot before new obstacle group are to be formed (meter).

Referenced by UResObstacle::getObstacleGroupSettings().

void UObstaclePool::setNewGrpTime ( double  value)
inline

Set time passed before new obstacle group are to be formed (in seconds).

Referenced by UResObstacle::getObstacleGroupSettings().

Member Data Documentation

UObstacleGroup* UObstaclePool::fixeds
protected

Group of fixed obstacles from a-priori map (mapbase)

Referenced by UResObstacle::updateMappedObstacles(), UResObstacle::UResObstacle(), and UResObstacle::~UResObstacle().

UObstacleGroupLaser* UObstaclePool::groups[MAX_OBSTACLE_GROUPS]
protected

Obstacle groups, each holding a coordinate-wise coherent set of obstacles - distance less than e.g 25 m from start to end pose.

int UObstaclePool::groupsCnt
protected

Actual used number of obstacle groups

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

FILE* UObstaclePool::logo
protected

Obstacle logfile

const int UObstaclePool::MAX_OBSTACLE_GROUPS = 100
static

Max number of groups

int UObstaclePool::newest
protected

The most recent obstacle group. When out of groups, then reuse.

Referenced by UResObstacle::obstDataUpdated().

double UObstaclePool::newGroupTime
protected

Time passed before new obstacle group are to be formed (in seconds).

double UObstaclePool::newGrpDist
protected

Distance traveled by robot before new obstacle group are to be formed (meter).

unsigned long UObstaclePool::nextSerial
protected

Next serial number to use for obstacle group


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