xvsdk  3.2.0
Public Types | Public Member Functions | List of all members
xv::Slam Class Referenceabstract

The class to represent the component doing the 6dof tracking with SLAM algorithm on host. More...

#include <xv-sdk.h>

Public Types

enum  Mode { Edge = 0, Mixed, EdgeFusionOnHost }
 
using Data = Pose const &
 

Public Member Functions

virtual Mode mode () const =0
 Get #Mode. More...
 
virtual bool start () override=0
 Start slam of current mode.
 
virtual bool start (Mode mode)=0
 Start slam of specific mode. More...
 
virtual bool reset ()=0
 Reset the 6dof tracker (SLAM) More...
 
virtual bool getPose (Pose &pose, double prediction=0.)=0
 Get the current 6dof pose of the device. More...
 
virtual bool getPoseAt (Pose &pose, double timestamp)=0
 Get the 6dof pose of the device at a given timestamp. More...
 
virtual int registerVisualPoseCallback (std::function< void(const Pose &)> lostCallback)=0
 Register a callback called when visual SLAM compute a new unfiltered pose. More...
 
virtual bool unregisterVisualPoseCallback (int callbackId)=0
 
virtual int registerLostCallback (std::function< void()> lostCallback)=0
 Register a callback called when SLAM is lost. More...
 
virtual bool unregisterLostCallback (int callbackId)=0
 
virtual int registerStereoPlanesCallback (std::function< void(std::shared_ptr< const std::vector< Plane >>)> planeCallback)=0
 Callback to get the detected planes using stereo cameras and SLAM. More...
 
virtual bool unregisterStereoPlanesCallback (int callbackId)=0
 
virtual bool clearStereoPlanes ()=0
 
virtual int registerTofPlanesCallback (std::function< void(std::shared_ptr< const std::vector< Plane >>)> planeCallback)=0
 Callback to get the detected planes using ToF camera and SLAM. More...
 
virtual bool unregisterTofPlanesCallback (int callbackId)=0
 
virtual bool clearTofPlanes ()=0
 
virtual int registerMapCallback (std::function< void(std::shared_ptr< const xv::SlamMap >)> mapCallback)=0
 Callback to get the SLAM map updates. More...
 
virtual bool unregisterMapCallback (int callbackId)=0
 
virtual bool loadMapAndSwitchToCslam (std::streambuf &mapStream, std::function< void(int)> done_callback, std::function< void(float)> localized_on_reference_map={})=0
 Load a SLAM map and use it as an immutable reference map. More...
 
virtual bool saveMapAndSwitchToCslam (std::streambuf &mapStream, std::function< void(int, int)> done_callback, std::function< void(float)> localized_on_reference_map={})=0
 Save a SLAM map and use it as an immutable reference map. More...
 
virtual bool stop ()=0
 stop streaming.
 
virtual int registerCallback (std::function< void(Pose const &)>)=0
 Register callback to receive data.
 
virtual bool unregisterCallback (int callbackId)=0
 Unregister callback.
 

Detailed Description

The class to represent the component doing the 6dof tracking with SLAM algorithm on host.

For Mixed mode, callback will get the last computed SLAM pose. Callback is call on each IMU recieved because SLAM pose also use IMU for update.

Member Function Documentation

virtual bool xv::Slam::getPose ( Pose pose,
double  prediction = 0. 
)
pure virtual

Get the current 6dof pose of the device.

The 6dof pose is the rotation and translation of the IMU frame coordinates based on the world frame coordinates. The world frame coordinates coorespond to the VLSAM map and the device coordinates is based on the IMU coordinates.

Parameters
[out]posecorresponding to the timestamp "now" + "prediction"
[in]prediction(in s) amount of prediction to use to get a pose corresponding to the future
Returns
true if ok, false else.
virtual bool xv::Slam::getPoseAt ( Pose pose,
double  timestamp 
)
pure virtual

Get the 6dof pose of the device at a given timestamp.

