29 VelodyneCalibration::PerLaserCalib::PerLaserCalib() :
30 azimuthCorrection (.0),
31 verticalCorrection (.0),
32 distanceCorrection (.0),
33 verticalOffsetCorrection (.0),
34 horizontalOffsetCorrection (.0),
35 sinVertCorrection (.0),
36 cosVertCorrection (1.0),
37 sinVertOffsetCorrection (.0),
38 cosVertOffsetCorrection (1.0)
52 if (node_bs.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'boost_serialization'");
55 if (node_DB.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'DB'");
58 if (node_enabled_.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'enabled_'");
64 if (node_enabled_count.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'enabled_::count'");
65 const int nEnabled = atoi( node_enabled_count.
getText() );
66 if (nEnabled<=0 || nEnabled>10000)
67 throw std::runtime_error(
"Senseless value found reading 'enabled_::count'");
70 for (
int i=0;i<nEnabled;i++)
73 if (node_enabled_ith.
isEmpty())
throw std::runtime_error(
"Cannot find the expected number of XML nodes: 'enabled_::item'");
74 const int enable_val = atoi( node_enabled_ith.
getText() );
83 if (node_points_.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_'");
88 if (node_points_item.
isEmpty())
break;
91 if (node_px.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px'");
94 if (node_px_id.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px::id_'");
95 const int id = atoi( node_px_id.
getText() );
104 if (node.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px::rotCorrection_'");
109 if (node.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px::vertCorrection_'");
114 if (node.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px::distCorrection_'");
119 if (node.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px::vertOffsetCorrection_'");
124 if (node.
isEmpty())
throw std::runtime_error(
"Cannot find XML node: 'points_::item::px::horizOffsetCorrection_'");
146 cerr <<
"[VelodyneCalibration::loadFromXMLText] Error parsing XML content: " <<
155 cerr <<
"[VelodyneCalibration::loadFromXMLFile] Exception:" << endl << e.what() << endl;
170 cerr <<
"[VelodyneCalibration::loadFromXMLFile] Error loading XML file: " <<
178 cerr <<
"[VelodyneCalibration::loadFromXMLFile] Exception:" << endl << e.what() << endl;
205 if (lidar_model==
"VLP16")
207 else if (lidar_model==
"HDL32")
213 if (!xml_contents.empty()) {
215 std::cerr <<
"[VelodyneCalibration::LoadDefaultCalibration] Error parsing default XML calibration file for model '" << lidar_model <<
"'\n";
std::map< std::string, VelodyneCalibration > cache_default_calibs
const Scalar * const_iterator
GLsizei const GLchar ** string
static XMLCSTR getError(XMLError error)
this gives you a user-friendly explanation of the parsing error
static XMLNode parseFile(XMLCSTR filename, XMLCSTR tag=NULL, XMLResults *pResults=NULL)
Parse an XML file and return the root of a XMLNode tree representing the file.
static XMLNode parseString(XMLCSTR lpXMLString, XMLCSTR tag=NULL, XMLResults *pResults=NULL)
Parse an XML string and return the root of a XMLNode tree representing the string.
char isEmpty() const
is this node Empty?
XMLNode getChildNode(int i=0) const
return ith child node
XMLCSTR getText(int i=0) const
return ith text field
#define ASSERT_ABOVEEQ_(__A, __B)
This namespace contains representation of robot actions and observations.
double DEG2RAD(const double x)
Degrees to radians.
Main Class representing a XML node.
Structure used to obtain error details if the parse fails.
double verticalOffsetCorrection
double sinVertOffsetCorrection
double cosVertOffsetCorrection
double horizontalOffsetCorrection
double verticalCorrection
double distanceCorrection
Velodyne calibration data, for usage in mrpt::obs::CObservationVelodyneScan.
bool empty() const
Returns true if no calibration has been loaded yet.
static const VelodyneCalibration & LoadDefaultCalibration(const std::string &lidar_model)
Loads default calibration files for common LIDAR models.
bool loadFromXMLText(const std::string &xml_file_contents)
Loads calibration from a string containing an entire XML calibration file.
void clear()
Clear all previous contents.
std::vector< PerLaserCalib > laser_corrections
bool internal_loadFromXMLNode(void *node)
bool loadFromXMLFile(const std::string &velodyne_calibration_xml_filename)
Loads calibration from file, in the format supplied by the manufacturer.
VelodyneCalibration()
Default ctor (leaves all empty)
const char * velodyne_default_calib_HDL32
const char * velodyne_default_calib_VLP16