Fawkes API  Fawkes Development Version
TimeOffsetCalibration Class Reference

Calibrate the time offset of a laser. More...

#include "time_offset_calibration.h"

Inheritance diagram for TimeOffsetCalibration:

Public Member Functions

 TimeOffsetCalibration (LaserInterface *laser, fawkes::MotorInterface *motor, fawkes::tf::Transformer *tf_transformer, fawkes::NetworkConfiguration *config, std::string config_path)
 Constructor. More...
 
virtual void calibrate ()
 Calibrate the time offset. More...
 
- Public Member Functions inherited from LaserCalibration
 LaserCalibration (LaserInterface *laser, fawkes::tf::Transformer *tf_transformer, fawkes::NetworkConfiguration *config, std::string config_path)
 Constructor. More...
 
virtual ~LaserCalibration ()
 Destructor. More...
 

Protected Member Functions

PointCloudPtr get_lasercloud (LaserInterface *laser)
 Prepare the laser data for calibration. More...
 
- Protected Member Functions inherited from LaserCalibration
PointCloudPtr laser_to_pointcloud (const LaserInterface &laser)
 Convert the laser data into a pointcloud. More...
 
void transform_pointcloud (const std::string &target_frame, PointCloudPtr cloud)
 Transform the points in a pointcloud. More...
 
PointCloudPtr filter_cloud_in_rear (PointCloudPtr input)
 Remove points in the rear of the robot. More...
 
float get_mean_z (PointCloudPtr cloud)
 Compute the mean z value of all points in the given pointcloud. More...
 
PointCloudPtr filter_left_cloud (PointCloudPtr input)
 Remove all points that are left of the robot. More...
 
PointCloudPtr filter_right_cloud (PointCloudPtr input)
 Remove all points that are right of the robot. More...
 
PointCloudPtr filter_out_ground (PointCloudPtr input)
 Remove all points that belong to the ground. More...
 
float get_matching_cost (PointCloudPtr cloud1, PointCloudPtr cloud2, float *rot_yaw)
 Compare two pointclouds with ICP. More...
 
PointCloudPtr filter_center_cloud (PointCloudPtr input)
 Remove the center of a pointcloud This removes all points around the origin of the pointcloud. More...
 

Protected Attributes

fawkes::MotorInterfacemotor_
 The motor interface used to control the rotation of the robot. More...
 
float step_
 The current step size for the time offset. More...
 
- Protected Attributes inherited from LaserCalibration
LaserInterfacelaser_
 The laser that provides the input data. More...
 
fawkes::tf::Transformertf_transformer_
 The transformer used to compute transforms. More...
 
fawkes::NetworkConfigurationconfig_
 The network config to use for reading and updating config values. More...
 
const std::string config_path_
 The config path to use for reading and updating config values. More...
 

Static Protected Attributes

static const long sleep_time_ = 2000000
 Time in micro seconds to sleep after each iteration. More...
 
constexpr static float omega_ = 2.0
 The angular velocity to use to rotate. More...
 
static const unsigned int frequency_ = 100
 The frequency for motor commands. More...
 
constexpr static float rotation_time_ = 1.
 The time to rotate. More...
 
- Static Protected Attributes inherited from LaserCalibration
static const long sleep_time_ = 50000
 Time in micro seconds to sleep between iterations. More...
 
static const uint max_iterations_ = 100
 The number of iterations to run before aborting the calibration. More...
 
static const size_t min_points = 10
 The number of points required in a pointcloud to use it as input data. More...
 

Detailed Description

Calibrate the time offset of a laser.

This is done as follows:

  1. Move the robot to a place with some recognizable object in the laser, e.g., a corner
  2. Start rotating the robot
  3. Record a reference pointcloud
  4. Stop rotating
  5. Record a second pointcloud
  6. Compare the two pointclouds and update the time offset based on the angle between the two pointclouds.
Author
Till Hofmann

Definition at line 26 of file time_offset_calibration.h.

Constructor & Destructor Documentation

◆ TimeOffsetCalibration()

TimeOffsetCalibration::TimeOffsetCalibration ( LaserInterface laser,
fawkes::MotorInterface motor,
fawkes::tf::Transformer tf_transformer,
fawkes::NetworkConfiguration config,
std::string  config_path 
)

Constructor.

Parameters
laserThe laser to get the data from
motorThe MotorInterface used to control the rotation of the robot
tf_transformerThe transformer to use to compute transforms
configThe network config to read from and write the time offset to
config_pathThe config path to read from and write the time offset to

Definition at line 57 of file time_offset_calibration.cpp.

Member Function Documentation

◆ calibrate()

void TimeOffsetCalibration::calibrate ( )
virtual

Calibrate the time offset.

Continuously execute the calibration procedure until the offset is small enough. To improve convergence rate, in each iteration, jump to the minimum with a certain probability based on the current cost and the minimal cost. The time offset is written to the config in each iteration. At the end, the time offset is always set to the offset with minimal cost.

Implements LaserCalibration.

Definition at line 76 of file time_offset_calibration.cpp.

References LaserCalibration::config_, LaserCalibration::config_path_, frequency_, fawkes::NetworkConfiguration::get_float(), get_lasercloud(), LaserCalibration::get_matching_cost(), LaserCalibration::laser_, motor_, fawkes::Interface::msgq_enqueue(), fawkes::MotorInterface::omega(), omega_, fawkes::Interface::read(), rotation_time_, fawkes::NetworkConfiguration::set_float(), sleep_time_, step_, and fawkes::Exception::what_no_backtrace().

◆ get_lasercloud()

PointCloudPtr TimeOffsetCalibration::get_lasercloud ( LaserInterface laser)
protected

Prepare the laser data for calibration.

Convert the laser data into a pointcloud and filter it so it only contains data that is useful for calibration. In particular, restrict the data in x and y directions to the interval [-3,3], remove any points close to the robot in y direction, and limit the data in z direction to points above the ground and < 1m.

Parameters
laserThe laser interface to read the unfiltered data from
Returns
A filtered pointcloud

Definition at line 161 of file time_offset_calibration.cpp.

References LaserCalibration::laser_to_pointcloud(), fawkes::Interface::read(), and LaserCalibration::transform_pointcloud().

Referenced by calibrate().

Member Data Documentation

◆ frequency_

const unsigned int TimeOffsetCalibration::frequency_ = 100
staticprotected

The frequency for motor commands.

Definition at line 48 of file time_offset_calibration.h.

Referenced by calibrate().

◆ motor_

fawkes::MotorInterface* TimeOffsetCalibration::motor_
protected

The motor interface used to control the rotation of the robot.

Definition at line 44 of file time_offset_calibration.h.

Referenced by calibrate().

◆ omega_

constexpr static float TimeOffsetCalibration::omega_ = 2.0
staticconstexprprotected

The angular velocity to use to rotate.

Definition at line 46 of file time_offset_calibration.h.

Referenced by calibrate().

◆ rotation_time_

constexpr static float TimeOffsetCalibration::rotation_time_ = 1.
staticconstexprprotected

The time to rotate.

Definition at line 50 of file time_offset_calibration.h.

Referenced by calibrate().

◆ sleep_time_

const long TimeOffsetCalibration::sleep_time_ = 2000000
staticprotected

Time in micro seconds to sleep after each iteration.

Definition at line 42 of file time_offset_calibration.h.

Referenced by calibrate().

◆ step_

float TimeOffsetCalibration::step_
protected

The current step size for the time offset.

Definition at line 52 of file time_offset_calibration.h.

Referenced by calibrate().


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