cartographer Ubuntu16.04 ros環境配置


首先要正確安裝 ROS ,然后第12步應注意,proto的版本是個關鍵容易出錯。
 
1、添加ROS源
http:/packages.ros.org/ros/ubuntu xenial main   (自己搜一下怎么添加)
sudo apt-get update     更新源。
2、Setup your sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
3、Set up your keys-
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
4、Installation
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
5、Initialize rosdep
sudo rosdep init
sudo rosdep fix-permissions
rosdep update
6、Environment setup
It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are currently using.
If you just want to change the environment of your current shell, instead of the above you can type:
source /opt/ros/kinetic/setup.bash
If you use zsh instead of bash you need to run the following commands to set up your shell:
echo "source /opt/ros/kinetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
7、Dependencies for building packages
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
8、運行小烏龜測試
新建一個終端,輸入$ roscore
新建一個終端,輸入$ rosrun turtlesim turtlesim_node
新建一個終端,輸入$ rosrun turtlesim turtle_telelop_key
移動上下左右鍵, 第三個終端放在最上層 , 看到小烏龜移動了。

9、安裝Cartographer基本必須的庫
sudo apt-get update
sudo apt-get install -y \
    cmake \
    g++ \
    git \
    google-mock \
    libboost-all-dev \
    libcairo2-dev \
    libeigen3-dev \
    libgflags-dev \
    libgoogle-glog-dev \
    liblua5.2-dev \
    libsuitesparse-dev \
    libwebp-dev \
    ninja-build \
    python-sphinx
10、安裝wstool和rosdep
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
11、創建workspace
mkdir catkin_ws
cd catkin_ws
wstool init src
12、下載google cartographer源碼(vpn)也可以從github直接下載
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
cd catkin_ws/src
將最后一個git來源網址由https://ceres-solver.googlesource.com/ceres-solver.git 改為https://github.com/ceres-solver/ceres-solver.git
wstool update -t src
# Install proto3.
src/cartographer/scripts/install_proto3.sh
# Install deb dependencies.
# The command 'sudo rosdep init' will print an error if you have already
# executed it since installing ROS. This error can be ignored.
sudo rosdep init
13、安裝deb依賴
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${kinetic} -y
14、編譯並安裝
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash(設置路徑)
15、每次修改了lua代碼都需要運行下面代碼進行編譯和設置路徑
cd slam_ws
catkin_make_isolated --install --use-ninja進行編譯
source install_isolated/setup.bash設置路徑
16、Launch
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/dmchen/slam_ws/src/cartographer_ros/cartographer_ros/bag/1014.bag
其中我們自己的數據包包1014.bag存儲路徑為/home/dmchen/slam_ws/src/cartographer_ros/cartographer_ros/bag
數據包下載地址:https://storage.googleapis.com/cartographer-public-data/bags/revo_lds/cartographer_paper_revo_lds.bag
https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
https://storage.googleapis.com/cartographer-public-data/bags/pr2/2011-09https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/cartographer_3d_deutsches_museum.bag
以后 第一次打開終端運行時 需要 source install_isolated/setup.bash (調用ROS內部命令)
測試是否安裝成功:# Download the 2D backpack example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
# Launch the 2D backpack demo.
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
# Download the 3D backpack example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
# Launch the 3D backpack demo.
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM