Class Trace
Defined in File Trace.hpp
Nested Relationships
Nested Types
Class Documentation
-
class Trace
Represents a trace, i.e. an edge path in the tree search. It is implemented using shared_ptr, this way we can clone an object and append an Edge with O(1) time (and also efficient in tree search). This is a chain of Connections, where the last Connection points to the one before. Therefore there are some limitations to it.
Public Functions
-
Trace(const Edge &edge, const double &heur, const Trace &previous = Trace())
Construct a new Trace object with a possible previous Trace.
- Parameters:
edge – [in]
heur – [in]
previous – [in] represents the previous Trace, this new will extend
-
void addEdge(const Edge &edge, const double &heur)
Appends an Edge as a Connection with the following data.
- Parameters:
edge – [in]
heur – [in]
-
size_t size() const
Returns the size of the Trace, i.e. how long (num midpooints) is the Connection chain. Complexity: O(1).
-
double length() const
Returns the length of the Trace in meters, i.e. how long (meters) is the Connection chain. Complexity: O(1).
-
size_t sizeAheadOfCar() const
Returns the number of midpoints ahead of the car, until end of Trace. Does not take loop closure into account.
-
Trace before(const uint64_t &num = 1) const
Returns a Trace containing the Connection chain of the Connection before. Complexity: O(1).
- Parameters:
num – [in] is the number of elements to iterate back
-
Trace first() const
Returns a Trace containing the first (initial) Connection. Complexity: O(n), being n the number of Connections in the chain.
-
Trace second() const
Returns a Trace containing the second Connection. Complexity: O(n), being n the number of Connections in the chain.
-
const double &heur() const
Returns the last Connection heuristic. Complexity: O(1).
-
double avgTrackWidth() const
Returns the last Connection’s average track width. If empty, returns 0. Complexity: O(1).
-
bool isLoopClosed() const
Returns whether of not the loop is closed from last Connection or before. Complexity: O(1).
-
double sumHeur() const
Returns the sum of heuristics of the Connection chain. If empty, returns infinity. Complexity: O(1).
-
bool containsEdge(const Edge &edge) const
Checks if there is any Connection with Edge edge. Complexity: O(n), being n the number of Connections in the chain.
- Parameters:
edge – [in]
-
bool closesLoopWith(const Edge &e) const
Checks if the Trace closes loop when e is appended.
- Parameters:
e – [in]
-
uint32_t connectionsSinceLoopClosed() const
Returns the number of Connections in the chain since the loop was first closed. Complexity: O(1).
-
void trimByLocal(const Eigen::Vector3d &carPosition)
Trims the Trace so that all Edge(s) coming after the closest to the car are removed. Note: distance to car is known by dist to (0,0).
-
Trace trimLoopClosure() const
Returns the same Trace but trims the ‘extra’ Edges after the loop has been closed.
-
bool intersectsWith(const Edge &e) const
Checks if Edge e creates an intersection (a loop) on the path. O(n), n=this->size().
- Parameters:
e – [in]
-
void clear()
Clears the Connection chain. O(1).
-
void updateLocal(const Eigen::Affine3d &tf) const
Updates the local position of all Edge(s) in the Connection chain.
- Parameters:
tf – [in]
-
bool operator<(const Trace &t) const
Comparison operator used to see if the implicit object is a “better” Trace compared to parameter. The method of choosing the best trace is as follows:
The longest trace wins.
If the size is equal, then the trace with smallest accum heuristic wins.
-
bool operator==(const Trace &t) const
Comparison operator. Two Trace(s) will be equal if both contain the same Edge(s) in the Connection chain. Note that the midpoints (and track limits) positions may not be equal.
- Parameters:
t – [in]
-
bool vitalMidpointsChanged(const Trace &t) const
Checks if the vital_num_midpoints (the n midpoints after car’s position) are equal in both *this and t.
- Parameters:
t – [in]
-
Tracklimits getTracklimits() const
Returns the track limits. First element is left track limit and second is right.
Public Static Functions
-
static void init(const Params::WayComputer::Trace ¶ms)
Method to initialize the Class.
- Parameters:
params – [in]
-
Trace(const Edge &edge, const double &heur, const Trace &previous = Trace())