Class SLAMAlign

Class Documentation

class SLAMAlign

A class to run SLAM on Scans.

Public Functions

SLAMAlign(const SLAMOptions &options, const std::vector<SLAMScanPtr> &scans, std::vector<bool> new_scans = std::vector<bool>())

Creates a new SLAMAlign instance with the given Options and Scans.

This does not yet register the Scans, it only applies reduction options if specified

Parameters:
  • options – The Options to use

  • scans – The Scans to start with

SLAMAlign(const SLAMOptions &options = SLAMOptions(), std::vector<bool> new_scans = std::vector<bool>())

Creates a new SLAMAlign instance with the given Options.

Parameters:

options – The Options to use

virtual ~SLAMAlign() = default
void addScan(const SLAMScanPtr &scan, bool match = false)

Adds a new Scan to the SLAM instance.

This method will apply any reduction options that are specified

Parameters:
  • scan – The new Scan

  • match – true: Immediately call match() with the new Scan added

void addScan(const ScanPtr &scan, bool match = false)

Adds a new Scan to the SLAM instance.

This method will apply any reduction options that are specified

Parameters:
  • scan – The new Scan

  • match – true: Immediately call match() with the new Scan added

SLAMScanPtr scan(size_t index) const

Returns a shared_ptr to a Scan.

Parameters:

index – The index of the Scan

void match()

Executes SLAM on all current Scans.

This methods registers any new Scans added since the last call to match() (or the creation of this instance) using Scanmatching and Loopclosing, as specified by the SLAMOptions.

Calling this method several times without adding any new Scans has no additional effect after the first call.

void finish()

Indicates that no new Scans will be added.

This method ensures that all Scans are properly registered, including any Loopclosing

void setOptions(const SLAMOptions &options)

Sets the SLAMOptions struct to the parameter.

Note that changing options on an active SLAMAlign instance with previously added / matched Scans can cause Undefined Behaviour.

Parameters:

options – The new options

SLAMOptions &options()

Returns a reference to the internal SLAMOptions struct.

This can be used to make changes to specific values within the SLAMOptions without replacing the entire struct.

Note that changing options on an active SLAMAlign instance with previously added / matched Scans can cause Undefined Behaviour.

const SLAMOptions &options() const

Returns a reference to the internal SLAMOptions struct.

Protected Functions

void reduceScan(const SLAMScanPtr &scan)

Applies all reductions to the Scan.

void applyTransform(SLAMScanPtr scan, const Matrix4d &transform)

Applies the Transformation to the specified Scan and adds a frame to all other Scans.

void checkLoopClose(size_t last)

Checks for and executes any loopcloses that occur.

void loopClose(size_t first, size_t last)

Closes a simple Loop between first and last.

void graphSLAM(size_t last)

Executes GraphSLAM up to and including the specified last Scan.

void checkLoopCloseOtherOrder(size_t last)

checkLoopClose(size_t last) if the m_icp_graph is in a spezial order

same as checkLoopClose(size_t last) but if the m_icp_graph is in a spezial order

Same as checkLoopClose(size_t last) but if the m_icp_graph is in a spezial order.

void createIcpGraph()

Create m_icp_graph which defined the order of registrations.

Create m_icp_graph which defined the order of registrations. The first scan is regarded as registered. Then the scan that is closest to one of the already matched scans is always added. Therefore the scan centers were compared using Euclidean distance.

Protected Attributes

SLAMOptions m_options
std::vector<SLAMScanPtr> m_scans
SLAMScanPtr m_metascan
GraphSLAM m_graph
bool m_foundLoop
int m_loopIndexCount
std::vector<bool> m_new_scans
std::vector<std::pair<int, int>> m_icp_graph