AURobotServers
4
|
#include <uobstaclepool.h>
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) |
UObstacleGroupLaser * | advanceNewGroup () |
void | clear () |
void | clearGrp (int idx) |
UObstacleGroup * | getFixeds () |
UObstacleGroupLaser * | getGroup (int fromNewest) |
int | getGroupsCnt () |
virtual void | getObstacleGroupSettings (UObstacleGroupLaser *og) |
UObstacleGroupLaser * | getObstGrp (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 | |
UObstacleGroup * | fixeds |
UObstacleGroupLaser * | groups [MAX_OBSTACLE_GROUPS] |
int | groupsCnt |
FILE * | logo |
int | newest |
double | newGroupTime |
double | newGrpDist |
unsigned long | nextSerial |
Historic updated obstacles, divided into groups
UObstaclePool::UObstaclePool | ( | ) |
Constructor
|
virtual |
Destructor
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
scan | laserscan |
odoPose | is the odoPose at scantime |
idx1 | is first measurement of obstacle |
idx2 | is last measurment in obstacle |
outdoorObstacle | allows more separation if true |
ignoreIfFixed | when true, then all obstacles that overlaps fixed obstacles gets ignored. |
horizontalScan | if false, then tilted and allows correlation of rough grass areas |
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
poly | obstacle polygon to add |
odoPose | is the odoPose at scantime |
outdoorObstacle | allows more separation if true |
horizontalScan | if false, then tilted and allows correlation of rough grass areas |
ignoreIfFixed | when true, then all obstacles that overlaps fixed obstacles gets ignored. |
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().
|
inline |
Get pointer to obstacle group with near fixed obstacles
Referenced by UFunctionPassable::makePoly(), and UFunctionPassable::sendObstacles().
UObstacleGroupLaser * UObstaclePool::getGroup | ( | int | fromNewest | ) |
Get number of groups in history
Referenced by ULaserScan::findNearObstacles(), UFunctionPassable::makePoly(), UFunctionPassable::sendObstacles(), and UResObstacle::snprint().
|
inline |
Get number of groups in history
Referenced by ULaserScan::findNearObstacles(), UFunctionPassable::makePoly(), and UFunctionPassable::sendObstacles().
|
virtual |
Load parameter values from current settings pool to this obstacle group
Reimplemented in UResObstacle.
UObstacleGroupLaser * UObstaclePool::getObstGrp | ( | UPoseTime | pt | ) |
Get the obstacle group relevant for this time and robot position. Return pointer to the group.
References UObstacleGroup::getPoseFirst(), UObstacleGroup::logAll(), UObstacleGroup::removeInvalid(), UObstacleGroup::setPoseFirst(), UObstacleGroupLaser::setPosePrev(), UPoseTime::t, UPose::x, and UPose::y.
Referenced by ULaserScan::findNearObstacles(), and UFunctionPassable::handleObstGet().
|
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.
scan | is the laserscan |
odoPose | is the odometry pose at the time of the scan |
idx1,idx2 | is the first and last measurement to be converted into an obstacle polygon. |
p40 | is the destination polygon for the result. |
outdoorObsts | if frue, then horizontal obstacles and tilted sensor is assumed, and an extra point is added to the polygon to allow better correlation. |
horizontalScan | if true, then scan is assumed to be horizontal. |
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
|
inline |
Set group of fixed obstacles
void UObstaclePool::setLogFile | ( | FILE * | logFile | ) |
Set obstacle logfile
|
inline |
Set distance traveled by robot before new obstacle group are to be formed (meter).
Referenced by UResObstacle::getObstacleGroupSettings().
|
inline |
Set time passed before new obstacle group are to be formed (in seconds).
Referenced by UResObstacle::getObstacleGroupSettings().
|
protected |
Group of fixed obstacles from a-priori map (mapbase)
Referenced by UResObstacle::updateMappedObstacles(), UResObstacle::UResObstacle(), and UResObstacle::~UResObstacle().
|
protected |
Obstacle groups, each holding a coordinate-wise coherent set of obstacles - distance less than e.g 25 m from start to end pose.
|
protected |
Actual used number of obstacle groups
Referenced by UResObstacle::obstDataUpdated(), and UResObstacle::snprint().
|
protected |
Obstacle logfile
|
static |
Max number of groups
|
protected |
The most recent obstacle group. When out of groups, then reuse.
Referenced by UResObstacle::obstDataUpdated().
|
protected |
Time passed before new obstacle group are to be formed (in seconds).
|
protected |
Distance traveled by robot before new obstacle group are to be formed (meter).
|
protected |
Next serial number to use for obstacle group