AURobotServers
4
|
#include <uprobpoly.h>
Public Member Functions | |
bool | addPos (UPosition pos, bool hardEdge) |
virtual void | clear () |
double | getCromaSD () |
int | getCrossingsAtX (double atX, double *ys, bool *isYAnObst, int bufSize) |
int | getCrossingsAtXinYorder (double atX, double *ys, bool *isYAnObst, int bufSize) |
int | getCrossingsAtY (double atY, double *xs, bool *xIsAnObst, int bufSize) |
bool * | getIsObst () |
UPose | getPoseNow () |
UPose | getPoseOrg () |
UTime | getPoseTime () |
bool | isValid () |
bool | moveToMap (UPose toPose) |
bool | moveToPose (UPose poseNew, UTime poseTime) |
bool | paintRobot (UImage *img, int refX, int refY, double cellSize) |
void | print (const char *prestring, bool verbose) |
void | setCromaSD (double value) |
bool | setPoly (UPose robPose, UTime poseTime) |
void | setPoseNow (double x, double y, double h) |
void | setPoseNow (UPose pose) |
void | setPoseOrg (UPose pose) |
void | setPoseOrg (double x, double y, double h) |
void | setTime (UTime t) |
void | setValid (bool value) |
UProbPoly () | |
~UProbPoly () | |
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) |
virtual const char * | getDataType () |
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) |
virtual void | sortByAngleXYTo (UPosition *pc) |
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 () | |
Static Public Attributes | |
static const int | MAX_POINTS = 900 |
Protected Attributes | |
bool | isObst [MAX_POINTS] |
UPose | poseNow |
UPose | poseOrg |
UTime | poseOrgTime |
double | seedCromaSD |
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 |
Private Attributes | |
UPosition | data [MAX_POINTS] |
UPosition * | pdata [MAX_POINTS] |
Additional Inherited Members | |
Public Attributes inherited from UPolygon | |
char | color [8] |
Protected Member Functions inherited from UPolygon | |
bool | copySortedTo (UPolygon *destination) |
Maximum number of points in each polygon. Maximum number of stored path polygons Class to hold one passable polygon and the related information
UProbPoly::UProbPoly | ( | ) |
Constructor
References clear(), data, MAX_POINTS, pdata, UPolygon::points, UPolygon::pointsMax, and UPolygon::ppoints.
UProbPoly::~UProbPoly | ( | ) |
Destructor
bool UProbPoly::addPos | ( | UPosition | pos, |
bool | hardEdge | ||
) |
Add a new position to the polygon. Returns true if space for new position
References UPolygon::add(), isObst, MAX_POINTS, and UPolygon::pointsCnt.
Referenced by UImgPolyProj::doProjectPolygonToFloorReal(), UImgProj::doProjectPolygonToFloorReal(), and USmlTag::getProbPoly().
|
virtual |
Clear data in polygon
Reimplemented from UPolygon.
References UPolygon::clear(), seedCromaSD, and valid.
Referenced by UFuncImgPoly::findAreaFromSeedRGB(), UFunctionCamPath::findPath(), USmlTag::getProbPoly(), UClientFuncPath::handlePathPolygonData(), and UProbPoly().
|
inline |
Set the value seedCromaSD to this value
Referenced by USmlTag::sendProbPoly().
int UProbPoly::getCrossingsAtX | ( | double | atX, |
double * | ys, | ||
bool * | isYAnObst, | ||
int | bufSize | ||
) |
finds the rectangular limits in 2 dimentions (X and Y) of this polygon. Returns true if there is any points in the polygon and all 4 limit value pointers are provided Get get polygon crossings with this x-line. The xrossings are returned to an array of Y values. The buffer size is bufSize. No more than bufCnt crossings are returned. Returns the number of found crossings. Returns -1 if buffer is NULL and 0 if no polygon or no crossings. The crossings are returnned in the order found, while traversing polygon forward. If 'isYanObst' != NULL, then this array is filled with information about crossing is with an image edge or an assumed obstacle. Returns bufSize if at least bufSize crossings are found.
References U2Dline::getCrossing(), isObst, UPolygon::points, UPolygon::pointsCnt, U2Dline::set2P(), U2Dline::setPV(), UPosition::x, and UPosition::y.
Referenced by getCrossingsAtXinYorder(), and setPoseOrg().
int UProbPoly::getCrossingsAtXinYorder | ( | double | atX, |
double * | ys, | ||
bool * | isYAnObst, | ||
int | bufSize | ||
) |
Get crossings at this x-value and sort result in decreasing y order. Returns number of crossings
References a, and getCrossingsAtX().
Referenced by setPoseOrg().
int UProbPoly::getCrossingsAtY | ( | double | atY, |
double * | xs, | ||
bool * | xIsAnObst, | ||
int | bufSize | ||
) |
Same as GetCrossingsAtX, but for crossings of an Y-line. The crossings are sorted in increasing x order.
References U2Dline::getCrossing(), isObst, UPolygon::points, UPolygon::pointsCnt, U2Dline::set2P(), U2Dline::setPV(), UPosition::x, and UPosition::y.
Referenced by UProbGrid::makeProbGrid2(), and setPoseOrg().
|
inline |
Get pointer to first element in polygon Get pointer to first boolean flag for edge not beeing on an image edge
References isObst.
Referenced by UProbGrid::getNewIsObst(), UClientFuncPath::handlePathPolygonData(), UProbGrid::makeProbGrid(), UNavPaint::paintFreePoly(), UClientFuncLaserGui::paintFreePoly(), UNavView::paintFreePoly(), and USmlTag::sendProbPoly().
|
inline |
Get number of vertices in polygon Get pointer to number of vertices in polygon. Used, when adjusting number of valid polygons. Get pose used in last projection.
References poseNow.
Referenced by UProbGrid::makeProbGrid(), and UProbGrid::makeProbGrid2().
|
inline |
Get pose used in last projection.
References poseOrg.
Referenced by UClientFuncLaserGui::doImage(), UResCamIfPath::newDataAvailable(), and USmlTag::sendProbPoly().
|
inline |
Get time for dataset
References poseOrgTime.
Referenced by UClientFuncLaser::handleGetComplexData(), UProbGrid::makeProbGrid(), UProbGrid::makeProbGrid2(), UResCamIfPath::newDataAvailable(), USmlTag::sendProbPoly(), and UResCamIfPath::snprint().
|
inline |
Get valid flag
References valid.
Referenced by USmlTag::getProbPoly(), UResCamIfPath::newDataAvailable(), and UResCamIfPath::snprint().
bool UProbPoly::moveToMap | ( | UPose | toPose | ) |
Move the positions in the polygon to map coordinates, assuming coordinates are relatiive to this pose.
References UPose::getPoseToMap(), UPolygon::points, UPolygon::pointsCnt, and poseNow.
Move position back corresponding so that all points now are seen from this pose.
References absd(), UPose::getMapToPose(), UPose::h, UPolygon::points, UPolygon::pointsCnt, poseNow, UPose::x, and UPose::y.
Referenced by UProbGrid::makeProbGrid(), and UProbGrid::makeProbGrid2().
bool UProbPoly::paintRobot | ( | UImage * | img, |
int | refX, | ||
int | refY, | ||
double | cellSize | ||
) |
Paint robot pose in image (in blue) prior to painting probability grid in green plane. The refX, refY is the center position, where robot is now. cellSize is scale inmeters per pixel.
References UImage::cvArr(), UPose::getPoseToMap(), poseNow, poseOrg, UPosition::position(), roundi(), UPosition::x, and UPosition::y.
Referenced by UProbGrid::makeProbGrid(), UProbGrid::makeProbGrid2(), and setPoseOrg().
void UProbPoly::print | ( | const char * | prestring, |
bool | verbose | ||
) |
Print polygon to console
References bool2str(), isObst, UPolygon::points, UPolygon::pointsCnt, poseNow, poseOrgTime, UPose::print(), UPosition::print(), and UTime::print().
Referenced by UProbPolyQueue::print(), and setPoseOrg().
|
inline |
Set the value seedCromaSD to this value
References seedCromaSD.
Referenced by UFuncImgPoly::findAreaFromSeedRGB(), UFunctionCamPath::findPath(), and USmlTag::getProbPoly().
Allocates new polygon space and sets pose and time. The polygon count is set to buffer size.
References poseNow, poseOrg, poseOrgTime, and valid.
Referenced by UFuncImgPoly::findAreaFromSeedRGB(), UFunctionCamPath::findPath(), USmlTag::getProbPoly(), and UProbGrid::setNewPolygon().
|
inline |
Set current pose
References poseNow, and UPose::set().
|
inline |
Set position when data were captured (Original pose)
References poseOrg.
Referenced by USmlTag::getProbPoly().
|
inline |
Set current pose
References getCrossingsAtX(), getCrossingsAtXinYorder(), getCrossingsAtY(), img, paintRobot(), poseOrg, print(), and UPose::set().
|
inline |
Set the polygon count - if values are set from the outside. Set polygon origin time
References poseOrgTime.
Referenced by UClientFuncPath::handlePathPolygonData().
|
inline |
Send polygon packed in SML to client. The pack is framed with the message tag name and with a 2D polygon frame:
<tagname name="name" type="UProbPoly">
<UProbPoly count="N" hasedge="true">
<poly2db x="1.2e0" y="1.2e1" edge="true/false/">
...
</UProbPoly></tagname>. Returns true if send. Set valid flag
References valid.
Referenced by USmlTag::getProbPoly(), UClientFuncLaser::handleGetComplexData(), UClientFuncPath::handlePathPolygonData(), UProbPolyQueue::lockNextIn(), and UProbPolyQueue::unlockNextIn().
|
private |
Array of points
Referenced by UProbPoly().
|
protected |
Points describing the passabel path Number of points in polygon Flag to mark if the corresponding point were on image edge
Referenced by addPos(), getCrossingsAtX(), getCrossingsAtY(), getIsObst(), and print().
|
static |
Referenced by addPos(), UProbGrid::makeProbGrid(), and UProbPoly().
|
private |
Array of pointers for sorting etc
Referenced by UProbPoly().
|
protected |
Pose that is correct for the current polygon projection.
Referenced by getPoseNow(), moveToMap(), moveToPose(), paintRobot(), print(), setPoly(), and setPoseNow().
|
protected |
Original pose for this polygon.
Referenced by getPoseOrg(), paintRobot(), setPoly(), and setPoseOrg().
|
protected |
Time of original pose polygon
Referenced by getPoseTime(), print(), setPoly(), and setTime().
|
protected |
If the polygon is from a path analysis, there is a standard deviation of the seed area cromatisity, that might be relevant. This can be stored in this variable.
Referenced by clear(), and setCromaSD().
|
protected |
Is polygon valid, i.e. is all received
Referenced by clear(), isValid(), setPoly(), and setValid().