SLAM development on M1 Mac

来源:https://www.cnblogs.com/ZhaoqunZhong/archive/2022/09/15/16691371.html
-Advertisement-
Play Games

This blog introduces how to do SLAM related development natively on M1(Apple silicon) macbook. Most people come from Ubuntu environment will choose th ...


This blog introduces how to do SLAM related development natively on M1(Apple silicon) macbook. Most people come from Ubuntu environment will choose the easy but heavy path of installing a virtual Ubuntu machine and do the rest like before. I want to try to do it natively and share my experience with all the SLAM engineers out there who can't resist the new Macbook but worry about it can't be used for their daily work.

Conclusion comes first: It's rather straightforwad and the source code building speedup is really awesome.

With Clion and package management tool Homebrew, the whole process is not that much different from the Ubuntu environment.

Install Clion

The reason I recommand Clion is that it automatically takes care of the c++ toolchain part for you.

Clion's website provides the Apple silicon's version of download.

Install homebrew

Method 1

Guide from homebrew official website
https://docs.brew.sh/Installation

If you encounter this problem

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

then use method 2.

Method 2

Just manually download the install scripts from homebrew's github repo
https://github.com/Homebrew/install
and run the ./install.sh and ./uninstall.sh as you need.

You can also modify the HOMEBREW_BREW_DEFAULT_GIT_REMOTE and HOMEBREW_CORE_DEFAULT_GIT_REMOTE variables in the install.sh to use ssh urls instead of the https urls if you prefer.

Install pangolin

Pangolin is not in homebrew, so we have to build and install it from source.

  1. Install dependecies using homebrew
brew install eigen
brew install glew
  1. Fetch pangolin and compiles
    Because of some deprecation things related to opengl, the head of master branch from Pangolin's git repo can compile and run with itself, but causes error when it's used as dependency for certain SLAM algorithms. I forked the original repo and fixed some bugs here.
    https://github.com/ZhaoqunZhong/Pangolin

  2. Pay attention that the default CMAKE_INSTALL_PREFIX is still /usr/local/ like in Ubuntu. ('brew install' installs things to /opt/homebrew/, and cmake will include it into its search path. )
    So, if your project complains about can't find pangolin, you can just add /usr/local/~ to the include and library dirs manually.

Install OpenCV

Method 1

brew install opencv

Method 2

Build and install from source.
I used version 4.5.5. After earlier steps, it compiles out of the box.

By the way, I remember it takes at least 10min to build OpenCV from source on an Ubuntu machine with Intel i7 32g ram. But my M1pro Macbook takes about 3min13s. Shocking!

Install ceres-solver

Method 1

brew install ceres-solver

Method 2

Build and install from source.

  1. Install dependecies
brew install gflags
brew install glog
  1. Build ceres-solver
    It will automatically detect and use Apple's accelarate framework as the backend sparse solver.

-- Found Apple's Accelerate framework with sparse solvers, building with Accelerate sparse support.

Install PCL

brew install pcl

I'm tired of trying to build from source any more for two reasons:

  1. I guess they can all work based on the OpenCV and ceres-solver results.
  2. Homebrew takes care of all the dependencies for you if you are missing packages for your current installed package. It's so convenient. I recommand using it whenever possible.

Test a SLAM algorithm

Here I chose TUM's DSO algorithm. To make it work on M1 macbook, I also had to make some adjustments to the original head of master branch. I put the final workable version here.
https://github.com/ZhaoqunZhong/dso

Result

image

