#include <ThreadLocalize.h>
Public Member Functions | |
void | laserCallBack (const sensor_msgs::LaserScan &scan) |
ThreadLocalize (obvious::TsdGrid *grid, ThreadMapping *mapper, ros::NodeHandle *nh, std::string nameSpace, const double xOffset, const double yOffset) | |
virtual | ~ThreadLocalize () |
Protected Member Functions | |
virtual void | eventLoop (void) |
Private Types | |
enum | EnumRegModes { ICP = 0, EXP } |
Private Member Functions | |
double | calcAngle (obvious::Matrix *T) |
obvious::Matrix | doRegistration (obvious::SensorPolar2D *sensor, obvious::Matrix *M, obvious::Matrix *Mvalid, obvious::Matrix *N, obvious::Matrix *Nvalid, obvious::Matrix *S, obvious::Matrix *Svalid, const bool experimental) |
void | init (const sensor_msgs::LaserScan &scan) |
bool | isPoseChangeSignificant (obvious::Matrix *lastPose, obvious::Matrix *curPose) |
bool | isRegistrationError (obvious::Matrix *T, const double trnsMax, const double rotMax) |
obvious::Matrix | maskMatrix (obvious::Matrix *Mat, bool *mask, unsigned int maskSize, unsigned int validPoints) |
void | reduceResolution (bool *const maskIn, const obvious::Matrix *matIn, bool *const maskOut, obvious::Matrix *matOut, unsigned int pointsIn, unsigned int pointsOut, unsigned int reductionFactor) |
void | sendNanTransform () |
void | sendTransform (obvious::Matrix *T) |
Private Attributes | |
obvious::PairAssignment * | _assigner |
boost::mutex | _dataMutex |
obvious::IRigidEstimator * | _estimator |
obvious::OutOfBoundsFilter2D * | _filterBounds |
obvious::DistanceFilter * | _filterDist |
obvious::ReciprocalFilter * | _filterReciprocal |
const double | _gridHeight |
const double | _gridOffSetX |
const double | _gridOffSetY |
const double | _gridWidth |
obvious::Icp * | _icp |
bool | _initialized |
std::deque < sensor_msgs::LaserScan * > | _laserData |
obvious::Matrix * | _lastPose |
ThreadMapping & | _mapper |
bool * | _maskM |
bool * | _maskS |
double * | _modelCoords |
double * | _modelNormals |
std::string | _nameSpace |
ros::NodeHandle * | _nh |
ros::Publisher | _posePub |
geometry_msgs::PoseStamped | _poseStamped |
double | _ranEpsThresh |
double | _ranPhiMax |
unsigned int | _ranSizeCtrlSet |
unsigned int | _ranTrials |
obvious::RayCastPolar2D * | _rayCaster |
EnumRegModes | _regMode |
double | _rotMax |
double * | _scene |
obvious::SensorPolar2D * | _sensor |
tf::StampedTransform | _tf |
tf::TransformBroadcaster | _tfBroadcaster |
double | _trnsMax |
const double | _xOffset |
const double | _yOffset |
Definition at line 48 of file ThreadLocalize.h.
enum ohm_tsd_slam::ThreadLocalize::EnumRegModes [private] |
Definition at line 50 of file ThreadLocalize.h.
ohm_tsd_slam::ThreadLocalize::ThreadLocalize | ( | obvious::TsdGrid * | grid, |
ThreadMapping * | mapper, | ||
ros::NodeHandle * | nh, | ||
std::string | nameSpace, | ||
const double | xOffset, | ||
const double | yOffset | ||
) |
Constructor
grid | Pointer to representation |
mapper | Pointer to mapping thread instance |
nh | Pointer to main node handle |
nameSpace | Namespace of this localization thread |
xOffFactor | Origin x position |
yOffFactor | Origin y position |
Initialize member modules
Definition at line 29 of file ThreadLocalize.cpp.
ohm_tsd_slam::ThreadLocalize::~ThreadLocalize | ( | ) | [virtual] |
Destructor
Definition at line 120 of file ThreadLocalize.cpp.
double ohm_tsd_slam::ThreadLocalize::calcAngle | ( | obvious::Matrix * | T | ) | [private] |
calAngle Method to analyze a 2D transformation matrix
T | Pointer to transformation matrix |
Definition at line 404 of file ThreadLocalize.cpp.
obvious::Matrix ohm_tsd_slam::ThreadLocalize::doRegistration | ( | obvious::SensorPolar2D * | sensor, |
obvious::Matrix * | M, | ||
obvious::Matrix * | Mvalid, | ||
obvious::Matrix * | N, | ||
obvious::Matrix * | Nvalid, | ||
obvious::Matrix * | S, | ||
obvious::Matrix * | Svalid, | ||
const bool | experimental | ||
) | [private] |
doRegistration Main registration method. Aligns two laser scans and calculates the referring 2D transformation matrix.
sensor | Laser data container |
M | Pointer to model points |
Mvalid | |
N | Pointer to the normals of the model |
Nvalid | |
S | Pointer to scene points |
Svalid | |
experimental | Flag to enable experimental matching |
Definition at line 292 of file ThreadLocalize.cpp.
void ohm_tsd_slam::ThreadLocalize::eventLoop | ( | void | ) | [protected, virtual] |
eventLoop Thread event loop
Create Point Matrixes with structure [x1 y1; x2 y2; ..] M, N, and S are matrices that preserve the ray model of a laser scanner Xvalid matrices are matrices that do not preserve the ray model but contain only valid points
Align Laser scans
analyze registration result
Update MAP if necessary
Implements ohm_tsd_slam::ThreadSLAM.
Definition at line 147 of file ThreadLocalize.cpp.
void ohm_tsd_slam::ThreadLocalize::init | ( | const sensor_msgs::LaserScan & | scan | ) | [private] |
init Init function automatically called by firs received laser data
scan | Initial scan used to initialize parameters of the thread |
Definition at line 245 of file ThreadLocalize.cpp.
bool ohm_tsd_slam::ThreadLocalize::isPoseChangeSignificant | ( | obvious::Matrix * | lastPose, |
obvious::Matrix * | curPose | ||
) | [private] |
isPoseChangeSignificant Method to determine whether the localized sensor has been moved significantly (value above thresh). A map change is only initiated in case this method returns true.
lastPose | Pointer to last known pose |
curPose | Pointer to current pose |
Definition at line 417 of file ThreadLocalize.cpp.
bool ohm_tsd_slam::ThreadLocalize::isRegistrationError | ( | obvious::Matrix * | T, |
const double | trnsMax, | ||
const double | rotMax | ||
) | [private] |
isRegistrationError Method to prevent registration errors by comparing the computed transformation to thresholds.
T | Current 2D transformation |
trnsMax | Translation thresh |
rotMax | Rotation thresh |
Definition at line 350 of file ThreadLocalize.cpp.
void ohm_tsd_slam::ThreadLocalize::laserCallBack | ( | const sensor_msgs::LaserScan & | scan | ) |
laserCallBack Callback method for laser scan message
scan | Laser data |
Definition at line 130 of file ThreadLocalize.cpp.
obvious::Matrix ohm_tsd_slam::ThreadLocalize::maskMatrix | ( | obvious::Matrix * | Mat, |
bool * | mask, | ||
unsigned int | maskSize, | ||
unsigned int | validPoints | ||
) | [private] |
maskMatrix Method to remove certain values in a matrix using a given mask.
Mat | Input data |
mask | Value mask |
maskSize | Amount of values in the mask |
validPoints | Value determining the number of values in the output matrix |
Definition at line 427 of file ThreadLocalize.cpp.
void ohm_tsd_slam::ThreadLocalize::reduceResolution | ( | bool *const | maskIn, |
const obvious::Matrix * | matIn, | ||
bool *const | maskOut, | ||
obvious::Matrix * | matOut, | ||
unsigned int | pointsIn, | ||
unsigned int | pointsOut, | ||
unsigned int | reductionFactor | ||
) | [private] |
reduceResolution Method to reduce the values in a matrix with a given factor.
maskIn | Input mask |
matIn | Input data |
maskOut | Output mask |
matOut | Filtered data |
pointsIn | Amount of points in un filtered data |
pointsOut | Amount of points in filtered data |
reductionFactor | Reduction factor |
Definition at line 446 of file ThreadLocalize.cpp.
void ohm_tsd_slam::ThreadLocalize::sendNanTransform | ( | ) | [private] |
sendNanTransform Method sending an irregular pose and tf (consisting only of NAN values), broadcasting a detected registration error.
Definition at line 383 of file ThreadLocalize.cpp.
void ohm_tsd_slam::ThreadLocalize::sendTransform | ( | obvious::Matrix * | T | ) | [private] |
sendTransform Method to broadcast the gained transformation via ros::geometry_msgs::PoseStamped and ros::tf.
T | Broadcasted transformation |
Definition at line 359 of file ThreadLocalize.cpp.
obvious::PairAssignment* ohm_tsd_slam::ThreadLocalize::_assigner [private] |
ICP pair assigner
Definition at line 327 of file ThreadLocalize.h.
boost::mutex ohm_tsd_slam::ThreadLocalize::_dataMutex [private] |
Mutex to synchronize main thread (subscriber) and thread event loop toDO: either this or the flas are obsolete
Definition at line 219 of file ThreadLocalize.h.
obvious::IRigidEstimator* ohm_tsd_slam::ThreadLocalize::_estimator [private] |
ICP transformation estimator
Definition at line 347 of file ThreadLocalize.h.
obvious::OutOfBoundsFilter2D* ohm_tsd_slam::ThreadLocalize::_filterBounds [private] |
ICP out of bounds filter
Definition at line 332 of file ThreadLocalize.h.
obvious::DistanceFilter* ohm_tsd_slam::ThreadLocalize::_filterDist [private] |
ICP distance filter
Definition at line 337 of file ThreadLocalize.h.
obvious::ReciprocalFilter* ohm_tsd_slam::ThreadLocalize::_filterReciprocal [private] |
ICP reciprogal filter
Definition at line 342 of file ThreadLocalize.h.
const double ohm_tsd_slam::ThreadLocalize::_gridHeight [private] |
Height of tsd grid in m
Definition at line 214 of file ThreadLocalize.h.
const double ohm_tsd_slam::ThreadLocalize::_gridOffSetX [private] |
Grid origin x offset
Definition at line 224 of file ThreadLocalize.h.
const double ohm_tsd_slam::ThreadLocalize::_gridOffSetY [private] |
Grid origin y offset
Definition at line 229 of file ThreadLocalize.h.
const double ohm_tsd_slam::ThreadLocalize::_gridWidth [private] |
Width of tsd grid in m
Definition at line 209 of file ThreadLocalize.h.
obvious::Icp* ohm_tsd_slam::ThreadLocalize::_icp [private] |
ICP main icp instance
Definition at line 352 of file ThreadLocalize.h.
bool ohm_tsd_slam::ThreadLocalize::_initialized [private] |
Flag signifying successful initialization of this thread
Definition at line 204 of file ThreadLocalize.h.
std::deque<sensor_msgs::LaserScan*> ohm_tsd_slam::ThreadLocalize::_laserData [private] |
Container for laser sensor data (filled by callback)
Definition at line 292 of file ThreadLocalize.h.
obvious::Matrix* ohm_tsd_slam::ThreadLocalize::_lastPose [private] |
Last pose
Definition at line 357 of file ThreadLocalize.h.
Pointer to mapping thread
Definition at line 194 of file ThreadLocalize.h.
bool* ohm_tsd_slam::ThreadLocalize::_maskM [private] |
Mask of model
Definition at line 307 of file ThreadLocalize.h.
bool* ohm_tsd_slam::ThreadLocalize::_maskS [private] |
Mask of scene
Definition at line 317 of file ThreadLocalize.h.
double* ohm_tsd_slam::ThreadLocalize::_modelCoords [private] |
Buffer for model coordinates
Definition at line 297 of file ThreadLocalize.h.
double* ohm_tsd_slam::ThreadLocalize::_modelNormals [private] |
Buffer for model normals
Definition at line 302 of file ThreadLocalize.h.
std::string ohm_tsd_slam::ThreadLocalize::_nameSpace [private] |
namespace for all topics and services
Definition at line 287 of file ThreadLocalize.h.
ros::NodeHandle* ohm_tsd_slam::ThreadLocalize::_nh [private] |
Pointer to main NodeHandle
Definition at line 189 of file ThreadLocalize.h.
Ros pose publisher
Definition at line 362 of file ThreadLocalize.h.
geometry_msgs::PoseStamped ohm_tsd_slam::ThreadLocalize::_poseStamped [private] |
Ros current pose
Definition at line 367 of file ThreadLocalize.h.
double ohm_tsd_slam::ThreadLocalize::_ranEpsThresh [private] |
Threshold for experimental registration algorithm
Definition at line 272 of file ThreadLocalize.h.
double ohm_tsd_slam::ThreadLocalize::_ranPhiMax [private] |
Angle threshold for experimental registration algorithm
Definition at line 282 of file ThreadLocalize.h.
unsigned int ohm_tsd_slam::ThreadLocalize::_ranSizeCtrlSet [private] |
Control size set for experimental registration algorithm
Definition at line 277 of file ThreadLocalize.h.
unsigned int ohm_tsd_slam::ThreadLocalize::_ranTrials [private] |
Iterations for experimental registration alorithm
Definition at line 267 of file ThreadLocalize.h.
obvious::RayCastPolar2D* ohm_tsd_slam::ThreadLocalize::_rayCaster [private] |
reconstruction
Definition at line 322 of file ThreadLocalize.h.
Registration mode
Definition at line 254 of file ThreadLocalize.h.
double ohm_tsd_slam::ThreadLocalize::_rotMax [private] |
ICP rotation threshold
Definition at line 239 of file ThreadLocalize.h.
double* ohm_tsd_slam::ThreadLocalize::_scene [private] |
Buffer for scene coordinates
Definition at line 312 of file ThreadLocalize.h.
obvious::SensorPolar2D* ohm_tsd_slam::ThreadLocalize::_sensor [private] |
Sensor container for handeling the current laser input and pose
Definition at line 199 of file ThreadLocalize.h.
Ros current transform
Definition at line 377 of file ThreadLocalize.h.
Ros tf interface
Definition at line 372 of file ThreadLocalize.h.
double ohm_tsd_slam::ThreadLocalize::_trnsMax [private] |
ICP translation threshold
Definition at line 234 of file ThreadLocalize.h.
const double ohm_tsd_slam::ThreadLocalize::_xOffset [private] |
Starting x offset
Definition at line 244 of file ThreadLocalize.h.
const double ohm_tsd_slam::ThreadLocalize::_yOffset [private] |
Starting y offset
Definition at line 249 of file ThreadLocalize.h.