Class SLAMScanWrapper

Inheritance Relationships

Derived Type

Class Documentation

class SLAMScanWrapper

A Wrapper around Scan to allow for SLAM usage.

Subclassed by lvr2::Metascan

Public Functions

SLAMScanWrapper(ScanPtr scan)

Construct a new SLAMScanWrapper object as a Wrapper around the Scan.

Parameters:

scan – The Scan to wrap around

virtual ~SLAMScanWrapper() = default
ScanPtr innerScan()

Access to the Scan that this instance is wrapped around.

Returns:

ScanPtr The Scan

virtual void transform(const Transformd &transform, bool writeFrame = true, FrameUse use = FrameUse::UPDATED)

Applies a relative Transformation to the Scan.

Parameters:
  • transform – The Transformation

  • writeFrame – weather or not to add a new animation Frame

  • use – The FrameUse if writeFrame is set to true

void addFrame(FrameUse use = FrameUse::UNUSED)

Adds a new animation Frame with the current Pose.

Parameters:

use – The use of the Frame for coloring purposes

void reduce(double voxelSize, int maxLeafSize)

Reduces the Scan using Octree Reduction.

Does not change the amount of allocated Memory unless trim() is called

Parameters:
  • voxelSize

  • maxLeafSize

void setMinDistance(double minDistance)

Reduces the Scan by removing all Points closer than minDistance to the origin.

Does not change the amount of allocated Memory unless trim() is called

Parameters:

minDistance – The minimum Distance for a Point to have

void setMaxDistance(double maxDistance)

Reduces the Scan by removing all Points farther away than maxDistance to the origin.

Does not change the amount of allocated Memory unless trim() is called

Parameters:

maxDistance – The maximum Distance for a Point to have

void trim()

Reduces Memory usage by getting rid of Points removed with reduction Methods.

virtual Vector3d point(size_t index) const

Returns the Point at the specified index in global Coordinates.

Parameters:

index – the Index

Returns:

Vector3d the Point in global Coordinates

const Vector3f &rawPoint(size_t index) const

Returns the Point at the specified index in local Coordinates.

Parameters:

index – the Index

Returns:

Vector3d the Point in local Coordinates

size_t numPoints() const

Returns the number of Points in the Scan.

Returns:

size_t the number of Points

const Transformd &pose() const

Returns the current Pose of the Scan.

Returns:

const Transformd& the Pose

const Transformd &deltaPose() const

Returns the difference between pose() and initialPose()

Returns:

const Transformd& the delta Pose

const Transformd &initialPose() const

Returns the initial Pose of the Scan.

Returns:

const Transformd& the initial Pose

Vector3d getPosition() const

Get the Position of the Scan. Can also be obtained from pose()

Returns:

Vector3d the Position

size_t frameCount() const

Returns the number of Frames generated.

Returns:

size_t the number of Frames

const std::pair<Transformd, FrameUse> &frame(size_t index) const

Returns a Frame consisting of a Pose and a FrameUse.

Parameters:

index – the index of the Frame

Returns:

const std::pair<Transformd, FrameUse>& the Pose and FrameUse

void writeFrames(std::string path) const

Writes the Frames to the specified location.

Parameters:

path – The path of the file to write to

KDTreePtr<Vector3f> createKDTree(size_t maxLeafSize = 20) const

Public Static Functions

static size_t nearestNeighbors(KDTreePtr<Vector3f> tree, std::shared_ptr<SLAMScanWrapper> scan, std::vector<Vector3f*> &neighbors, double maxDistance, Vector3d &centroid_m, Vector3d &centroid_d)

Finds the nearest neighbors of all points in a Scan using a pre-generated KDTree.

Parameters:
  • tree – The KDTree to search in

  • scan – The Scan to search for

  • neighbors – An array to store the results in. neighbors[i] is set to a Pointer to the neighbor of points[i] or nullptr if none was found

  • maxDistance – The maximum Distance for a Neighbor

  • centroid_m – Will be set to the average of all Points in ‘neighbors’

  • centroid_d – Will be set to the average of all Points in ‘points’ that have neighbors

Returns:

size_t The number of neighbors that were found

static size_t nearestNeighbors(KDTreePtr<Vector3f> tree, std::shared_ptr<SLAMScanWrapper> scan, std::vector<Vector3f*> &neighbors, double maxDistance)

Finds the nearest neighbors of all points in a Scan using a pre-generated KDTree.

Parameters:
  • tree – The KDTree to search in

  • scan – The Scan to search for

  • neighbors – An array to store the results in. neighbors[i] is set to a Pointer to the neighbor of points[i] or nullptr if none was found

  • maxDistance – The maximum Distance for a Neighbor

Returns:

size_t The number of neighbors that were found

Protected Attributes

ScanPtr m_scan
std::vector<Vector3f> m_points
size_t m_numPoints
Transformd m_deltaPose
std::vector<std::pair<Transformd, FrameUse>> m_frames