The 6dof pose is the rotation and translation of the IMU frame coordinates based on the world frame coordinates. The world frame coordinates coorespond to the VLSAM map and the device coordinates is based on the IMU coordinates.

Parameters
[out]poseresult pose corresponding to the timestamp, need to be not too in the pass or too in the future
[in]timestampof the wanted pose, in s based on the host clock std::chrono::steady_clock()
Returns
true if the pose can be returned, false else. If timestamp is too in the past or too in the future, return false.
virtual bool xv::Slam::loadMapAndSwitchToCslam ( std::streambuf &  mapStream,
std::function< void(int)>  done_callback,
std::function< void(float)>  localized_on_reference_map = {} 
)
pure virtual

Load a SLAM map and use it as an immutable reference map.

Parameters
mapStreamthe input map stream for loading the map
done_callbackWhen the switch is done the callback will be called. The input of the callback is the quality result (0-100) of the reference map.
localized_on_reference_mapCall the callback if the SLAM uses a reference map and is localized on the reference map. The input parameter is the threshold for the percentage [0.f,1.f] of reference map usage according to whole map (reference map and dynamic map). If SLAM is not currently using enough the reference map and the usage is below this threshold, then the callback is called with the current percentage [0.f,1.f] of 3D points from the reference map.
virtual Mode xv::Slam::mode ( ) const
pure virtual

Get #Mode.

Returns
return slam mode of this object, mode is const.
virtual int xv::Slam::registerLostCallback ( std::function< void()>  lostCallback)
pure virtual

Register a callback called when SLAM is lost.

Returns
Id of the callback (used to unregister the callback).
virtual int xv::Slam::registerMapCallback ( std::function< void(std::shared_ptr< const xv::SlamMap >)>  mapCallback)
pure virtual

Callback to get the SLAM map updates.

Returns
Id of the callback (used to unregister the callback).
virtual int xv::Slam::registerStereoPlanesCallback ( )
pure virtual

Callback to get the detected planes using stereo cameras and SLAM.

The vector contains planes with current planes and each plane has an ID. Between mutiple calls new planes can be added, previous planes updated or merged. If a plane disappear from the vector, it means it was merged with other.

Returns
Id of the callback (used to unregister the callback).
virtual int xv::Slam::registerTofPlanesCallback ( )
pure virtual

Callback to get the detected planes using ToF camera and SLAM.

The vector contains planes with current planes and with plane ID as key. Between mutiple calls new planes can be added, previous planes updated or merged. If a plane disappear from the vector, it means it was merged with other.

Returns
Id of the callback (used to unregister the callback).
virtual int xv::Slam::registerVisualPoseCallback ( std::function< void(const Pose &)>  lostCallback)
pure virtual

Register a callback called when visual SLAM compute a new unfiltered pose.

Returns
Id of the callback (used to unregister the callback).
virtual bool xv::Slam::reset ( )
pure virtual

Reset the 6dof tracker (SLAM)

Returns
return true if well reset, else if something went wrong.
virtual bool xv::Slam::saveMapAndSwitchToCslam ( std::streambuf &  mapStream,
std::function< void(int, int)>  done_callback,
std::function< void(float)>  localized_on_reference_map = {} 
)
pure virtual

Save a SLAM map and use it as an immutable reference map.

Parameters
mapStreamthe output map stream to for writing the map
done_callbackWhen the switch is done the callback will be called. The input of the callback is the quality result (0-100) of the reference map.
localized_on_reference_mapCall the callback if the SLAM uses a reference map and is localized on the reference map. The input parameter is the threshold for the percentage [0.f,1.f] of reference map usage according to whole map (reference map and dynamic map). If SLAM is not currently using enough the reference map and the usage is below this threshold, then the callback is called with the current percentage [0.f,1.f] of 3D points from the reference map.
virtual bool xv::Slam::start ( Mode  mode)
pure virtual

Start slam of specific mode.

Stop old mode slam(if running), switch to new mode, and then start slam of new mode.


The documentation for this class was generated from the following file: