系统安装路径: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
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?