58EdgeSE3PlaneSensorCalibDrawAction::EdgeSE3PlaneSensorCalibDrawAction()
61 _planeHeight(nullptr) {}
63bool EdgeSE3PlaneSensorCalibDrawAction::refreshPropertyPtrs(
64 HyperGraphElementAction::Parameters* params_) {
66 if (_previousParams) {
68 _typeName +
"::PLANE_WIDTH", 0.5f);
70 _typeName +
"::PLANE_HEIGHT", 0.5f);
78HyperGraphElementAction* EdgeSE3PlaneSensorCalibDrawAction::operator()(
79 HyperGraph::HyperGraphElement* element,
80 HyperGraphElementAction::Parameters* params_) {
81 if (
typeid(*element).name() != _typeName)
return nullptr;
83 refreshPropertyPtrs(params_);
84 if (!_previousParams)
return this;
86 if (_show && !_show->value())
return this;
88 EdgeSE3PlaneSensorCalib* that =
89 dynamic_cast<EdgeSE3PlaneSensorCalib*
>(element);
91 if (!that)
return this;
93 const VertexSE3* robot =
dynamic_cast<const VertexSE3*
>(that->vertex(0));
94 const VertexSE3* sensor =
dynamic_cast<const VertexSE3*
>(that->vertex(2));
95 if (!robot || !sensor)
return nullptr;
97 if (_planeWidth && _planeHeight) {
98 double d = that->measurement().distance();
102 glColor3f(
float(that->color(0)),
float(that->color(1)),
103 float(that->color(2)));
105 Isometry3 robotAndSensor = robot->estimate() * sensor->estimate();
106 glMultMatrixd(robotAndSensor.matrix().cast<
double>().eval().data());
108 glRotatef(
float(
RAD2DEG(azimuth)), 0.f, 0.f, 1.f);
109 glRotatef(
float(
RAD2DEG(elevation)), 0.f, -1.f, 0.f);
110 glTranslatef(
float(d), 0.f, 0.f);
112 float planeWidth = _planeWidth->value();
113 float planeHeight = _planeHeight->value();
115 glNormal3f(-1, 0, 0);
116 glVertex3f(0, -planeWidth, -planeHeight);
117 glVertex3f(0, planeWidth, -planeHeight);
118 glVertex3f(0, planeWidth, planeHeight);
119 glVertex3f(0, -planeWidth, planeHeight);
bool writeInformationMatrix(std::ostream &os) const
write the upper trinagular part of the information matrix into the stream
bool readInformationMatrix(std::istream &is)
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
base class to represent an edge connecting an arbitrary number of nodes
virtual void resize(size_t size)
virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters *params_)
plane measurement that also calibrates an offset for the sensor
EdgeSE3PlaneSensorCalib()
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
virtual bool write(std::ostream &os) const
write the vertex to a stream
void setMeasurement(const Plane3D &m)
static double elevation(const Vector3 &v)
static double azimuth(const Vector3 &v)
bool writeVector(std::ostream &os, const Eigen::DenseBase< Derived > &b)
bool readVector(std::istream &is, Eigen::DenseBase< Derived > &b)
constexpr double cst(long double v)
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3
Property< float > FloatProperty