17 #undef _UNICODE // JLBC, for xmlParser 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()) {
214 if (!result.loadFromXMLText( xml_contents ) )
215 std::cerr <<
"[VelodyneCalibration::LoadDefaultCalibration] Error parsing default XML calibration file for model '" << lidar_model <<
"'\n";
Velodyne calibration data, for usage in mrpt::obs::CObservationVelodyneScan.
const char * velodyne_default_calib_HDL32
bool loadFromXMLFile(const std::string &velodyne_calibration_xml_filename)
Loads calibration from file, in the format supplied by the manufacturer.
double verticalOffsetCorrection
bool loadFromXMLText(const std::string &xml_file_contents)
Loads calibration from a string containing an entire XML calibration file.
double DEG2RAD(const double x)
Degrees to radians.
Main Class representing a XML node.
VelodyneCalibration()
Default ctor (leaves all empty)
void clear()
Clear all previous contents.
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?
std::map< std::string, VelodyneCalibration > cache_default_calibs
const Scalar * const_iterator
bool internal_loadFromXMLNode(void *node)
static XMLCSTR getError(XMLError error)
this gives you a user-friendly explanation of the parsing error
XMLCSTR getText(int i=0) const
return ith text field
std::vector< PerLaserCalib > laser_corrections
This namespace contains representation of robot actions and observations.
GLsizei const GLchar ** string
#define ASSERT_ABOVEEQ_(__A, __B)
double sinVertOffsetCorrection
bool empty() const
Returns true if no calibration has been loaded yet.
double distanceCorrection
double verticalCorrection
double horizontalOffsetCorrection
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.
double cosVertOffsetCorrection
const char * velodyne_default_calib_VLP16
static const VelodyneCalibration & LoadDefaultCalibration(const std::string &lidar_model)
Loads default calibration files for common LIDAR models.
Structure used to obtain error details if the parse fails.
XMLNode getChildNode(int i=0) const
return ith child node