AURobotServers
4
|
#include <uavoidlink.h>
Public Member Functions | |
void | clear () |
UPosition | getOtherEnd (int k) |
int | getOtherEndIdx (int k) |
ULineSegment | getTangentLine (int idx) |
UPosition | getThisEnd (int k) |
void | setBadEdgeAndVertex (double margin) |
UAvoidLink () | |
void | visibilityTest (UAvoidLink *other) |
Public Attributes | |
UAvoidObst * | aob |
int | aobIdx [4] |
UAvoidLink * | empty |
int | idx [4] |
UAvoidLinkSeq * | lnkSeq [4] |
UAvoidLink * | mirror |
UAvoidLink * | next |
int | serial |
int | tangentCnt |
UAvoidObst * | tob |
bool | valid [4] |
Private Member Functions | |
bool | isWithin (double x, double lim1, double lim2) |
An AvoidLine is describes tangent lines between two obstacles. in total 4 tangent lines can exist between any two obstacles. An array with 4 entries describe the valid tangent lines, and the connection details. The lines atr always orderd as follows: index : this other
0 : CV(L) CV(L) – cross tangent
1 : CCV(R) CV(L) – outher tangent
2 : CV(L) CCV(R) – outher tangent
3 : CCV(R) CCV(R). – cross tangent.
this +–-----—2-----—/–+ other
+++ \ / +++
+++++ –3------—0 ++++
++++ / \ ++++++
+----—/-—1—\ ---—++
I.e.: index 1 is CCV when tangent is fixed on 'this' obstacle and hits 'other' when turned CCV. Or when fixed on 'other' obstacle hits 'this' obstacle when turned CV. I.e.2: index 0 and 1 follows 'this' obstacle in a CCV direction, and index 0 and 2 follows the 'other' obstacle in a CV direction.
Each tangent line is associated with an obstacle. The same line is thus defined for both obstacles. One of the lines has a link to the other (mirror) line.
|
inline |
Clear to an empty state - except for the empty chain pointer
References aob, aobIdx, getOtherEnd(), getOtherEndIdx(), getTangentLine(), getThisEnd(), idx, isWithin(), lnkSeq, mirror, serial, setBadEdgeAndVertex(), tangentCnt, valid, and visibilityTest().
Referenced by UAvoidPath2::getEmptyALnk(), UAvoidLink(), and UAvoidLnkSeq::UAvoidLnkSeq().
UPosition UAvoidLink::getOtherEnd | ( | int | k | ) |
Get position at the other end of the tangent line with this index number (k). If the tangent line is not valid, then en empty line segment is returned.
Referenced by clear(), and UAvoidPath2::findRoutes().
int UAvoidLink::getOtherEndIdx | ( | int | k | ) |
A tangent index number for this obstacle can also be seen from the other obstacle, but with a different index number. This function returns that index number. The index number is the same for index 0 and 3 and 1 and 2 are reversed. Returns the converted index number.
Referenced by clear().
ULineSegment UAvoidLink::getTangentLine | ( | int | idx | ) |
Get the tangent line defined by this index 'idx' number. Returns an empty line (length = -1) if tangent line or index is not valid
References UAvoidLnkSeq::getOtherEnd(), UAvoidLnkSeq::getThisEnd(), ULineSegment::length, ULineSegment::setFromPoints(), and UPosition::z.
Referenced by UAvoidPath2::addLnksToOpenSet(), clear(), UAvoidPath2::findRoutes(), UAvoidPath2::findRoutesA(), UAvoidPath2::findRouteToDest(), UAvoidLnkSeq::getDistance(), UAvoidLnkSeq::pathCrossing(), and UFunctionAvoid::sendCurrentAvoidPath().
UPosition UAvoidLink::getThisEnd | ( | int | k | ) |
Get position at the this end of the tangent line with this index number (k). If the tangent line is not valid, then en empty line segment is returned.
Referenced by clear(), and UAvoidPath2::createPointList().
|
private |
x | is the test value. |
lim1 | is the first limit (may be smaller or larget than lim2. |
lim1 | is the second limit (may be smaller or larget than lim1. |
References a.
Referenced by clear().
void UAvoidLink::setBadEdgeAndVertex | ( | double | margin | ) |
when outher tangens are valid, the inner part of vetices (and edges) are tested for proximity to other obstacle (within 'margin'), if within margin those vertices and adjecent edge atr marked as nogo (for path tangents).
References UPosition::x, and UPosition::y.
Referenced by clear(), and UAvoidPath2::createTangentLinks().
void UAvoidLink::visibilityTest | ( | UAvoidLink * | other | ) |
Test visibility of the lines in this link against the obstacle in the other link. This is done by testing the cross point between each line against a line across the other obstacle (between the tangent points).
References a, aob, aobIdx, U2Dline::getCrossing(), UPolygon::getMostDistantVertexXY(), UPolygon::getPoint(), UPolygon::getPointsCnt(), UAvoidObst::obst, U2Dline::set2P(), valid, UPosition::x, and UPosition::y.
Referenced by clear(), and UAvoidObst::testVisibility().
UAvoidObst* UAvoidLink::aob |
the other obstacle
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), clear(), UAvoidPath2::createPointList(), UAvoidPath2::findRouteInALoop(), UAvoidPath2::findRoutes(), UAvoidPath2::findRoutesA(), UAvoidPath2::findRouteToDest(), UAvoidPath2::isInClosedSet(), UAvoidPath2::logPathSequences(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::terminateWorseCandidatesInOpenSet(), UAvoidPath2::testNoVisSegVisibility(), UAvoidObst::testVisibility(), and visibilityTest().
int UAvoidLink::aobIdx[4] |
Index to position in other obstacle polygon. The 4 elements are tangents in the direction from this and the other: index : this other
0 : CV(L) CV(L) – cross tangent
1 : CCV(R) CV(L) – outher tangent
2 : CV(L) CCV(R) – outher tangent
3 : CCV(R) CCV(R). – cross tangent.
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), clear(), UAvoidPath2::createPointList(), UAvoidPath2::findRouteInALoop(), UAvoidPath2::findRouteToDest(), UAvoidLnkSeq::getDistance(), UAvoidPath2::isInClosedSet(), UAvoidPath2::logPathSequences(), UAvoidPath2::removeTangentIfNoExitTangent(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::terminateWorseCandidatesInOpenSet(), UAvoidPath2::testNoVisSegVisibility(), and visibilityTest().
UAvoidLink* UAvoidLink::empty |
Link to next in free chain
Referenced by UAvoidPath2::getEmptyALnk(), UAvoidLink(), and UAvoidPath2::~UAvoidPath2().
int UAvoidLink::idx[4] |
Index to a vertex in this obstacle
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), clear(), UAvoidPath2::createPointList(), UAvoidPath2::findRouteInALoop(), UAvoidPath2::findRouteToDest(), UAvoidLnkSeq::getDistance(), UAvoidPath2::invalidateConcavities(), UAvoidPath2::isInClosedSet(), UAvoidPath2::logPathSequences(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::terminateWorseCandidatesInOpenSet(), UAvoidPath2::testNoVisSegVisibility(), and UAvoidObst::validTangent().
UAvoidLinkSeq* UAvoidLink::lnkSeq[4] |
Link to link sequence that that this link is part of
Referenced by clear().
UAvoidLink* UAvoidLink::mirror |
Mirror partner seen from other obstacle. This is NULL for the "original" and a pointer for the "mirrir", The tangent lines are the same except index 1 and 2 that is mirrored.
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), clear(), UAvoidPath2::countValidVisibilityLines(), UAvoidPath2::findRouteToDest(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::testNoVisSegVisibility(), and UAvoidObst::testVisibility().
UAvoidLink* UAvoidLink::next |
Link to next obstacl link description
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidLnkSeq::clear(), UAvoidPath2::countValidVisibilityLines(), UAvoidPath2::createTangentLinks(), UAvoidPath2::findRoutes(), UAvoidPath2::findRoutesA(), UAvoidPath2::findRouteToDest(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::testNoVisSegVisibility(), UAvoidObst::testVisibility(), and UAvoidObst::validTangent().
int UAvoidLink::serial |
Debug serial number for created links
Referenced by clear(), UAvoidLnkSeq::clear(), UAvoidPath2::getEmptyALnk(), UAvoidPath2::logPathSequences(), and UFunctionAvoid::sendCurrentAvoidPath().
int UAvoidLink::tangentCnt |
Number of tangent lines connecting this object with the other. It sould be 4 for normal objects, but will be 2 for point obstacles and for start and end points.
Referenced by UAvoidObst::addtangentLines(), clear(), UAvoidPath2::countValidVisibilityLines(), UAvoidPath2::createTangentLinks(), UAvoidPath2::findRoutes(), UAvoidPath2::findRoutesA(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), and UAvoidPath2::testNoVisSegVisibility().
UAvoidObst* UAvoidLink::tob |
This obstacle
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), UAvoidPath2::createPointList(), UAvoidPath2::findRouteToDest(), UAvoidLnkSeq::getDistance(), UAvoidPath2::invalidateConcavities(), UAvoidPath2::isInClosedSet(), UAvoidPath2::logPathSequences(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::terminateWorseCandidatesInOpenSet(), and UAvoidPath2::testNoVisSegVisibility().
bool UAvoidLink::valid[4] |
Is connection valid (otherwise it is assumed to be obstructed.
Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), clear(), UAvoidPath2::countValidVisibilityLines(), UAvoidPath2::findRoutes(), UAvoidPath2::findRoutesA(), UAvoidPath2::findRouteToDest(), UAvoidPath2::invalidateConcavities(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::testNoVisSegVisibility(), UAvoidObst::testVisibility(), UAvoidObst::validTangent(), and visibilityTest().