这个放在第二个是因为开发环境安装各种包,你懂的。
1,Make sure that you have a locale set which supports UTF-8
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
2,setup the development environment
2.1 Install GCC, G++ CMake, Python 3 EmPy package (custom packages which don't collide) and setuptools:
udo apt-get update
sudo apt-get install git wget
sudo apt-get install build-essential cppcheck cmake libopencv-dev python-empy python3-dev python3-empy python3-nose python3-pip python3-pyparsing python3-setuptools python3-vcstool python3-yaml libtinyxml-dev libeigen3-dev
sudo apt-get install clang-format pydocstyle pyflakes python3-coverage python3-mock python3-pep8 uncrustify
sudo pip3 install argcomplete
sudo pip3 install flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes pytest pytest-cov pytest-runner
sudo apt-get install libasio-dev libtinyxml2-dev
2.2
sudo apt-get install libboost-chrono-dev libboost-date-time-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-thread-dev
sudo apt-get install libcurl4-openssl-dev libqt5core5a libqt5gui5 libqt5opengl5 libqt5widgets5 libxaw7-dev libgles2-mesa-dev libglu1-mesa-dev qtbase5-dev
3,Get ROS 2.0 code
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
vcs-import src < ros2.repos (这个时间有点长。。。)
4,
sudo apt update && sudo apt install curl
sudo apt-get update
sudo apt-get install libopensplice67
5,build
cd ~/ros2_ws/
src/ament/ament_tools/scripts/ament.py build --build-tests --symlink-install (已经测试,可以编译,但是需要多试几次。)
6,test
Try some examples
In one terminal, source the setup file and then run atalker:
. ~/ros2_ws/install/local_setup.bash
# . ~/ros2_ws/install_isolated/local_setup.bash # if you built in isolation, use this instead of the above line
ros2 run demo_nodes_cpp talker
In another terminal source the setup file and then run alistener:
. ~/ros2_ws/install/local_setup.bash
# . ~/ros2_ws/install_isolated/local_setup.bash # if you built in isolation, use this instead of the above line
ros2 run demo_nodes_py listener
You should see thetalkersaying that it'sPublishingmessages and thelistenersayingI heardthose messages.Hooray!