You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide is about how to setup a development environment for ROS 2 on Windows.
12
+
This page explains how to setup a development environment for ROS 2 on Windows.
13
13
14
14
System requirements
15
15
-------------------
16
16
17
17
Only Windows 10 is supported.
18
18
19
+
.. warning::
20
+
21
+
We recommend using a clean Windows environment for the build, such as a fresh install, Docker container, or Virtual Machine. This is because existing software, such as other Python versions, can pollute the build configuration and cause compilation errors.
22
+
19
23
Language support
20
24
^^^^^^^^^^^^^^^^
21
25
22
26
Make sure you have a locale which supports ``UTF-8``.
23
27
For example, for a Chinese-language Windows 10 installation, you may need to install an `English language pack <https://support.microsoft.com/en-us/windows/language-packs-for-windows-a5094319-a92d-18de-5b53-1cfc697cfca8>`_.
This location will contain both the installed binary packages, plus the ROS 2 installation itself.
26
33
27
-
Install additional prerequisites from Chocolatey
28
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34
+
Start a powershell session (usually by clicking on the start menu, then typing ``powershell``).
29
35
30
-
.. code-block:: bash
36
+
Then create a directory to store the installation.
37
+
Because of Windows path-length limitations, this should be as short as possible.
38
+
We'll use ``C:\dev`` for the rest of these instructions.
31
39
32
-
choco install -y cppcheck curl git winflexbison3
40
+
.. code-block:: console
33
41
34
-
You will need to append the Git cmd folder ``C:\Program Files\Git\cmd`` to the PATH (you can do this by clicking the Windows icon, typing "Environment Variables", then clicking on "Edit the system environment variables".
35
-
In the resulting dialog, click "Environment Variables", the click "Path" on the bottom pane, then click "Edit" and add the path).
42
+
$ md C:\dev
36
43
37
-
Install Python prerequisites
38
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
+
Increase the Windows maximum path length
45
+
----------------------------------------
46
+
47
+
By default, Windows is restricted to a maximum path length (MAX_PATH) of 260 characters.
48
+
The ROS 2 build will use significantly longer path lengths, so we will increase that.
49
+
Using the powershell session you started above, run the following:
You can read more about this limitation in `Microsoft's documentation <https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry>`__.
56
+
57
+
58
+
Install prerequisites
59
+
---------------------
60
+
61
+
Install MSVC
62
+
^^^^^^^^^^^^
63
+
64
+
In order to compile the ROS 2 code, the MSVC compiler must be installed.
65
+
Currently it is recommended to use MSVC 2019.
66
+
67
+
Continue using the previous powershell session, and run the following command to download it:
This is required in every command prompt you open to set up paths to the dependencies:
127
+
128
+
.. code-block:: console
129
+
130
+
$ cd C:\dev
131
+
$ pixi shell
132
+
49
133
Get ROS 2 code
50
134
^^^^^^^^^^^^^^
51
135
52
136
Now that we have the development tools we can get the ROS 2 source code.
53
137
54
-
First setup a development folder, for example ``C:\{DISTRO}``:
55
-
56
-
.. note::
57
-
58
-
It is very important that the chosen path is short, due to the short default Windows path limits (260 characters).
59
-
To allow longer paths, see `maximum-file-path-limitation <https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry>`__.
138
+
Setup a development folder, for example ``C:\dev\{DISTRO}``:
60
139
61
140
.. code-block:: console
62
141
63
-
$ md \{DISTRO}\src
64
-
$ cd \{DISTRO}
142
+
$ md C:\dev\{DISTRO}\src
143
+
$ cd C:\dev\{DISTRO}
65
144
66
145
Get the ``ros2.repos`` file which defines the repositories to clone from:
67
146
@@ -80,8 +159,6 @@ Build the code in the workspace
80
159
81
160
.. _windows-dev-build-ros2:
82
161
83
-
To build ROS 2 you will need a Visual Studio Command Prompt ("x64 Native Tools Command Prompt for VS 2019") running as Administrator.
84
-
85
162
To build the ``\{DISTRO}`` folder tree:
86
163
87
164
.. code-block:: console
@@ -93,23 +170,33 @@ To build the ``\{DISTRO}`` folder tree:
93
170
We're using ``--merge-install`` here to avoid a ``PATH`` variable that is too long at the end of the build.
94
171
If you're adapting these instructions to build a smaller workspace then you might be able to use the default behavior which is isolated install, i.e. where each package is installed to a different folder.
95
172
96
-
.. note::
97
-
98
-
If you are doing a debug build use ``python_d path\to\colcon_executable`` ``colcon``.
99
-
See `Extra stuff for debug mode`_ for more info on running Python code in debug builds on Windows.
100
-
101
173
.. note::
102
174
103
175
Source installation can take a long time given the large number of packages being pulled into the workspace.
104
176
105
177
Setup environment
106
178
-----------------
107
179
108
-
Start a command shell and source the ROS 2 setup file to set up the workspace:
180
+
Start a new Windows command prompt, which will be used in the examples.
181
+
182
+
Source the pixi environment
183
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
184
+
185
+
This is required in every command prompt you open to set up paths to the dependencies:
109
186
110
187
.. code-block:: console
111
188
112
-
$ call C:\{DISTRO}\install\local_setup.bat
189
+
$ cd C:\dev
190
+
$ pixi shell
191
+
192
+
Source the ROS 2 environment
193
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
194
+
195
+
This is required in every command prompt you open to setup the ROS 2 workspace:
196
+
197
+
.. code-block:: console
198
+
199
+
$ call C:\dev\{DISTRO}\install\local_setup.bat
113
200
114
201
This will automatically set up the environment for any DDS vendors that support was built for.
115
202
@@ -144,7 +231,7 @@ Then, run a C++ ``talker``\ :
144
231
$ call install\local_setup.bat
145
232
$ ros2 run demo_nodes_cpp talker
146
233
147
-
In a separate shell you can do the same, but instead run a Python ``listener``\ :
234
+
In a separate command prompt you can do the same, but instead run a Python ``listener``\ :
148
235
149
236
.. code-block:: console
150
237
@@ -164,84 +251,6 @@ Next steps
164
251
165
252
Continue with the :doc:`tutorials and demos <../../Tutorials>` to configure your environment, create your own workspace and packages, and learn ROS 2 core concepts.
166
253
167
-
Extra stuff for Debug mode
168
-
--------------------------
169
-
170
-
If you want to be able to run all the tests in Debug mode, you'll need to install a few more things:
171
-
172
-
* To be able to extract the Python source tarball, you can use PeaZip:
173
-
174
-
.. code-block:: bash
175
-
176
-
choco install -y peazip
177
-
178
-
* You'll also need SVN, since some of the Python source-build dependencies are checked out via SVN:
179
-
180
-
.. code-block:: bash
181
-
182
-
choco install -y svn hg
183
-
184
-
* You'll need to quit and restart the command prompt after installing the above.
185
-
* Get and extract the Python 3.8.3 source from the ``tgz``:
0 commit comments