系统安装路径:C:\opt\ros\galactic
系统安装参考:ROS2在windows上的安装。
如果你是按ROS官网的办法安装的,路径可能会有所不同,比如按
Installing ROS 2 on Windows — ROS 2 Documentation: Galactic documentation
此时的路径会是,
C:\dev\ros2_galactic
不管你按哪个办法安装,使用起来都差不多。
首先检查一下你是否安装了必要的工具,例如,你可能会碰到这样的报错,
ERROR: 'colcon' is not recognized as an internal or external command,
colcon是依赖python的,那说明你没有安装colcon脚本,或者,你没有在系统路径中添加这个:C:\Python38\Scripts。下面的把一些常用的脚本例在下面,
pip install -U colcon-common-extensions
pip install -U vcstool
貌似各个版本的ROS2文档都有些区别,比如eloquent就单独列出了这些命令,但foxy和galactic就没有,
Building ROS 2 on Windows — ROS 2 Documentation: Eloquent documentation
安装好了之后,你就可以正常使用colcon了,检查一下,
C:>colcon
usage: C:\Python38\Scripts\colcon [-h] [--log-base LOG_BASE] [--log-level LOG_LEVEL]
{build,extension-points,extensions,graph,info,list,metadata,test,test-result,version-check} ...
Error: No verb provided
另外,如果你碰到找不到vc之类的问题,通常是因为没有启动VS2019或VS2017的环境,
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
为了避免这个麻烦,我通常都是直接在VS2019命令窗口"x64 Native Tools Command Prompt for VS 2019" 中进行操作。
什么是colcon?在ROS2中的构建工具是colcon,这非常类似我们在ROS中使用的catkin_make。
下面我们打开一个命令窗口,
call C:\opt\ros\galactic\x64\setup.bat
然后,新建一个路径
~> mkdir examples_ws\src
~> cd examples_ws\src
~examples_ws\src> git clone -b galactic-devel https://github.com/ros2/examples.git
~examples_ws\src> cd ..
~examples_ws> colcon build
另外,我们也可以试一下那个demos
~> mkdir demos_ws\src
~> cd demos_ws\src
~demos_ws\src> git clone -b galactic-devel https://github.com/ros2/demos.git
~demos_ws\src> cd ..
~demos_ws> colcon build
比如我第一次构建的结果是这样的,
D:\ros2prj\demo_ws>colcon build
[0.755s] root DEBUG Using proactor: IocpProactor
Starting >>> action_tutorials_interfaces
Starting >>> dummy_map_server
Starting >>> dummy_sensors
Starting >>> pendulum_msgs
Starting >>> composition
Starting >>> demo_nodes_cpp
Starting >>> demo_nodes_cpp_native
Starting >>> demo_nodes_py
Starting >>> image_tools
Starting >>> intra_process_demo
Starting >>> lifecycle
Starting >>> logging_demo
Finished > quality_of_service_demo_cpp
Finished > quality_of_service_demo_py
Finished > topic_monitor
Finished > topic_statistics_demo
Finished > dummy_robot_bringup
Finished action_tutorials_cpp
Starting >>> action_tutorials_py
Finished
关注
打赏
- 对CSDN网站关于抄袭的投诉的处理建议
- Tesseract OCR训练时碰到的问题和解决方案
- VSCODE在Jetson Nano上打不上断点,无法调试python源码
- ROS2进阶:在windows10上用vs2019编译rviz2
- ROS2 ERROR: OpenGL 1.5 is not supported in GLRenderSystem::initialiseContext at C:\ci\ws\build...
- ROS2 error: can‘t find examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib
- 在windows上安装 chocolatey.1.1.0.nupkg
- Qt开发高级进阶:如何在显示时适合视窗宽度和高度(fitWidth+fitHeight)
- PySpark ERROR: Python in worker has different version 3.9 than that in driver 3.8
- cv2.imshow error: The function is not implemented. Rebuild the library with Windows...