39 color << 0.0, 0.5, 1.0;
68 "CACHE_SE3_OFFSET", pv);
73EdgeSE3Line3DDrawAction::EdgeSE3Line3DDrawAction()
76 _lineWidth(nullptr) {}
78bool EdgeSE3Line3DDrawAction::refreshPropertyPtrs(
79 HyperGraphElementAction::Parameters* params_) {
83 if (_previousParams) {
85 _typeName +
"::LINE_LENGTH", 4.0f);
87 _typeName +
"::LINE_WIDTH", 2.0f);
95HyperGraphElementAction* EdgeSE3Line3DDrawAction::operator()(
96 HyperGraph::HyperGraphElement* element,
97 HyperGraphElementAction::Parameters* params_) {
98 if (
typeid(*element).name() != _typeName)
return nullptr;
100 refreshPropertyPtrs(params_);
101 if (!_previousParams)
return this;
103 if (_show && !_show->value())
return this;
105 EdgeSE3Line3D* that =
dynamic_cast<EdgeSE3Line3D*
>(element);
107 if (!that)
return this;
109 const VertexSE3* robot =
dynamic_cast<const VertexSE3*
>(that->vertex(0));
110 const VertexLine3D* landmark =
111 dynamic_cast<const VertexLine3D*
>(that->vertex(1));
113 if (!robot || !landmark)
return nullptr;
115 if (_lineLength && _lineWidth) {
116 Line3D line = that->measurement();
119 Vector3 npoint = line.d().cross(line.w());
122 glMultMatrixd(robot->estimate().matrix().cast<
double>().eval().data());
123 glColor3f(
float(that->color(0)),
float(that->color(1)),
124 float(that->color(2)));
125 glLineWidth(
float(_lineWidth->value()));
127 glNormal3f(
float(npoint.x()),
float(npoint.y()),
float(npoint.z()));
128 glVertex3f(
float(npoint.x() - direction.x() * _lineLength->value() / 2),
129 float(npoint.y() - direction.y() * _lineLength->value() / 2),
130 float(npoint.z() - direction.z() * _lineLength->value() / 2));
131 glVertex3f(
float(npoint.x() + direction.x() * _lineLength->value() / 2),
132 float(npoint.y() + direction.y() * _lineLength->value() / 2),
133 float(npoint.z() + direction.z() * _lineLength->value() / 2));
bool writeInformationMatrix(std::ostream &os) const
write the upper trinagular part of the information matrix into the stream
bool readInformationMatrix(std::istream &is)
bool readParamIds(std::istream &is)
reads the param IDs from the stream
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
bool writeParamIds(std::ostream &os) const
write the param IDs that are potentially used by the edge
Measurement _measurement
the measurement of the edge
const EstimateType & estimate() const
return the current estimate of the vertex
virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters *params_)
virtual bool resolveCaches()
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
ParameterSE3Offset * offsetParam
VertexContainer _vertices
G2O_TYPES_SLAM3D_ADDONS_API Vector4 ominus(const Line3D &line)
bool installParameter(ParameterType *&p, size_t argNo, int paramId=-1)
void resizeParameters(size_t newSize)
void resolveCache(CacheType *&cache, OptimizableGraph::Vertex *, const std::string &_type, const ParameterVector ¶meters)
A general case Vertex for optimization.
3D pose Vertex, represented as an Isometry3
bool writeVector(std::ostream &os, const Eigen::DenseBase< Derived > &b)
bool readVector(std::istream &is, Eigen::DenseBase< Derived > &b)
std::vector< Parameter * > ParameterVector
Property< float > FloatProperty