Skip to content

Instantly share code, notes, and snippets.

@lennonwoo
Created July 13, 2019 05:48
Show Gist options
  • Save lennonwoo/e495c30edf76bdfecd40cca44f35ad9f to your computer and use it in GitHub Desktop.
Save lennonwoo/e495c30edf76bdfecd40cca44f35ad9f to your computer and use it in GitHub Desktop.
win10 setup for ROS2
Init Win10 with VS2019 & ros related
1. Install Visual Studio 2019 with VC++
2. Use Chocolatey to install dependencies, including
```
curl
cppcheck
Python3.7.2
cmake3.14.4 add `C:\Program Files\CMake\bin` to PATH to replace the internal cmake of VS (NOTICE: cmake3.13.3 cannot generate VS2019 files)
asio.1.12.1.nupkg from ros2 release
eigen-3.3.4.nupkg from ros2 release
tinyxml-usestl.2.6.2.nupkg from ros2 release
tinyxml2.6.0.0.nupkg from ros2 release
log4cxx.0.10.0.nupkg from ros2 release
```
3. Qt5.10.0 with msvc2017_64
then `setx -m Qt5_DIR C:\Qt\Qt5.10.0\5.10.0\msvc2017_64`
4. OpenSSH v1.0.2
`setx -m OPENSSL_CONF C:\OpenSSL-Win64\bin\openssl.cfg` and also add `C:\OpenSSL-Win64\bin` to PATH
5. get opencv-3.4.6-vc16.VS2019.zip from ROS2 release
`setx -m OpenCV_DIR C:\opencv` and add `C:\opencv\x64\vc16\bin` to PATH
6. Python dependencies
pip install -U setuptools pip
pip install -U catkin_pkg empy lark-parser opencv-python pyparsing pyyaml setuptools
pip install -U pydot PyQt5
pip install -U lxml
pip install -U vcstool
pip install -U colcon-common-extensions
pip install -U pytest coverage mock
pip install -U flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions
pip install -U flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes pep8 pydocstyle
7. install xmllint
download the x64 version of libxml2 & iconv & zlib from https://www.zlatkovic.com/pub/libxml/64bit/
extract them and add `C:\xmllint\bin` to PATH
8. Init ROS2 workspace
```
md \dev\ros2\src
cd \dev\ros2
curl -sk https://raw.githubusercontent.com/ros2/ros2/release-latest/ros2.repos -o ros2.repos (aka ROS 2 Crystal Clemmys - Patch Release 4)
vcs import src < ros2.repos
```
9. build ros2
open x64 Native Tools Command Prompt for VS 2019
change work directory to c:\dev\ros2
execute command `colcon build --merge-install --packages-skip-build-finished`
NOTICE: There will be an error when patching `ogre-ca665a6-patch.diff`, because the patch files must have CR-LF as line endings in Windows, change the .diff in the source to fix it.
10. test ros2
To run the examples, first open a clean new cmd.exe and set up the workspace. This is done by sourcing the local_setup.bat file, which will automatically set up the environment for any DDS vendors that support was built for. Then execute the examples, e.g.:
call install\local_setup.bat
ros2 run demo_nodes_py talker
In a separate shell you can do the same, but instead run the listener:
call install\local_setup.bat
ros2 run demo_nodes_py listener
11. colcon test
for ROS 2 Crystal Clemmys - Patch Release 4, we may meet test error when run command as follow
`colcon build --merge-install --packages-select rcl`
the error is `test_wait__rmw_fastrtps_dynamic_cpp.vcxproj -> C:\dev\ros2\build\rcl\test\Release\test_wait__rmw_fastrtp12. try build the newest package
12. try build the newest package
```
md \dev\ros2_master\src
cd \dev\ros2
curl -sk https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos -o ros2.repos
vcs import src < ros2.repos
colcon build --merge-install --packages-skip-build-finished
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment