// g2o - General Graph Optimization
// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, H. Strasdat, W. Burgard
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "optimizable_graph.h"
#include <cassert>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <Eigen/Dense>
#include "estimate_propagator.h"
#include "factory.h"
#include "optimization_algorithm_property.h"
#include "hyper_graph_action.h"
#include "cache.h"
#include "robust_kernel.h"
#include "../stuff/macros.h"
#include "../stuff/color_macros.h"
#include "../stuff/string_tools.h"
#include "../stuff/misc.h"
namespace g2o {
using namespace std;
OptimizableGraph::Data::Data(){
_next = 0;
}
OptimizableGraph::Data::~Data(){
if (_next)
delete _next;
}
OptimizableGraph::Vertex::Vertex() :
HyperGraph::Vertex(),
_graph(0), _userData(0), _hessianIndex(-1), _fixed(false), _marginalized(false),
_colInHessian(-1), _cacheContainer(0)
{
}
CacheContainer* OptimizableGraph::Vertex::cacheContainer(){
if (! _cacheContainer)
_cacheContainer = new CacheContainer(this);
return _cacheContainer;
}
void OptimizableGraph::Vertex::updateCache(){
if (_cacheContainer){
_cacheContainer->setUpdateNeeded();
_cacheContainer->update();
}
}
OptimizableGraph::Vertex::~Vertex()
{
if (_cacheContainer)
delete (_cacheContainer);
if (_userData)
delete _userData;
}
OptimizableGraph::Vertex* OptimizableGraph::Vertex::clone() const
{
return 0;
}
bool OptimizableGraph::Vertex::setEstimateData(const double* v)
{
bool ret = setEstimateDataImpl(v);
updateCache();
return ret;
}
bool OptimizableGraph::Vertex::getEstimateData(double *) const
{
return false;
}
int OptimizableGraph::Vertex::estimateDimension() const
{
return -1;
}
bool OptimizableGraph::Vertex::setMinimalEstimateData(const double* v)
{
bool ret = setMinimalEstimateDataImpl(v);
updateCache();
return ret;
}
bool OptimizableGraph::Vertex::getMinimalEstimateData(double *) const
{
return false;
}
int OptimizableGraph::Vertex::minimalEstimateDimension() const
{
return -1;
}
OptimizableGraph::Edge::Edge() :
HyperGraph::Edge(),
_dimension(-1), _level(0), _robustKernel(0)
{
}
OptimizableGraph::Edge::~Edge()
{
delete _robustKernel;
}
OptimizableGraph* OptimizableGraph::Edge::graph(){
if (! _vertices.size())
return 0;
OptimizableGraph::Vertex* v=(OptimizableGraph::Vertex*)_vertices[0];
if (!v)
return 0;
return v->graph();
}
const OptimizableGraph* OptimizableGraph::Edge::graph() const{
if (! _vertices.size())
return 0;
const OptimizableGraph::Vertex* v=(const OptimizableGraph::Vertex*) _vertices[0];
if (!v)
return 0;
return v->graph();
}
bool OptimizableGraph::Edge::setParameterId(int argNum, int paramId){
if ((int)_parameters.size()<=argNum)
return false;
if (argNum<0)
return false;
*_parameters[argNum] = 0;
_parameterIds[argNum] = paramId;
return true;
}
bool OptimizableGraph::Edge::resolveParameters() {
if (!graph()) {
cerr << __PRETTY_FUNCTION__ << ": edge not registered with a graph" << endl;
return false;
}
assert (_parameters.size() == _parameterIds.size());
//cerr << __PRETTY_FUNCTION__ << ": encountered " << _parameters.size() << " parameters" << endl;
for (size_t i=0; i<_parameters.size(); i++){
int index = _parameterIds[i];
*_parameters[i] = graph()->parameter(index);
if (typeid(**_parameters[i]).name()!=_parameterTypes[i]){
cerr << __PRETTY_FUNCTION__ << ": FATAL, parameter type mismatch - encountered " << typeid(**_parameters[i]).name() << "; should be " << _parameterTypes[i] << endl;
}
if (!*_parameters[i]) {
cerr << __PRETTY_FUNCTION__ << ": FATAL, *_parameters[i] == 0" << endl;
return false;
}
}
return true;
}
void OptimizableGraph::Edge::setRobustKernel(RobustKernel* ptr)
{
if (_robustKernel)
delete _robustKernel;
_robustKernel = ptr;
}
bool OptimizableGraph::Edge::resolveCaches() {
return true;
}
bool OptimizableGraph::Edge::setMeasurementData(const double *)
{
return false;
}
bool OptimizableGraph::Edge::getMeasurementData(double *) const
{
return false;
}
int OptimizableGraph::Edge::measurementDimension() const
{
return -1;
}
bool OptimizableGraph::Edge::setMeasurementFromState(){
return false;
}
OptimizableGraph::Edge* OptimizableGraph::Edge::clone() const
{
// TODO
return 0;
}
OptimizableGraph::OptimizableGraph()
{
_nextEdgeId = 0; _edge_has_id = false;
_graphActions.resize(AT_NUM_ELEMENTS);
}
OptimizableGraph::~OptimizableGraph()
{
clear();
clearParameters();
}
bool OptimizableGraph::addVertex(HyperGraph::Vertex* v, Data* userData)
{
Vertex* inserted = vertex(v->id());
if (inserted) {
cerr << __FUNCTION__ << ": FATAL, a vertex with ID " << v->id() << " has already been registered with this graph" << endl;
assert(0 && "Vertex with this ID already contained in the graph");
return false;
}
OptimizableGraph::Vertex* ov=dynamic_cast<OptimizableGraph::Vertex*>(v);
assert(ov && "Vertex does not inherit from OptimizableGraph::Vertex");
if (ov->_graph != 0 && ov->_graph != this) {
cerr << __FUNCTION__ << ": FATAL, vertex with ID " << v->id() << " has already registered with another graph " << ov->_graph << endl;
assert(0 && "Vertex already registered with another graph");
return false;
}
if (userData)
ov->setUserData(userData);
ov->_graph=this;
return HyperGraph::addVertex(v);
}
bool OptimizableGraph::addEdge(HyperGraph::Edge* e_)
{
OptimizableGraph::Edge* e = dynamic_cast<OptimizableGraph::Edge*>(e_);
assert(e && "Edge does not inherit from OptimizableGraph::Edge");
if (! e)
return false;
bool eresult = HyperGraph::addEdge(e);
if (! eresult)
return false;
e->_internalId = _nextEdgeId++;
if (! e->resolveParameters()){
cerr << __FUNCTION__ << ": FATAL, cannot resolve parameters for edge " << e << endl;
return false;
}
if (! e->resolveCaches()){
cerr << __FUNCTION__ << ": FATAL, cannot resolve caches for edge " << e << endl;
return false;
}
_jacobianWorkspace.updateSize(e);
return true;
}
int OptimizableGraph::optimize(int /*iterations*/, bool /*online*/) {return 0;}
double OptimizableGraph::chi2() const
{
double chi = 0.0;
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Examples里面存放的分别是基于单目、双目、RGBD的实例程序 include文件夹存放的是头文件,ORB-SLAM2可以被当作一个库来使用,很多函数都可以直接调用 src文件夹存放的是和include对应的源文件 Thirdparty存放的是用到的第三方库 Vocabulary存放的是回环检测中BoW用到的视觉词典 build.sh,只要配置好了本地环境,运行一下build.sh就行了
资源推荐
资源详情
资源评论
收起资源包目录
ORBSLAM2017工程 (887个子文件)
AdolcForward 4KB
AlignedVector3 5KB
ArpackSupport 905B
Array 304B
AutoDiff 1KB
BVH 5KB
os_specific.c 2KB
ORBmatcher.cc 48KB
Tracking.cc 47KB
ORBextractor.cc 43KB
Optimizer.cc 40KB
PnPsolver.cc 28KB
Initializer.cc 25KB
LoopClosing.cc 25KB
LocalMapping.cc 23KB
Frame.cc 20KB
KeyFrame.cc 18KB
System.cc 15KB
Sim3Solver.cc 11KB
MapPoint.cc 11KB
KeyFrameDatabase.cc 10KB
MapDrawer.cc 7KB
Viewer.cc 6KB
FrameDrawer.cc 6KB
Converter.cc 4KB
Map.cc 3KB
Cholesky 775B
CholmodSupport 2KB
Core 13KB
optimizable_graph.cpp 27KB
sparse_optimizer.cpp 20KB
types_six_dof_expmap.cpp 10KB
estimate_propagator.cpp 10KB
hyper_dijkstra.cpp 9KB
hyper_graph_action.cpp 9KB
optimization_algorithm_dogleg.cpp 8KB
marginal_covariance_cholesky.cpp 7KB
optimization_algorithm_levenberg.cpp 7KB
factory.cpp 6KB
types_seven_dof_expmap.cpp 6KB
cache.cpp 5KB
string_tools.cpp 5KB
robust_kernel_impl.cpp 5KB
optimization_algorithm_factory.cpp 5KB
parameter_container.cpp 4KB
hyper_graph.cpp 4KB
timeutil.cpp 4KB
matrix_structure.cpp 3KB
optimization_algorithm_with_hessian.cpp 3KB
optimization_algorithm_gauss_newton.cpp 3KB
property.cpp 3KB
robust_kernel_factory.cpp 3KB
jacobian_workspace.cpp 3KB
batch_stats.cpp 3KB
sparse_block_matrix_test.cpp 3KB
solver.cpp 3KB
optimization_algorithm.cpp 2KB
types_sba.cpp 2KB
robust_kernel.cpp 2KB
parameter.cpp 2KB
SLAM.cpp 1009B
main.cpp 226B
Dense 122B
opencv_world310.dll 41.17MB
opencv_ffmpeg310_64.dll 12.35MB
g2o.dll 805KB
glew.dll 452KB
DBoW2.dll 424KB
libpng16.dll 369KB
zlib.dll 186KB
Eigen 37B
Eigen2Support 3KB
Eigenvalues 1KB
g2o.exp 780KB
DBoW2.exp 175KB
FFT 14KB
ORB-SLAM2.vcxproj.filters 5KB
Geometry 2KB
glew.h 978KB
png.h 145KB
png.h 145KB
core_c.h 127KB
zlib.h 88KB
glxew.h 72KB
wglew.h 62KB
Eigen_Colamd.h 60KB
types_c.h 59KB
Transform.h 56KB
imgproc_c.h 51KB
jpeglib.h 49KB
GeneralBlockPanelKernel.h 45KB
SparseMatrix.h 44KB
TemplatedVocabulary.h 41KB
JacobiSVD.h 40KB
picojson.h 39KB
Functors.h 38KB
Memory.h 37KB
kmeans_index.h 36KB
PlainObjectBase.h 35KB
BlockMethods.h 34KB
共 887 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
- 兜兜猪尔2018-10-14下下来不会用啊
卡尔曼的BDSLAMer
- 粉丝: 6435
- 资源: 151
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功