AURobotServers
4
|
#include <uobstacle.h>
Public Member Functions | |
virtual void | clear () |
virtual const char * | codeXml (char *buf, const int bufCnt, char *extraAttr) |
virtual const char * | codeXmlAttributes (char *buf, const int bufCnt) |
virtual const char * | getDataType () |
int | getHits () |
double | getMargin () |
UPoseTime | getPoseFirst () |
UPoseTime | getPoseLast () |
UPoseTime * | getPPoseFirst () |
UPoseTime * | getPPoseLast () |
unsigned long | getSerial () |
void | initPoseFirst (UPoseTime pose) |
bool | isValid () |
void | logObst (FILE *logo) |
bool | mergeableOnCogLimits (UPolygon *other, double margin) |
void | print (const char *prestr) |
void | print (const char *prestr, char *buff, const int buffCnt) |
void | setHits (int value) |
void | setMargin (double value) |
void | setPoseFirst (UPoseTime pose) |
void | setPoseLast (UPoseTime pose) |
void | setSerial (unsigned long value) |
void | setValid (bool value) |
UObstacle () | |
~UObstacle () | |
Public Member Functions inherited from UPolygon40 | |
virtual void | sortByAngleXYTo (UPosition *pc) |
UPolygon40 () | |
Public Member Functions inherited from UPolygon | |
bool | add (UPosition point) |
bool | add (UPosition *point) |
bool | add (UPolygon *poly) |
bool | add (double x, double y, double z=0) |
virtual char * | codeXml (char *buf, const int bufCnt, const char *extraAttr) |
char * | codeXml (const char *name, char *buf, int bufCnt, const char *extra) |
bool | copy (CvPoint *source, int sourceCnt) |
bool | copyPointsTo (UPolygon *destination) |
bool | copyTo (UPolygon *destination) |
bool | cut (U2Dlined *line, UPolygon *source, UPolygon *dstL, UPolygon *dstR) |
int | cutPoints (U2Dlined *line, U2Dpos *xPnts, int xPntsCnt) |
bool | extractConvexTo (UPolygon *destination) |
double | getClosestDistance (double toX, double toY, double maxRelevantDist, UPosition *closest, bool *atVertex=NULL) |
int | getCloseVertexCnt (double dist) |
UPosition | getCogXY () |
double | getCogXYmaxDist () |
int | getCrossings (ULineSegment *seg, UPosition xes[], const int xesCnt) |
double | getDistance (double x, double y, int *closeSide=NULL, int *closeVertex=NULL) |
double | getDistanceXYsigned2 (UPosition pos, int *idx, UPosition *posOnPolygon, bool *vertex) |
UPosition * | getFromTop (int fromTop) |
UPosition | getLastPoint () |
bool | getLimits (double *minx, double *miny, double *maxx, double *maxy) |
UPosition * | getLowerLeftXY () |
double | getMostDistantVertexXY (double x, double y, double h, int side, UPosition *posOnPolygon) |
int | getMostDistantXY (ULineSegment *line, bool leftSide, bool insideSegment, double *distance, int exclude=-1, double *tPos=NULL) |
UPosition | getPoint (int index) |
UPosition * | getPoints () |
int | getPointsCnt () |
int | getPointsMax () |
UPosition | getPPoint (int index) |
UPosition ** | getPPoints () |
ULineSegment | getSegment (int index) |
double | getXYarea () |
bool | insert (UPosition pos, int index) |
virtual bool | isAlsoA (const char *typeString) |
bool | isCogXYvalid () |
bool | isEmbedded (UPolygon *other, double *maxDist=NULL) |
bool | isInsideConvex (double x, double y, double margin=0.0) |
bool | isOverlappingXY (UPolygon *poly2, int *count=NULL, UPosition xes[]=NULL, const int xesCnt=0) |
bool | isOverlappingXYconvex (UPolygon *poly2, double margin, int *closeThis=NULL, int *closePoly2=NULL) |
bool | isOverlappingXYconvex2 (UPolygon *poly2, double margin, UPosition *close=NULL) |
bool | isOverlappingXYconvexSeg (UPolygon *poly2, double margin, int closeThis[6], int *closeThisCnt, int closePoly2[6], int *closePoly2Cnt) |
bool | isOverlappingXYtype (UPolygon *poly2, int *xcnt, UPosition xes[], const int xesCnt, int type[]) |
bool | isPolygon () |
bool | isPolyline () |
UPosition | pop () |
void | print (const char *prestring) |
void | printSort (const char *prestring) |
bool | push (UPosition *point) |
void | remove (int index) |
int | removeNearVertex (double dist) |
void | setAsPolygon (bool value=true) |
void | setAsPolyline (bool value=true) |
void | setCogXYvalid (bool value) |
void | setColor (const char *colorStr) |
bool | setPoint (int idx, UPosition pos) |
void | setPointsCnt (int value) |
bool | setSize (int maxPoints) |
virtual void | snprint (const char *prestring, char *buff, const int buffCnt) |
bool | toConvex () |
UPolygon () | |
virtual | ~UPolygon () |
Public Member Functions inherited from UDataBase | |
bool | isA (const char *typeString) |
UDataBase () | |
virtual | ~UDataBase () |
Public Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Protected Attributes | |
int | hits |
double | margin |
UPoseTime | pose1 |
UPoseTime | pose2 |
unsigned long | serial |
bool | valid |
Protected Attributes inherited from UPolygon | |
bool | aPolygon |
UPosition | cogXY |
double | cogXYmaxDist |
bool | cogXYvalid |
UPosition * | points |
int | pointsCnt |
int | pointsMax |
UPosition ** | ppoints |
int | ppointsCnt |
Additional Inherited Members | |
Public Attributes inherited from UPolygon | |
char | color [8] |
Static Public Attributes inherited from UPolygon40 | |
static const int | MAX_POINTS = 40 |
Protected Member Functions inherited from UPolygon | |
bool | copySortedTo (UPolygon *destination) |
A polygon description of an obstacle
UObstacle::UObstacle | ( | ) |
UObstacle::~UObstacle | ( | ) |
Destructor
|
virtual |
Clear obstaccle
Reimplemented from UPolygon.
Reimplemented in UObstacleVision.
References UPolygon::clear(), hits, and valid.
Referenced by UObstacleGroupLaser::addObstPoly(), UAvoidPath2::addStartAndExit(), UObstacleVision::clear(), getDataType(), UObstacleGroup::getNewObst(), and UObstacleGroup::UObstacleGroup().
|
virtual |
Code this structure in XML format. The open tag includes any additional XML attributes from the codeXmlAttributes function call
buf | is the character buffer where the attributes are stored |
bufCnt | is the amount of buffer space allocated |
References buf, UPolygon::codeXml(), UPoseTime::codeXml(), codeXmlAttributes(), getDataType(), mini(), pose1, and pose2.
Referenced by setSerial().
|
virtual |
code any special attributes to go into this obstacle, apart from type and name.
buf | is the character buffer where the attributes are stored |
bufCnt | is the amount of buffer space allocated |
Reimplemented in UObstacleVision.
References bool2str(), buf, getHits(), getSerial(), and isValid().
Referenced by USmlTag::codeObstacle(), codeXml(), and setSerial().
|
inlinevirtual |
Trim obstacle by new scan, i.e Either the obstacle is moved or pose error has changed, or invis due to observation. Takes a laserscan and trims obstacle if seen through Get (end) type of this structure
Reimplemented from UPolygon.
Reimplemented in UObstacleVision, and UObstaclePass.
References clear().
Referenced by USmlTag::codeObstacle(), and codeXml().
|
inline |
Get hits count
References hits, and logObst().
Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), codeXmlAttributes(), and UObstacleGroup::removeInvalid().
|
inline |
get margin for this obstacle. Margin is a distance from the polygon line, where detections of the obstacle are likely. Used by locater - and obstacle correlation.
References margin, and mergeableOnCogLimits().
Referenced by UObstaclePool::addObst().
|
inline |
Get pose1 - obstacle latest seen from this pose.
References pose1.
Referenced by UAvoidPath2::addNoVisLinesAsObstacles(), UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), and USmlTag::codeObstacle().
|
inline |
Get pose2 - obstacle latest seen from this pose.
References pose2.
Referenced by USmlTag::codeObstacle(), and UFunctionPassable::makePoly().
|
inline |
Get ref to pose1 - obstacle latest seen from this pose.
References pose1.
Referenced by USmlTag::getObstacle().
|
inline |
Get ref to pose2 - obstacle latest seen from this pose.
References pose2.
Referenced by USmlTag::getObstacle(), UObstacleGroup::removeInvalid(), UFuncObj3d::sendObjects(), and UFunctionPassable::sendObstacles().
|
inline |
Get serial number for obstacle in group
References serial.
Referenced by codeXmlAttributes(), UResAvoid::copyAvoidObstacles(), UAvoidObst::crossingNonVisibilityLine(), UAvoidVertexIdx::extent4thPnt(), UAvoidCellGraph::fillVerticeList(), UAvoidPath2::groupObstacles(), UAvoidPath2::logObstacleGroups(), UAvoidPath2::logPathSequences(), UAvoidCellGraph::makeCells(), UAvoidCellGraph::printObstacleList(), UAvoidCellGraph::printVetrexList(), UFuncObj3d::sendObjects(), UFunctionPassable::sendObstacles(), and UAvoidObst::testVisibility().
|
inline |
Set pose1 - obstacle first seen from this pose. also sets pose2, as this is also latest pose.
References hits, pose1, and pose2.
Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), and UAvoidPath2::addStartAndExit().
|
inline |
is valid flag set
References print(), and valid.
Referenced by UObstacleGroupLaser::addObstPoly(), UReactivePath::avoidObst(), codeXmlAttributes(), UAvoidPath2::groupObstacles(), UNavPaint::paintObstGrp(), UClientFuncLaserGui::paintObstGrp(), UNavView::paintObstGrp(), print(), and UObstacleGroup::print().
void UObstacle::logObst | ( | FILE * | logo | ) |
Save all obstacle verteces to logfile
References UPolygon::points, UPolygon::pointsCnt, UPosition::x, and UPosition::y.
Referenced by getHits(), and UObstacleGroup::logAll().
bool UObstacle::mergeableOnCogLimits | ( | UPolygon * | other, |
double | margin | ||
) |
Is other obstacle with meargeable with this. Requires that COG is inside this obstacle, and the most extreme vertex of other obstacle is within margin of this obstacle. The reverse situation is tested too - with same result.
other | is the other obstacle. |
margin | is the maximum allowed distance of any vertex from other to be outside this obstacle (or the other way around). |
References UPolygon::getClosestDistance(), UPolygon::getCogXY(), UPolygon::getPoint(), UPolygon::getPointsCnt(), UPosition::x, and UPosition::y.
Referenced by UObstacleGroupLaser::addObstPoly(), and getMargin().
void UObstacle::print | ( | const char * | prestr | ) |
Print status of this obstacle
Referenced by isValid(), UObstacleGroup::print(), and UObstacleGroup::setSerial().
void UObstacle::print | ( | const char * | prestr, |
char * | buff, | ||
const int | buffCnt | ||
) |
Print obstacle group to string. Returns result in buff, a char buffer of length buffCnt.
References bool2str(), UPolygon::getCogXY(), UPolygon::getCogXYmaxDist(), hits, isValid(), UPolygon::pointsCnt, UPosition::x, and UPosition::y.
|
inline |
Set hit count
References hits.
Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), and USmlTag::getObstacle().
|
inline |
set margin for this obstacle. Margin is a distance from the polygon line, where detections of the obstacle are likely. Used by locater - and obstacle correlation.
References margin.
Referenced by UResMapObst::getNearObstacles().
|
inline |
Set pose1 only (update).
References pose1, and setPoseLast().
Referenced by UAvoidPath2::addNoVisLinesAsObstacles(), UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), and UResMapObst::getNearObstacles().
void UObstacle::setPoseLast | ( | UPoseTime | pose | ) |
Set pose2 - obstacle latest seen from this pose. and increase pose hit cnt
References hits, pose2, UPoseTime::t, and valid.
Referenced by UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), UResMapObst::getNearObstacles(), and setPoseFirst().
|
inline |
Set serial number for obstacle in group
References buf, codeXml(), codeXmlAttributes(), and serial.
Referenced by UAvoidPath2::addNoVisLinesAsObstacles(), UObstacleGroup::getNewObst(), UObstacleGroup::getObstacle(), and UAvoidPath2::UAvoidPath2().
|
inline |
Set valid flag
References valid.
Referenced by UAvoidPath2::addNoVisLinesAsObstacles(), UObstacleGroupLaser::addObstPoly(), UObj3dGroup::addObstPoly(), UAvoidPath2::addStartAndExit(), USmlTag::getObstacle(), and UAvoidPath2::removeEqualXvertices().
|
protected |
Referenced by clear(), getHits(), initPoseFirst(), print(), setHits(), setPoseLast(), and UObstacle().
|
protected |
margin for this obstacle, when correlation measurements to the obstacle. - value from mapbase and used by locater.
Referenced by getMargin(), setMargin(), and UObstacle().
|
protected |
First seen by
Referenced by codeXml(), getPoseFirst(), getPPoseFirst(), initPoseFirst(), and setPoseFirst().
|
protected |
Last seen by
Referenced by codeXml(), getPoseLast(), getPPoseLast(), initPoseFirst(), and setPoseLast().
|
protected |
Obstacle serial number inside obstacle group
Referenced by UObstacleGroup::getObstacle(), getSerial(), UObstacleGroup::getSerial(), setSerial(), UObstacleGroup::setSerial(), and UObstacleGroup::UObstacleGroup().
|
protected |
Is obstacle valid, invalid if as long as it is small and not revalidated by another observation
Referenced by clear(), isValid(), setPoseLast(), setValid(), and UObstacle().