Good luck!


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 從提升性能角度來說 提升了對CPU的使用效率:目前生產的伺服器大多數都是多核,標配的機器都是 8C/16G。操作系統會將不同的線程分配給不同的核心處理,理論上,有多少核心就有多少個線程並行執行。如果沒有併發編程,CPU的利用率將極大的浪費,假設當前正在處理耗時的 I/O 操作,那麼整個CPU就會處於... ...
  • 大家好,我是三友~~ 在對於讀寫鎖的認識當中,我們都認為讀時加讀鎖,寫時加寫鎖來保證讀寫和寫寫互斥,從而達到讀寫安全的目的。但是就在我翻Eureka源碼的時候,發現Eureka在使用讀寫鎖時竟然是在讀時加寫鎖,寫時加讀鎖,這波操作屬實震驚到了我,於是我就花了點時間研究了一下Eureka的這波操作。 ...
  • DotnetZip使用方法見此文章https://www.cnblogs.com/pengze0902/p/6124659.html在netframework環境下,使用上面文章中的設置Encoding為Default的方法即可解決中文亂碼問題 但是當我使用.net6創建控制台項目並採用上述代碼時, ...
  • iNeuOS工業互聯網操作系統面向:儀器儀錶、雙碳環保、核能科學與工程和鋼鐵冶金領域頒發第一批技術認證資質,一共21名同志在項目實施過程中表現突出,從iNeuOS的應用、開發及項目過程中的交流都大大促進了項目保質保量的快速交付,特此頒發應用實施和二次開發工程認證。 ...
  • 一:背景 1. 講故事 前段時間有位朋友在微信上找到我,說他的程式出現了記憶體泄漏,能不能幫他看一下,這個問題還是比較經典的,加上好久沒上非托管方面的東西了,這篇就和大家分享一下,話不多說,上 WinDbg 說話。 二:WinDbg 分析 1. 到底是哪裡的泄漏 好的開始就是成功的一半,否則就南轅北轍 ...
  • sed高階用法 sed編輯器 sed是一種流編輯器,流編輯器會在編輯器處理數據之前基於預先提供的一組規則來編輯數據流。 1.sed編輯器工作流程 sed編輯器可以根據命令來處理數據流中的數據,這些命令要麼從命令行中輸入,要麼存儲在一個命令文本文件中。 sed的工作流程主要包括讀取、執行和顯示三個過程 ...
  • 個人學習-Linux文件系統架構 1. 參考文章 [1]https://blog.csdn.net/Holy_666/article/details/86532671 [2]CSDN博主土豆西瓜大芝麻:[Linux的VFS詳解]:https://blog.csdn.net/jinking01/art ...
  • Linux的哲學思想 優勢 一切都是一個文件。(包括硬體,文本,二進位,源代 碼) 系統中擁有小型,單一用途的程式。(一個程式只負責 做好自己的本職工作) 當遇到複雜任務,通過不同功能用途的程式組合起來 完成。 輕量級,一臺服務 dhcp ip 資料庫服務 網 頁 避免令人困惑的用戶界面就是沒有複雜 ...
一周排行
    -Advertisement-
    Play Games
  • 前言 在我們開發過程中基本上不可或缺的用到一些敏感機密數據,比如SQL伺服器的連接串或者是OAuth2的Secret等,這些敏感數據在代碼中是不太安全的,我們不應該在源代碼中存儲密碼和其他的敏感數據,一種推薦的方式是通過Asp.Net Core的機密管理器。 機密管理器 在 ASP.NET Core ...
  • 新改進提供的Taurus Rpc 功能,可以簡化微服務間的調用,同時可以不用再手動輸出模塊名稱,或調用路徑,包括負載均衡,這一切,由框架實現並提供了。新的Taurus Rpc 功能,將使得服務間的調用,更加輕鬆、簡約、高效。 ...
  • 順序棧的介面程式 目錄順序棧的介面程式頭文件創建順序棧入棧出棧利用棧將10進位轉16進位數驗證 頭文件 #include <stdio.h> #include <stdbool.h> #include <stdlib.h> 創建順序棧 // 指的是順序棧中的元素的數據類型,用戶可以根據需要進行修改 ...
  • 前言 整理這個官方翻譯的系列,原因是網上大部分的 tomcat 版本比較舊,此版本為 v11 最新的版本。 開源項目 從零手寫實現 tomcat minicat 別稱【嗅虎】心有猛虎,輕嗅薔薇。 系列文章 web server apache tomcat11-01-官方文檔入門介紹 web serv ...
  • C總結與剖析:關鍵字篇 -- <<C語言深度解剖>> 目錄C總結與剖析:關鍵字篇 -- <<C語言深度解剖>>程式的本質:二進位文件變數1.變數:記憶體上的某個位置開闢的空間2.變數的初始化3.為什麼要有變數4.局部變數與全局變數5.變數的大小由類型決定6.任何一個變數,記憶體賦值都是從低地址開始往高地 ...
  • 如果讓你來做一個有狀態流式應用的故障恢復,你會如何來做呢? 單機和多機會遇到什麼不同的問題? Flink Checkpoint 是做什麼用的?原理是什麼? ...
  • C++ 多級繼承 多級繼承是一種面向對象編程(OOP)特性,允許一個類從多個基類繼承屬性和方法。它使代碼更易於組織和維護,並促進代碼重用。 多級繼承的語法 在 C++ 中,使用 : 符號來指定繼承關係。多級繼承的語法如下: class DerivedClass : public BaseClass1 ...
  • 前言 什麼是SpringCloud? Spring Cloud 是一系列框架的有序集合,它利用 Spring Boot 的開發便利性簡化了分散式系統的開發,比如服務註冊、服務發現、網關、路由、鏈路追蹤等。Spring Cloud 並不是重覆造輪子,而是將市面上開發得比較好的模塊集成進去,進行封裝,從 ...
  • class_template 類模板和函數模板的定義和使用類似,我們已經進行了介紹。有時,有兩個或多個類,其功能是相同的,僅僅是數據類型不同。類模板用於實現類所需數據的類型參數化 template<class NameType, class AgeType> class Person { publi ...
  • 目錄system v IPC簡介共用記憶體需要用到的函數介面shmget函數--獲取對象IDshmat函數--獲得映射空間shmctl函數--釋放資源共用記憶體實現思路註意 system v IPC簡介 消息隊列、共用記憶體和信號量統稱為system v IPC(進程間通信機制),V是羅馬數字5,是UNI ...