下面这些笔记有点老了,等我有时间处理一下最新的。。。
先占个坑。
安装 colcon and vcs
sudo apt update && sudo apt install -y build-essential
sudo apt install -y git cmake python3-pip
pip3 install -U colcon-common-extensions vcstool
添加环境变量,让终端可以直接执行colcon和vcs
vi ~/.bashrc
添加到末尾
export PATH=$PATH:~/.local/bin/
source ~/.bashrc
Get ros2 foxy repo 下载源码
mkdir -p ~/ros2_foxy/src
cd ~/ros2_foxy
wget https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos
vcs import src < ros2.repos
Download OGRE
下载rviz依赖
https://github.com/OGRECave/ogre/archive/v1.12.1.zip
unzip to ~/ros2_foxy
On linux you additionally need the following system headers to build the GL & GLES2 RenderSystems (command for Ubuntu):
sudo apt-get install libgles2-mesa-dev
furthermore we recommend installing the following optional packages
sudo apt-get install libsdl2-dev libxt-dev libxaw7-dev doxygen
Build ros2
安装编译依赖
pip3 install lark numpy
sudo apt-get install python3-pyqt5 pyqt5-dev-tools qttools5-dev-tools
sudo apt-get install python3-sip-dev
编译
cd ~/ros2_foxy/
colcon build --symlink-install
环境激活
. ~/ros2_foxy/install/local_setup.bash
测试
启动 C++ talker:
. ~/ros2_foxy/install/local_setup.bash
ros2 run demo_nodes_cpp talker
启动 Python listener:
. ~/ros2_foxy/install/local_setup.bash
ros2 run demo_nodes_py listener