日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

视觉slam十四讲 pdf_视觉SLAM十四讲——第三章 李群与李代数 课后作业amp;手推...

發(fā)布時間:2023/12/10 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 视觉slam十四讲 pdf_视觉SLAM十四讲——第三章 李群与李代数 课后作业amp;手推... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

首先呢,放一下整理好的PDF文件鏈接,供大家下載!

鏈接:

百度網(wǎng)盤鏈接?pan.baidu.com

密碼: fe4u

然后是每張圖片格式的展示,也方便在知乎平臺觀看:

繪出軌跡的程序源碼 draw_trajectory.cpp:(知乎的語言代碼塊類型還是很多的~)

#include <unistd.h> #include <string> #include <iostream> #include <fstream>#include <Eigen/Core> #include <sophus/se3.hpp>// need pangolin for plotting trajectory #include <pangolin/pangolin.h>using namespace std;// path to trajectory file string trajectory_file = "/home/fengyixiao/Dark_Blue/SLAM/course/Complete/PA3/trajectory.txt";// function for plotting trajectory, don't edit this code // start point is red and end point is blue void DrawTrajectory(vector<Sophus::SE3d, Eigen::aligned_allocator<Sophus::SE3d>>);int main(int argc, char **argv) {vector<Sophus::SE3d, Eigen::aligned_allocator<Sophus::SE3d>> poses;/// implement pose reading code// start your code here (5~10 lines)ifstream f_str(trajectory_file);if (!f_str){cout << "cannot find the file of trajectory at: " << trajectory_file << endl;return 1;}while(!f_str.eof()) //end of file{double time, tx, ty, tz, qx, qy, qz, w;f_str >> time >> tx >> ty >> tz >> qx >> qy >> qz >> w;Eigen::Quaterniond q= Eigen::Quaterniond(w, qx, qy, qz).normalized();Eigen::Vector3d t(tx, ty, tz);Sophus::SE3d SE3_qt(q, t);poses.push_back(SE3_qt);}cout << "complete it! read total: " << poses.size() << endl;// end your code here// draw trajectory in pangolinDrawTrajectory(poses);return 0; }void DrawTrajectory(vector<Sophus::SE3d, Eigen::aligned_allocator<Sophus::SE3d>> poses) {if (poses.empty()) {cerr << "Trajectory is empty!" << endl;return;}// create pangolin window and plot the trajectorypangolin::CreateWindowAndBind("Trajectory Viewer", 1024, 768);glEnable(GL_DEPTH_TEST);glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);pangolin::OpenGlRenderState s_cam(pangolin::ProjectionMatrix(1024, 768, 500, 500, 512, 389, 0.1, 1000),pangolin::ModelViewLookAt(0, -0.1, -1.8, 0, 0, 0, 0.0, -1.0, 0.0));pangolin::View &d_cam = pangolin::CreateDisplay().SetBounds(0.0, 1.0, pangolin::Attach::Pix(175), 1.0, -1024.0f / 768.0f).SetHandler(new pangolin::Handler3D(s_cam));while (!pangolin::ShouldQuit()) {glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);d_cam.Activate(s_cam);glClearColor(1.0f, 1.0f, 1.0f, 1.0f);glLineWidth(2);for (size_t i = 0; i < poses.size() - 1; i++) {glColor3f(1 - (float) i / poses.size(), 0.0f, (float) i / poses.size());glBegin(GL_LINES);auto p1 = poses[i], p2 = poses[i + 1];glVertex3d(p1.translation()[0], p1.translation()[1], p1.translation()[2]);glVertex3d(p2.translation()[0], p2.translation()[1], p2.translation()[2]);glEnd();}pangolin::FinishFrame();usleep(5000); // sleep 5 ms}}

vector<Sophus::SE3d, Eigen::aligned_allocator<Sophus::SE3d>>才是標準的定義容器方法,只是我們一般情況下定義容器的元素都是C++中的類型,所以可以省略,這是因為在C++11標準中,aligned_allocator管理C++中的各種數(shù)據(jù)類型的內(nèi)存方法是一樣的,可以不需要著重寫出來。但是在Eigen管理內(nèi)存和C++11中的方法是不一樣的,所以需要單獨強調(diào)元素的內(nèi)存分配和管理。

總結(jié)

以上是生活随笔為你收集整理的视觉slam十四讲 pdf_视觉SLAM十四讲——第三章 李群与李代数 课后作业amp;手推...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。