ROS2 under test and install the WIN10

Blog reference: https://blog.csdn.net/cocoiehl/article/details/83351307  and  https://blog.csdn.net/weixin_38294178/article/details/78844744

ROS2 official installation guide:  https://index.ros.org/doc/ros2/Installation/Crystal/Windows-Install-Binary/

TIPS: set the installation position of the subsequent choco software, can set the environment variable ChocolateyInstall, the value of the variable installation path.

1. Install Chocolatey

 Administrator rights to open a command line window, enter the following command to complete the Chocolatey installation, the installation directory is  C: \ ProgramData \ chocolatey \ bin \ chocolatey.exe

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Instruction will Chocolatey where the installation directory is set to the global path ( C: \ ProgramData \ chocolatey \ bin ), so the command line input chocolatey or choco - there will be a corresponding print information?

2. Chocolatey install python 

choco install python 

3. Install OpenSSL

AN OpenSSL Installer from the Download  the this Page . At The bottom of the Scroll to Page and download at The  Win64 OpenSSL v1.0.2 . Do not download Win32 or Light versions. After installing, set the exchange into variable information

setx -m OPENSSL_CONF C:\OpenSSL-Win64\bin\openssl.cfg

Path add the path information OpenSSL

C:\OpenSSL-Win64\bin\

4. Install Visual Studio

1. Installation VS2015, if used Ardent or earlier

2. Installation VS2017, if used Bouncy or a nightly

Warning
Visual Studio 2017 v15.8 seems to have a compiler bug preventing from building some ROS 2 packages. Please try installing an older version of Visual Studio 2017.
Microsoft provides a free of charge version of Visual Studio 2017, named Community, which can be used to build applications that use ROS 2:
https://visualstudio.microsoft.com/downloads/
Make sure that the Visual C++ features are installed. An easy way to make sure they’re installed is to select the Desktop development with C++ workflow during the install.

5. Installation DDS Implementations

ROS 2 builds on top of DDS. It is compatible with multiple DDS or RTPS (the DDS wire protocol) vendors.

The package you downloaded has been built with optional support for multiple vendors: eProsima FastRTPS, Adlink OpenSplice, and (as of ROS 2 Bouncy) RTI Connext as the middleware options. Run-time support for eProsima’s Fast RTPS is included bundled by default. If you would like to use one of the other vendors you will need to install their software separately.

Adlink OpenSplice

If you want to use OpenSplice, you will need to download the latest supported version. * For ROS 2 Crystal version 6.9.181126OSS-HDE-x86_64.win-vs2017 or later is required. * For ROS 2 Bouncy version 6.7.180404OSS-HDE-x86_64.win-vs2017 or later is required.

Download the latest supported version For ROS 2 releases up to and including Ardent, extract it but do not do anything else at this point. For ROS 2 releases later than Ardent, set the OSPL_HOME environment variable to the unpacked directory that contains the release.bat script.

RTI Connext

To use RTI Connext DDS there are options available for university, purchase or evaluation

After installing, run RTI launcher and point it to your license file.

Set the NDDSHOME environment variable:

set "NDDSHOME=C:\Program Files\rti_connext_dds-5.3.1"

RTI Connext need to register an account, then use the License registration will be sent to the mailbox, or can be installed in accordance with Instruction mailbox https://www.rti.com/free-trial/dds-files .

After the download is complete decompression, get the following files

 

6. Install OpenCV

Some of the examples require OpenCV to be installed.

You can download a precompiled version of OpenCV 3.4.1 from https://github.com/ros2/ros2/releases/download/opencv-archives/opencv-3.4.1-vc15.VS2017.zip

Assuming you unpacked it to C:\opencv, type the following on a Command Prompt (requires Admin privileges):

setx -m OpenCV_DIR C:\opencv

Since you are using a precompiled ROS version, we have to tell it where to find the OpenCV libraries. You have to extend the PATH variable to c:\opencv\x64\vc15\bin

In ardent and earlier

These releases used OpenCV 2. You can download a precompiled version of OpenCV 2.4.13.2 from https://github.com/ros2/ros2/releases/download/release-beta2/opencv-2.4.13.2-vc14.VS2015.zip

Since you are using a precompiled ROS version, we have to tell it where to find the OpenCV libraries. Assuming you were extracting OpenCV to c:\ you have to extend your PATH variable to 

c:\opencv-2.4.13.2-vc14.VS2015\x64\vc14\bin

7. Install some dependencies

There are a few dependencies not available in the Chocolatey package database. In order to ease the manual installation process, we provide the necessary Chocolatey packages.

As some chocolatey packages rely on it, we start by installing CMake

choco install -y cmake

You will need to append the CMake bin folder C:\Program Files\CMake\bin to your PATH.

Please download these packages from this GitHub repository.

  • asio.1.12.1.nupkg

  • own-3.3.4.nupkg

  • tinyxml-usestl.2.6.2.nupkg

  • tinyxml2.6.0.0.nupkg

  • log4cxx.0.10.0.nupkg

Once these packages are downloaded, open an administrative shell and execute the following command:

 choco install -y -s <PATH\TO\DOWNLOADS\> asio eigen tinyxml-usestl tinyxml2 log4cxx

Please replace <PATH\TO\DOWNLOADS> with the folder you downloaded the packages to.

You must also install some python dependencies for command-line tools:

python -m pip install -U catkin_pkg empy lark-parser opencv-python pyparsing pyyaml setuptools

RQt dependencies

python -m pip install -U pydot PyQt5

SROS2 dependencies

python -m pip install -U lxml

8. Download ROS2

  • Go the releases page: https://github.com/ros2/ros2/releases

  • Download the latest package for Windows, e.g., ros2-package-windows-AMD64.zip.

    • Notes:

      • there may be more than one binary download option which might cause the file name to differ.

      • [ROS Bouncy only] To download the ROS 2 debug libraries you’ll need to download ros2-bouncy-windows-Debug-AMD64.zip

  • Unpack the zip file somewhere (we’ll assume C:\dev\ros2).

    • Note (Ardent and earlier): There seems to be an issue where extracting the zip file with 7zip causes RViz to crash on startup. Extract the zip file using the Windows explorer to prevent this.

9. Set ROS2 operating environment

Start a command shell and source the ROS 2 setup file to set up the workspace:

call C:\dev\ros2\local_setup.bat

For ROS 2 releases up to and including Ardent, if you downloaded a release with OpenSplice support you must additionally source the OpenSplice setup file manually (this is done automatically for ROS 2 releases later than Ardent; this step can be skipped). It is normal that the previous command, if nothing else went wrong, outputs “The system cannot find the path specified.” exactly once. Only do this step after you have sourced the ROS 2 setup file:

call "C:\opensplice69\HDE\x86_64.win64\release.bat"

 10. Demo test run

In a command shell, set up the ROS 2 environment as described above and then run a talker:

ros2 run demo_nodes_cpp talker

Start another command shell and run a listener:

ros2 run demo_nodes_py listener

You should see the talker saying that it’s Publishing messages and the listener saying heardthose messages. Hooray!

If you have installed support for an optional vendor, see this page for details on how to use that vendor.

Troubleshooting

  • If at one point your example would not start because of missing dll’s, please verify that all libraries from external dependencies such as OpenCV are located inside your PATH variable.

  • If you forget to call the local_setup.bat file from your terminal, the demo programs will most likely crash immediately.

Build your own packages

If you would like to build your own packages, refer to the tutorial "Using Colcon to build packages".

Guess you like

Origin www.cnblogs.com/flyinggod/p/11370057.html