本文整理汇总了C++中VertexSE3类的典型用法代码示例。如果您正苦于以下问题:C++ VertexSE3类的具体用法?C++ VertexSE3怎么用?C++ VertexSE3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VertexSE3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: initializeDrawActionsCache
HyperGraphElementAction* VertexSE3DrawAction::operator()(HyperGraph::HyperGraphElement* element,
HyperGraphElementAction::Parameters* params_){
if (typeid(*element).name()!=_typeName)
return 0;
initializeDrawActionsCache();
refreshPropertyPtrs(params_);
if (! _previousParams)
return this;
if (_show && !_show->value())
return this;
VertexSE3* that = static_cast<VertexSE3*>(element);
glColor3f(POSE_VERTEX_COLOR);
glPushMatrix();
glMultMatrixd(that->estimate().matrix().data());
opengl::drawArrow2D(_triangleX->value(), _triangleY->value(), _triangleX->value()*.3f);
drawCache(that->cacheContainer(), params_);
drawUserData(that->userData(), params_);
if(_showId && _showId->value()){
float scale = _idSize ? _idSize->value() : 1.f;
drawId(std::to_string(that->id()), scale);
}
glPopMatrix();
return this;
}
开发者ID:felixendres,项目名称:g2o,代码行数:30,代码来源:vertex_se3.cpp
示例2: setMeasurement
bool EdgeSE3::setMeasurementFromState() {
VertexSE3 *from = static_cast<VertexSE3*>(_vertices[0]);
VertexSE3 *to = static_cast<VertexSE3*>(_vertices[1]);
Eigen::Isometry3d delta = from->estimate().inverse() * to->estimate();
setMeasurement(delta);
return true;
}
开发者ID:rmihalyi,项目名称:g2o,代码行数:7,代码来源:edge_se3.cpp
示例3: extractAbsolutePrior
bool extractAbsolutePrior(Eigen::Isometry3f& priorMean, Matrix6f& priorInfo,
const DrawableFrame* current){
VertexSE3* currentVertex =current->_vertex;
ImuData* imuData = 0;
OptimizableGraph::Data* d = currentVertex->userData();
while(d) {
ImuData* imuData_ = dynamic_cast<ImuData*>(d);
if (imuData_){
imuData = imuData_;
}
d=d->next();
}
if (imuData){
Eigen::Matrix3d R=imuData->getOrientation().matrix();
Eigen::Matrix3d Omega = imuData->getOrientationCovariance().inverse();
priorMean.setIdentity();
priorInfo.setZero();
for (int c = 0; c<3; c++)
for (int r = 0; r<3; r++)
priorMean.linear()(r,c)=R(r,c);
for (int c = 0; c<3; c++)
for (int r = 0; r<3; r++)
priorInfo(r+3,c+3)=Omega(r,c);
return true;
}
return false;
}
开发者ID:9578577,项目名称:g2o_frontend,代码行数:29,代码来源:viewer_state.cpp
示例4: refreshPropertyPtrs
HyperGraphElementAction* EdgeProjectDisparityDrawAction::operator()(HyperGraph::HyperGraphElement* element,
HyperGraphElementAction::Parameters* params_ ){
if (typeid(*element).name()!=_typeName)
return 0;
refreshPropertyPtrs(params_);
if (! _previousParams)
return this;
if (_show && !_show->value())
return this;
EdgeSE3PointXYZDisparity* e = static_cast<EdgeSE3PointXYZDisparity*>(element);
VertexSE3* fromEdge = static_cast<VertexSE3*>(e->vertices()[0]);
VertexPointXYZ* toEdge = static_cast<VertexPointXYZ*>(e->vertices()[1]);
if (! fromEdge || ! toEdge)
return this;
Eigen::Isometry3d fromTransform=fromEdge->estimate() * e->cameraParameter()->offset();
glColor3f(LANDMARK_EDGE_COLOR);
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_LIGHTING);
glBegin(GL_LINES);
glVertex3f((float)fromTransform.translation().x(),(float)fromTransform.translation().y(),(float)fromTransform.translation().z());
glVertex3f((float)toEdge->estimate().x(),(float)toEdge->estimate().y(),(float)toEdge->estimate().z());
glEnd();
glPopAttrib();
return this;
}
开发者ID:mikejmills,项目名称:g2o,代码行数:26,代码来源:edge_se3_pointxyz_disparity.cpp
示例5: refreshPropertyPtrs
HyperGraphElementAction* VertexSE3DrawAction::operator()(HyperGraph::HyperGraphElement* element,
HyperGraphElementAction::Parameters* params_){
if (typeid(*element).name()!=_typeName)
return 0;
if (! _cacheDrawActions){
_cacheDrawActions = HyperGraphActionLibrary::instance()->actionByName("draw");
}
refreshPropertyPtrs(params_);
if (! _previousParams)
return this;
if (_show && !_show->value())
return this;
VertexSE3* that = static_cast<VertexSE3*>(element);
glColor3f(0.5,0.5,0.8);
glPushMatrix();
glTranslatef(that->estimate().translation().x(),that->estimate().translation().y(),that->estimate().translation().z());
AngleAxisd aa(that->estimate().rotation());
glRotatef(RAD2DEG(aa.angle()),aa.axis().x(),aa.axis().y(),aa.axis().z());
if (_triangleX && _triangleY){
drawTriangle(_triangleX->value(), _triangleY->value());
}
CacheContainer* caches=that->cacheContainer();
if (caches){
for (CacheContainer::iterator it=caches->begin(); it!=caches->end(); it++){
Cache* c = it->second;
(*_cacheDrawActions)(c, params_);
}
}
glPopMatrix();
return this;
}
开发者ID:mischumok,项目名称:g2o,代码行数:35,代码来源:vertex_se3.cpp
示例6: VertexSE3
void GraphicEnd::generateKeyframe(Eigen::Isometry3d& T)
{
cout<<"generating keyframes..."<<endl;
currKF.id++;
currKF.frame_index=index;
currKF.frame.rgb=present.frame.rgb.clone();
currKF.frame.dep=present.frame.dep.clone();
//currKF.frame.cloud=present.frame.cloud;
pcl::copyPointCloud(*(present.frame.cloud),*(currKF.frame.cloud));
currKF.fullpose=present.fullpose;
//keyframes.reserve(100);
keyframes.push_back(currKF);
//cout<<"keyframes capacity is: "<<keyframes.capacity()<<endl;
SparseOptimizer& opt = _pSLAMEnd->globalOptimizer;
VertexSE3* v = new VertexSE3();
v->setId( currKF.id );
v->setEstimate( Eigen::Isometry3d::Identity() );
opt.addVertex( v );
cout<<"add vertex success!!!"<<endl;
//edge
EdgeSE3* edge = new EdgeSE3();
edge->vertices()[0] = opt.vertex( currKF.id - 1 );
edge->vertices()[1] = opt.vertex( currKF.id );
Eigen::Matrix<double, 6,6> information = Eigen::Matrix<double, 6, 6>::Identity();
information(0, 0) = information(2,2) = 100;
information(1, 1) = 100;
information(3,3) = information(4,4) = information(5,5) = 100;
edge->setInformation( information );
edge->setMeasurement( T );
opt.addEdge( edge );
cout<<"add edge success!!!"<<endl;
}
开发者ID:longchao9527,项目名称:slam,代码行数:34,代码来源:slam.cpp
示例7: fin
void GraphicEnd::savepcd()
{
cout<<"save final pointcloud"<<endl;
SLAMEnd slam;
slam.init(NULL);
SparseOptimizer& opt = slam.globalOptimizer;
opt.load("/home/lc/workspace/paper_related/Appolo/test/result/final_after.g2o");
ifstream fin("/home/lc/workspace/paper_related/Appolo/test/result/key_frame.txt");
PointCloud::Ptr output(new PointCloud());
PointCloud::Ptr curr( new PointCloud());
pcl::VoxelGrid<PointT> voxel;
voxel.setLeafSize(0.01f, 0.01f, 0.01f );
string pclPath ="/media/新加卷/dataset/dataset1/pcd/";
pcl::PassThrough<PointT> pass;
pass.setFilterFieldName("z");
double z = 5.0;
pass.setFilterLimits(0.0, z);
while( !fin.eof() )
{
int frame, id;
fin>>id>>frame;
ss<<pclPath<<frame<<".pcd";
string str;
ss>>str;
cout<<"loading "<<str<<endl;
ss.clear();
pcl::io::loadPCDFile( str.c_str(), *curr );
//cout<<"curr cloud size is: "<<curr->points.size()<<endl;
VertexSE3* pv = dynamic_cast<VertexSE3*> (opt.vertex( id ));
if (pv == NULL)
break;
Eigen::Isometry3d pos = pv->estimate();
cout<<pos.matrix()<<endl;
voxel.setInputCloud( curr );
PointCloud::Ptr tmp( new PointCloud());
voxel.filter( *tmp );
curr.swap( tmp );
pass.setInputCloud( curr );
pass.filter(*tmp);
curr->swap( *tmp );
//cout<<"tmp: "<<tmp->points.size()<<endl;
pcl::transformPointCloud( *curr, *tmp, pos.matrix());
*output += *tmp;
//cout<<"output: "<<output->points.size()<<endl;
}
voxel.setInputCloud( output );
PointCloud::Ptr output_filtered( new PointCloud );
voxel.filter( *output_filtered );
output->swap( *output_filtered );
//cout<<output->points.size()<<endl;
pcl::io::savePCDFile( "/home/lc/workspace/paper_related/Appolo/test/result/result.pcd", *output);
cout<<"final result saved."<<endl;
}
开发者ID:longchao9527,项目名称:slam,代码行数:58,代码来源:slam.cpp
示例8: measurement
void EdgeSE3PointXYZCov::initialEstimate(const g2o::OptimizableGraph::VertexSet& from_, g2o::OptimizableGraph::Vertex* /*to_*/)
{
VertexSE3* from = static_cast<VertexSE3*>(_vertices[0]);
VertexPointXYZCov* to = static_cast<VertexPointXYZCov*>(_vertices[1]);
if (from_.count(from) > 0)
to->setEstimate(from->estimate() * measurement());
else
std::cerr << __PRETTY_FUNCTION__ << std::endl;
}
开发者ID:MichaelRuhnke,项目名称:ssa,代码行数:9,代码来源:edge_se3_xyzcov.cpp
示例9: VertexSE3
void GraphicEnd::generateKeyFrame( Eigen::Isometry3d T )
{
cout<<BOLDGREEN<<"GraphicEnd::generateKeyFrame"<<RESET<<endl;
//把present中的数据存储到current中
_currKF.id ++;
_currKF.planes = _present.planes;
_currKF.frame_index = _index;
_lastRGB = _currRGB.clone();
_kf_pos = _robot;
cout<<"add key frame: "<<_currKF.id<<endl;
//waitKey(0);
_keyframes.push_back( _currKF );
//将current关键帧存储至全局优化器
SparseOptimizer& opt = _pSLAMEnd->globalOptimizer;
//顶点
VertexSE3* v = new VertexSE3();
v->setId( _currKF.id );
//v->setEstimate( _robot );
if (_use_odometry)
v->setEstimate( _odo_this );
//v->setEstimate( Eigen::Isometry3d::Identity() );
else
v->setEstimate( Eigen::Isometry3d::Identity() );
opt.addVertex( v );
//边
EdgeSE3* edge = new EdgeSE3();
edge->vertices()[0] = opt.vertex( _currKF.id - 1 );
edge->vertices()[1] = opt.vertex( _currKF.id );
Eigen::Matrix<double, 6,6> information = Eigen::Matrix<double, 6, 6>::Identity();
information(0, 0) = information(2,2) = 100;
information(1, 1) = 100;
information(3,3) = information(4,4) = information(5,5) = 100;
edge->setInformation( information );
edge->setMeasurement( T );
opt.addEdge( edge );
if (_use_odometry)
{
Eigen::Isometry3d To = _odo_last.inverse()*_odo_this;
cout<<"odo last = "<<endl<<_odo_last.matrix()<<endl<<"odo this = "<<endl<<_odo_this.matrix()<<endl;
cout<<"To = "<<endl<<To.matrix()<<endl;
cout<<"Measurement = "<<endl<<T.matrix()<<endl;
//waitKey( 0 );
EdgeSE3* edge = new EdgeSE3();
edge->vertices()[0] = opt.vertex( _currKF.id - 1 );
edge->vertices()[1] = opt.vertex( _currKF.id );
Eigen::Matrix<double, 6,6> information = Eigen::Matrix<double, 6, 6>::Identity();
information(0, 0) = information(1,1) = information(2,2) = information(3,3) = information(4,4) = information(5,5) = 1/(_error_odometry*_error_odometry);
edge->setInformation( information );
edge->setMeasurement( To );
opt.addEdge( edge );
_odo_last = _odo_this;
}
}
开发者ID:tyuownu,项目名称:ubuntu_opencv,代码行数:57,代码来源:GraphicEnd.cpp
示例10: measurement
void EdgeSE3Prior::initialEstimate(const OptimizableGraph::VertexSet& /*from_*/, OptimizableGraph::Vertex* /*to_*/) {
VertexSE3 *v = static_cast<VertexSE3*>(_vertices[0]);
SE3Quat newEstimate = _offsetParam->offset().inverse() * measurement();
if (_information.block<3,3>(0,0).squaredNorm()==0){ // do not set translation
newEstimate.setTranslation(v->estimate().translation());
}
if (_information.block<3,3>(3,3).squaredNorm()==0){ // do not set rotation
newEstimate.setRotation(v->estimate().rotation());
}
v->setEstimate(newEstimate);
}
开发者ID:MichaelRuhnke,项目名称:g2o,代码行数:12,代码来源:edge_se3_prior.cpp
示例11:
void EdgeSE3Prior::linearizeOplus(){
VertexSE3 *from = static_cast<VertexSE3*>(_vertices[0]);
Isometry3 E;
Isometry3 Z, X, P;
X=from->estimate().rotation().toRotationMatrix();
X.translation()=from->estimate().translation();
P=_cache->offsetParam()->offset().rotation().toRotationMatrix();
P.translation()=_cache->offsetParam()->offset().translation();
Z=_measurement.rotation().toRotationMatrix();
Z.translation()=_measurement.translation();
internal::computeEdgeSE3PriorGradient(E, _jacobianOplusXi, Z, X, P);
}
开发者ID:MichaelRuhnke,项目名称:g2o,代码行数:12,代码来源:edge_se3_prior.cpp
示例12:
void EdgeSE3LotsOfXYZ::computeError(){
VertexSE3 * pose = static_cast<VertexSE3 *> (_vertices[0]);
for(unsigned int i=0; i<_observedPoints; i++){
VertexPointXYZ * xyz = static_cast<VertexPointXYZ *> (_vertices[1+i]);
Vector3D m = pose->estimate().inverse() * xyz->estimate();
unsigned int index = 3*i;
_error[index] = m[0] - _measurement[index];
_error[index+1] = m[1] - _measurement[index+1];
_error[index+2] = m[2] - _measurement[index+2];
}
}
开发者ID:2maz,项目名称:g2o,代码行数:13,代码来源:edge_se3_lotsofxyz.cpp
示例13:
void EdgeSE3::linearizeOplus() {
// BaseBinaryEdge<6, Eigen::Isometry3d, VertexSE3, VertexSE3>::linearizeOplus();
// return;
VertexSE3 *from = static_cast<VertexSE3*>(_vertices[0]);
VertexSE3 *to = static_cast<VertexSE3*>(_vertices[1]);
Eigen::Isometry3d E;
const Eigen::Isometry3d& Xi=from->estimate();
const Eigen::Isometry3d& Xj=to->estimate();
const Eigen::Isometry3d& Z=_measurement;
computeEdgeSE3Gradient(E, _jacobianOplusXi , _jacobianOplusXj, Z, Xi, Xj);
}
开发者ID:rmihalyi,项目名称:g2o,代码行数:13,代码来源:edge_se3.cpp
示例14: assert
void EdgeSE3PointXYZDepth::initialEstimate(const OptimizableGraph::VertexSet& from, OptimizableGraph::Vertex* /*to_*/)
{
(void) from;
assert(from.size() == 1 && from.count(_vertices[0]) == 1 && "Can not initialize VertexDepthCam position by VertexTrackXYZ");
VertexSE3 *cam = dynamic_cast<VertexSE3*>(_vertices[0]);
VertexPointXYZ *point = dynamic_cast<VertexPointXYZ*>(_vertices[1]);
const Eigen::Matrix<double, 3, 3>& invKcam = params->invKcam();
Eigen::Vector3d p;
p(2) = _measurement(2);
p.head<2>() = _measurement.head<2>()*p(2);
p=invKcam*p;
point->setEstimate(cam->estimate() * (params->offsetMatrix() * p));
}
开发者ID:2maz,项目名称:g2o,代码行数:14,代码来源:edge_se3_pointxyz_depth.cpp
示例15: assert
void EdgeSE3PointXYZ::initialEstimate(const OptimizableGraph::VertexSet& from, OptimizableGraph::Vertex* /*to_*/)
{
(void) from;
assert(from.size() == 1 && from.count(_vertices[0]) == 1 && "Can not initialize VertexDepthCam position by VertexTrackXYZ");
VertexSE3 *cam = dynamic_cast<VertexSE3*>(_vertices[0]);
VertexPointXYZ *point = dynamic_cast<VertexPointXYZ*>(_vertices[1]);
// SE3OffsetCache* vcache = (SE3OffsetCache* ) cam->getCache(_cacheIds[0]);
// if (! vcache){
// cerr << "fatal error in retrieving cache" << endl;
// }
// SE3OffsetParameters* params=vcache->params;
Eigen::Vector3d p=_measurement;
point->setEstimate(cam->estimate() * (offsetParam->offset() * p));
}
开发者ID:AlexandrGraschenkov,项目名称:ORB_SLAM,代码行数:15,代码来源:edge_se3_pointxyz.cpp
示例16:
HyperGraphElementAction* VertexSE3WriteGnuplotAction::operator()(HyperGraph::HyperGraphElement* element, HyperGraphElementAction::Parameters* params_){
if (typeid(*element).name()!=_typeName)
return 0;
WriteGnuplotAction::Parameters* params=static_cast<WriteGnuplotAction::Parameters*>(params_);
if (!params->os){
std::cerr << __PRETTY_FUNCTION__ << ": warning, on valid os specified" << std::endl;
return 0;
}
VertexSE3* v = static_cast<VertexSE3*>(element);
Vector6d est=toVectorMQT(v->estimate());
for (int i=0; i<6; i++)
*(params->os) << est[i] << " ";
*(params->os) << std::endl;
return this;
}
开发者ID:mischumok,项目名称:g2o,代码行数:16,代码来源:vertex_se3.cpp
示例17:
HyperGraphElementAction* VertexSE3WriteGnuplotAction::operator()(HyperGraph::HyperGraphElement* element, HyperGraphElementAction::Parameters* params_){
if (typeid(*element).name()!=_typeName)
return 0;
WriteGnuplotAction::Parameters* params=static_cast<WriteGnuplotAction::Parameters*>(params_);
if (!params->os){
std::cerr << __PRETTY_FUNCTION__ << ": warning, no valid os specified" << std::endl;
return 0;
}
VertexSE3* v = static_cast<VertexSE3*>(element);
*(params->os) << v->estimate().translation().x() << " "
<< v->estimate().translation().y() << " "
<< v->estimate().translation().z() << " ";
*(params->os) << v->estimate().rotation().x() << " "
<< v->estimate().rotation().y() << " "
<< v->estimate().rotation().z() << " " << std::endl;
return this;
}
开发者ID:rmihalyi,项目名称:g2o,代码行数:18,代码来源:vertex_se3_quat.cpp
示例18: Frame
void ViewerState::addCloudSelected(){
if(listItem) {
cerr << "adding a frame" << endl;
int index = pwnGMW->listWidget->row(listItem);
cerr << "index: " << endl;
std::string fname = listAssociations[index]->baseFilename()+"_depth.pgm";
DepthImage depthImage;
if (!depthImage.load(fname.c_str(), true)){
cerr << " skipping " << fname << endl;
newCloudAdded = false;
*addCloud = 0;
return;
}
DepthImage scaledDepthImage;
DepthImage::scale(scaledDepthImage, depthImage, reduction);
imageRows = scaledDepthImage.rows();
imageCols = scaledDepthImage.cols();
correspondenceFinder->setSize(imageRows, imageCols);
Frame * frame=new Frame();
converter->compute(*frame, scaledDepthImage, sensorOffset);
OptimizableGraph::DataContainer* dc =listAssociations[index]->dataContainer();
cerr << "datacontainer: " << dc << endl;
VertexSE3* v = dynamic_cast<VertexSE3*>(dc);
cerr << "vertex of the frame: " << v->id() << endl;
DrawableFrame* drawableFrame = new DrawableFrame(globalT, drawableFrameParameters, frame);
drawableFrame->_vertex = v;
Eigen::Isometry3f priorMean;
Matrix6f priorInfo;
bool hasImu =extractAbsolutePrior(priorMean, priorInfo, drawableFrame);
if (hasImu && drawableFrameVector.size()==0){
globalT.linear() = priorMean.linear();
cerr << "!!!! i found an imu for the first vertex, me happy" << endl;
drawableFrame->setTransformation(globalT);
}
drawableFrameVector.push_back(drawableFrame);
pwnGMW->viewer_3d->addDrawable(drawableFrame);
}
newCloudAdded = true;
*addCloud = 0;
_meHasNewFrame = true;
}
开发者ID:9578577,项目名称:g2o_frontend,代码行数:43,代码来源:viewer_state.cpp
示例19:
void EdgeSE3Offset::linearizeOplus(){
//BaseBinaryEdge<6, SE3Quat, VertexSE3, VertexSE3>::linearizeOplus();
VertexSE3 *from = static_cast<VertexSE3*>(_vertices[0]);
VertexSE3 *to = static_cast<VertexSE3*>(_vertices[1]);
Eigen::Isometry3d E;
const Eigen::Isometry3d& Xi=from->estimate();
const Eigen::Isometry3d& Xj=to->estimate();
const Eigen::Isometry3d& Pi=_cacheFrom->offsetParam()->offset();
const Eigen::Isometry3d& Pj=_cacheTo->offsetParam()->offset();
const Eigen::Isometry3d& Z=_measurement;
// Matrix6d Ji, Jj;
// computeSE3Gradient(E, Ji , Jj,
// Z, Pi, Xi, Pj, Xj);
// cerr << "Ji:" << endl;
// cerr << Ji-_jacobianOplusXi << endl;
// cerr << "Jj:" << endl;
// cerr << Jj-_jacobianOplusXj << endl;
internal::computeEdgeSE3Gradient(E, _jacobianOplusXi , _jacobianOplusXj, Z, Xi, Xj, Pi, Pj);
}
开发者ID:Aerobota,项目名称:c2tam,代码行数:20,代码来源:edge_se3_offset.cpp
示例20: assert
void EdgeSE3PointXYZDisparity::initialEstimate(const OptimizableGraph::VertexSet& from, OptimizableGraph::Vertex* /*to*/)
{
(void) from;
assert(from.size() == 1 && from.count(_vertices[0]) == 1 && "Can not initialize VertexDepthCam position by VertexTrackXYZ");
VertexSE3 *cam = dynamic_cast<VertexSE3*>(_vertices[0]);
VertexPointXYZ *point = dynamic_cast<VertexPointXYZ*>(_vertices[1]);
// VertexCameraCache* vcache = (VertexCameraCache* ) cam->getCache(_cacheIds[0]);
// if (! vcache){
// cerr << "fatal error in retrieving cache" << endl;
// }
//ParameterCamera* params=vcache->params;
const Eigen::Matrix<double, 3, 3>& invKcam = params->invKcam();
Eigen::Vector3d p;
double w=1./_measurement(2);
p.head<2>() = _measurement.head<2>()*w;
p(2) = w;
p = invKcam * p;
p = cam->estimate() * (params->offset() * p);
point->setEstimate(p);
}
开发者ID:mikejmills,项目名称:g2o,代码行数:21,代码来源:edge_se3_pointxyz_disparity.cpp
注:本文中的VertexSE3类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论