Fawkes API
Fawkes Development Version
|
Calibrate the time offset of a laser. More...
#include "time_offset_calibration.h"
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... | |
![]() | |
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... | |
![]() | |
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::MotorInterface * | motor_ |
The motor interface used to control the rotation of the robot. More... | |
float | step_ |
The current step size for the time offset. More... | |
![]() | |
LaserInterface * | laser_ |
The laser that provides the input data. More... | |
fawkes::tf::Transformer * | tf_transformer_ |
The transformer used to compute transforms. More... | |
fawkes::NetworkConfiguration * | config_ |
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... | |
static constexpr float | omega_ = 2.0 |
The angular velocity to use to rotate. More... | |
static const unsigned int | frequency_ = 100 |
The frequency for motor commands. More... | |
static constexpr float | rotation_time_ = 1. |
The time to rotate. More... | |
![]() | |
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... | |
Calibrate the time offset of a laser.
This is done as follows:
Definition at line 26 of file time_offset_calibration.h.
TimeOffsetCalibration::TimeOffsetCalibration | ( | LaserInterface * | laser, |
fawkes::MotorInterface * | motor, | ||
fawkes::tf::Transformer * | tf_transformer, | ||
fawkes::NetworkConfiguration * | config, | ||
std::string | config_path | ||
) |
Constructor.
laser | The laser to get the data from |
motor | The MotorInterface used to control the rotation of the robot |
tf_transformer | The transformer to use to compute transforms |
config | The network config to read from and write the time offset to |
config_path | The config path to read from and write the time offset to |
Definition at line 57 of file time_offset_calibration.cpp.
|
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().
|
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.
laser | The laser interface to read the unfiltered data from |
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().
|
staticprotected |
The frequency for motor commands.
Definition at line 48 of file time_offset_calibration.h.
Referenced by calibrate().
|
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().
|
staticprotected |
The angular velocity to use to rotate.
Definition at line 46 of file time_offset_calibration.h.
Referenced by calibrate().
|
staticprotected |
The time to rotate.
Definition at line 50 of file time_offset_calibration.h.
Referenced by calibrate().
|
staticprotected |
Time in micro seconds to sleep after each iteration.
Definition at line 42 of file time_offset_calibration.h.
Referenced by calibrate().
|
protected |
The current step size for the time offset.
Definition at line 52 of file time_offset_calibration.h.
Referenced by calibrate().