System | Version |
---|---|
OS | Win11 |
ROS | RoboStack/ros-humble |
System | Version |
---|---|
OS | Win10 |
ROS | Iron Official |
colcon build --merge-install --packages-select package_name
call install/setup.bat
Note
RoboStack-ros-humble目前不支持Powershell。
conda activate ros_env
/turtle1/cmd_vel
topic:控制小乌龟的移动,其消息包含线性速度和角速度cd\
ros2_ws
directorycd \ros2_ws
launch_ws
directorycd "D:\launch\launch_ws"
call install/setup.bat
cd \ros2_ws && call install/setup.bat
curl
set PATH=D:\Professional\ROS2\curl-8.2.1_5-win64-mingw\bin;%PATH%
ros2 run turtlesim turtle_teleop_key
curl -sk https://raw.githubusercontent.com/ros2/examples/iron/rclcpp/topics/minimal_publisher/member_function.cpp -o publisher_member_function.cpp
curl
是一个命令行工具,用于从服务器获取或发送数据;-s
选项表示静默模式,不显示进度条或错误消息。Note:所以在调试时,需要去掉
-s
选项。
NewBing:
Roll, Pitch, Yaw是三个英语单词,它们分别表示绕x轴、y轴和z轴的旋转角度。
Roll是指绕x轴的旋转,也就是翻滚。例如,飞机在空中做一个侧翻动作,就是改变了它的roll角度;
Pitch是指绕y轴的旋转,也就是俯仰。例如,飞机在起飞或降落时,调整了它的pitch角度;
Yaw是指绕z轴的旋转,也就是偏航。例如,飞机在转向时,改变了它的yaw角度。
这里我们可以想象右手手心向上拖着一架飞机,向前手指伸展是X轴正方向,右手大拇指是Y轴正方向;
colcon
to build packages进行到 [Build the workspace] 时遇到问题,无法正常进行构建,部分输出信息如下:
# Win10, Iron Official:
...
---
Finished <<< examples_rclpy_minimal_service [10.4s]
Finished <<< examples_rclcpp_minimal_service [20.2s]
Finished <<< examples_rclcpp_minimal_client [20.7s]
Finished <<< examples_rclcpp_async_client [21.2s]
Finished <<< examples_rclcpp_multithreaded_executor [20.3s]
--- stderr: examples_rclpy_pointcloud_publisher
C:\Python38\lib\site-packages\setuptools\command\easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
C:\Python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
---
Finished <<< examples_rclpy_pointcloud_publisher [5.86s]
--- stderr: launch_testing_examples
C:\Python38\lib\site-packages\setuptools\command\easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
C:\Python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
---
Finished <<< launch_testing_examples [5.11s]
Finished <<< examples_rclcpp_minimal_timer [25.4s]
Finished <<< examples_rclcpp_minimal_action_server [27.4s]
Finished <<< examples_rclcpp_cbg_executor [36.9s]
Finished <<< examples_rclcpp_minimal_composition [37.6s]
Finished <<< examples_rclcpp_minimal_action_client [39.6s]
Finished <<< examples_rclcpp_minimal_publisher [47.0s]
--- stderr: examples_rclcpp_minimal_subscriber
CMake Error at ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:267 (message):
ament_cmake_symlink_install_targets() can't find
'D:/dev/ros2_ws/build/examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib'
Call Stack (most recent call first):
ament_cmake_symlink_install_targets_3_Release.cmake:1 (ament_cmake_symlink_install_targets)
ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:323 (include)
cmake_install.cmake:36 (include)
---
Failed <<< examples_rclcpp_minimal_subscriber [1min 16s, exited with code 1]
Aborted <<< examples_rclcpp_wait_set [1min 23s]
Summary: 20 packages finished [1min 25s]
1 package failed: examples_rclcpp_minimal_subscriber
1 package aborted: examples_rclcpp_wait_set
11 packages had stderr output: examples_rclcpp_minimal_subscriber examples_rclpy_executors examples_rclpy_guard_conditions examples_rclpy_minimal_action_client examples_rclpy_minimal_action_server examples_rclpy_minimal_client examples_rclpy_minimal_publisher examples_rclpy_minimal_service examples_rclpy_minimal_subscriber examples_rclpy_pointcloud_publisher launch_testing_examples
WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)
D:\dev\ros2_ws>
Note:我们发现这个问题在Win11&10系统上都会出现,这一点说明ROS2官方对Windows的支持十分有限;我们在ros2/examples的github上咨询了开发者是否会修复这个问题,不过目前没有人回复;
cd "D:\ros2_ws\src\cpp_pubsub\src"
【3.2 Change via a launch file】说到使用launch方式启动节点
ros2 launch python_parameters python_parameters_launch.py
不过,运行后并没有正常看到输出,终端显示如下:
D:\ros2_ws>ros2 launch python_parameters python_parameters_launch.py
[INFO] [launch]: All log files can be found below C:\Users\songyuc\.ros\log\2023-09-01-20-51-44-132293-DESKTOP-OB91EPG-8740
[INFO] [launch]: Default logging verbosity is set to INFO
Launching node...
[INFO] [minimal_param_node.EXE-1]: process started with pid [8680]
_
# 光标在闪烁,但是终端就卡在这里了,过了10分钟左右,也一直没有输出任何信息...
而教程里面说到应该会输出类似“[INFO] [custom_minimal_param_node]: Hello earth!”的信息……
总结:此教程无法复现;
目前rosdep没有对Windows系统提供支持;
在启动示例程序时,直接执行
ros2 launch launch_tutorial example_event_handlers_launch.py turtlesim_ns:=‘turtlesim3’ use_provided_red:=‘True’ new_background_r:=200
CMD终端会报错:
D:\launch\launch_ws>call install/setup.bat
“[rti_connext_dds_cmake_module][warning] RTI Connext DDS environment script not found (\resource\scripts\rtisetenv_x64Win64VS2017.bat). RTI Connext DDS will not be available at runtime, unless you already configured PATH manually.”
“[rti_connext_dds_cmake_module][warning] RTI Connext DDS environment script not found (\resource\scripts\rtisetenv_x64Win64VS2017.bat). RTI Connext DDS will not be available at runtime, unless you already configured PATH manually.”D:\launch\launch_ws>ros2 launch launch_tutorial example_event_handlers_launch.py turtlesim_ns:=‘turtlesim3’ use_provided_red:=‘True’ new_background_r:=200
[INFO] [launch]: All log files can be found below C:\Users\songyuc.ros\log\2023-09-09-22-27-39-222206-DESKTOP-OB91EPG-5328
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch_ros.actions.node]: Error while expanding or validating node name or namespace for ‘package=turtlesim, executable=turtlesim_node, name=sim, namespace=’:
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Invalid namespace: namespace must not contain characters other than alphanumerics, ‘_’, or ‘/’:
‘/‘turtlesim3’’
^
咨询了一下ChatGPT
ChatGPT:错误信息表明
turtlesim_ns
参数的值'turtlesim3'
是无效的。这可能是因为你使用了错误的引号。在Windows命令行中,应该使用双引号而不是单引号。
修改后适用于Win10的命令如下:
ros2 launch launch_tutorial example_event_handlers_launch.py turtlesim_ns:="turtlesim3" use_provided_red:="True" new_background_r:=200
cd "D:\launch\launch_ws"
ros2 pkg create --build-type ament_python --node-name my_node launch_tutorial --license Apache-2.0
turtlesim_world_3_launch.py
完整代码”这里我们截图来说明这个问题,
可以看到,这里用了一个模糊的描述词“similar”,我们想请问一下,什么叫做“similar”呢?
这里我们咨询了Claude和ChatGPT,两位教授竟然给出了两份差异明显的代码,我们不太懂官方团队竟然还说什么“What is in the tutorial is the complete project code.”;我们感觉 Ros2_documentation 的团队在编写教程时缺乏审慎的思考,which is frustrating.
colcon build --merge-install
call install/setup.bat
tf2
(revised)cd "D:\ros2_ws"
src\
colcon build --merge-install
接下来使用Rviz查看turble的移动;
这时,如果直接运行教程给出的命令ros2 run rviz2 rviz2 -d $(ros2 pkg prefix --share turtle_tf2_py)/rviz/turtle_rviz.rviz
则会有问题:D:\ros2_ws>ros2 run rviz2 rviz2 -d $(ros2 pkg prefix --share turtle_tf2_py)/rviz/turtle_rviz.rviz Unknown option 'share'. [ros2run]: Process exited with failure 1
我们咨询了 Poe-GPT4:
- “根据你提供的错误信息,看起来问题可能在于你在Windows系统上运行这个命令,而这个命令中的$(…)语法是Unix shell(比如bash或者zsh)中的命令替换语法,Windows的命令行解析器可能不能正确处理这种语法。
- 解决这个问题,你需要找到正确的路径,然后直接在命令行中指定。”
因此,我们首先需要获得turtle_tf2_py
包的绝对路径;
turtle_tf2_py
ros2 pkg prefix turtle_tf2_py
ros2 run rviz2 rviz2 -d D:\ros2_ws\install\rviz\turtle_rviz.rviz
可以按照以下步骤更改Fixed Frame:
D:\Professional\ROS2\curl-8.2.1_5-win64-mingw\bin\curl.exe -k https://raw.githubusercontent.com/ros/geometry_tutorials/ros2/turtle_tf2_cpp/src/static_turtle_tf2_broadcaster.cpp -o static_turtle_tf2_broadcaster.cpp
turtle_tf2_demo_launch.py
在运行turtle_tf2_demo_launch.py
启动文件时,如果以普通方式开启终端会提示:
D:\ros2_ws>ros2 launch learning_tf2_py turtle_tf2_demo_launch.py
C:\dev\ros2_iron\Lib\site-packages\launch\logging\__init__.py:149: UserWarning: Cannot create a
symlink to latest log directory: [WinError 1314] 客户端没有所需的特权。: 'C:\\Users\\songyuc\\.ros\\log
\\2023-10-02-16-49-31-697632-DESKTOP-OB91EPG-15356' -> 'C:\\Users\\songyuc\\.ros\\log\\latest'
warnings.warn(
# ...
这里为了消除这个警告,我们以管理员身份运行新的终端来运行launch文件;
Note:
这里launch文件会启动一个turtlesim程序,不过由于这里使用管理员权限启动的turtlesim程序,所以接下来如果要用turtle_teleop_key
控制turtle的移动,其控制台也需要以管理员身份运行,否则会出现“键盘按键而turtle没有任何反应”的情况。
src\
cd "D:\ros2_ws\src\learning_tf2_cpp\src"
curl -k https://raw.githubusercontent.com/ros/geometry_tutorials/ros2/turtle_tf2_cpp/src/turtle_tf2_broadcaster.cpp -o turtle_tf2_broadcaster.cpp
curl -k https://raw.githubusercontent.com/ros/geometry_tutorials/ros2/turtle_tf2_py/turtle_tf2_py/turtle_tf2_listener.py -o turtle_tf2_listener.py
src\
cd "D:\ros2_ws\src\learning_tf2_cpp\src"
在【1 Update the listener node】提到,需要使用如下代码:
不过,之前在下载的代码中,并没有【now】这个变量;
于是,我们认为这是教程没有及时更新的问题,于是在[ros2/ros2_documentation]上提出了issue,目前在等待官方团队的回复;
colcon build --merge-install --packages-select learning_tf2_cpp
cd "D:\ros2_ws"
colcon build --merge-install --packages-select learning_tf2_py
call install/setup.bat
colcon build --merge-install --packages-select learning_tf2_cpp
在复现到【1 Setting and starting the example】时,教程提到:
Don’t forget to add the turtle_tf2_listener_debug executable to the CMakeLists.txt and build the package.
不过,在修改了CMakeLists.txt
之后,我们进行了Building,不过出现如下错误:
D:\ros2_ws>colcon build --merge-install --packages-select learning_tf2_cpp
Starting >>> learning_tf2_cpp
Failed <<< learning_tf2_cpp [9.11s, exited with code 1]
Summary: 0 packages finished [9.41s]
1 package failed: learning_tf2_cpp
WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)
于是,我们在【ros2/ros2_documentation】上提出了issue,暂时没有得到回复;
tf2_ros::MessageFilter
(revised)turtle_tf2_message_filter.cpp
curl -sk https://raw.githubusercontent.com/ros/geometry_tutorials/ros2/turtle_tf2_cpp/src/turtle_tf2_message_filter.cpp -o turtle_tf2_message_filter.cpp
Note:此项目会用到
turtle_tf2_py
包,在Windows系统中需要手动进行编译。
colcon build --merge-install --packages-select turtle_tf2_py learning_tf2_cpp
Skip
echoing the topic因为执行“ros2 topic echo /turtle3/turtle_point_stamped”命令之后,后面的 ros2-run命令就无法输出信息;
Note:
由于Win10和Linux在系统级别的进程和线程同步机制方面存在差异,这可能影响ROS2中消息传递的时序和同步。具体来说,当在Win10上执行ros2-topic-echo和ros2-run命令时,可能由于系统的同步或调度机制的差异性,导致ros2的消息传递通道被阻塞,无法正常进行通信,从而导致在终端中没有输出。这种问题可能是与操作系统底层的进程调度、消息队列处理或网络通信机制有关。
教程在【3 Run】中提到需要分别执行“ros2 topic echo /turtle3/turtle_point_stamped”和“ros2 run learning_tf2_cpp turtle_tf2_message_filter”这两个命令;不过,我们发现一个奇怪的现象:
尽量避免在运行ROS2项目时,设置“HTTP_PROXY / HTTPS_PROXY”环境变量;
需要编译geometry_tutorials
仓库;
ros2 pkg prefix --share urdf_tutorial
/urdf/01-myfirst.urdf”命令报错ros2 pkg list | findstr joint_state_publisher
如果已安装joint_state_publisher
包,命令将返回包的名称;如果未安装,命令不会返回任何内容。
git clone https://github.com/ros/urdf_tutorial.git -b ros2
git clone https://github.com/ros/urdf_launch.git -b main
cd "D:\second_ros2_ws"
colcon build --merge-install
call install/setup.bat
share/urdf_tutorial/urdf
directory of your ROS 2 installation.”Bard提到 URDF file 应该是在【ROS 2 installation】目录中,但是这一点很奇怪,在项目开发的时候,如何保证将 URDF file 放在ROS2安装目录中呢?这一点是很奇怪的,无法进行确认。
如果你已经确定了文件存在并且路径也正确,那么这里可能存在一个bug,即该教程没有考虑到Windows系统的文件路径格式差异。为了调试这个问题,请在你的
display.launch.py
文件中添加以下两行代码:from rosidl_runtime_cpp import get_message_type_support_handle print(get_message_type_support_handle('urdf_msgs/msg/Urdf').fullname)
然后重新运行
ros2 launch urdf_tutorial display.launch.py model:=D:/second_ros2_ws/src/urdf_tutorial/urdf/01-myfirst.urdf
并查看打印出的内容。这可能会告诉你Urdf消息类型支持是否被正确加载。如果返回的是一个非None值,则说明Urdf消息类型支持已经被正确加载。如果没有返回任何内容,那么你需要确认你已经安装了所有的依赖项并进行了构建。如果是None,则可能是未正确安装或配置Urdf的消息类型支持。
我感觉,通义的意思是教程给出的源代码有问题;我们觉得,这部分还是需要ROS2的官方团队进行调试,我们已经在【ros2/ros2_documentation】的GitHub主页上提出了issue,不过目前没有得到回复;
看起来你在运行ROS2命令时遇到了一些问题。错误信息显示
ros2: error: unrecognized arguments: --share urdf_tutorial'/urdf/01-myfirst.urdf
,这表明ros2
命令不认可--share
参数。
首先,请确认你正在使用的ROS2版本是否支持--share
参数。你可以通过运行ros2 --help
来查看所有可用的命令行选项。
其次,对于指定模型路径的问题,你应该使用绝对路径而不是相对路径。在你的情况下,你的模型文件01-myfirst.urdf
位于D:\second_ros2_ws\urdf_tutorial\urdf
目录下,所以你应该直接使用这个路径,而不是通过ros2 pkg prefix --share
获取。
所以,你应该这样指定模型路径:ros2 launch urdf_tutorial display.launch.py model:=D:\second_ros2_ws\urdf_tutorial\urdf\01-myfirst.urdf
如果仍然有问题,可能是因为环境变量设置不正确或缺失。根据你提供的错误信息,RTI Connext DDS环境脚本没有找到,这可能会导致一些问题。你需要确保已经正确安装了RTI Connext DDS,并且其相关环境变量已经设置好。具体的安装和设置步骤可能会根据你使用的具体版本和操作系统有所不同。
于是,我们尝试使用ros2 --help
查看参数信息,在终端获得如下提示信息:
D:\second_ros2_ws\src\urdf_tutorial\urdf>ros2 --help
lttng module version >=2.10.7 required, found None
usage: ros2 [-h] [--use-python-default-buffering]
Call `ros2 <command> -h` for more detailed usage. ...
ros2 is an extensible command-line tool for ROS 2.
optional arguments:
-h, --help show this help message and exit
--use-python-default-buffering
Do not force line buffering in stdout and instead use the python default
buffering, which might be affected by PYTHONUNBUFFERED/-u and depends on
whatever stdout is interactive or not
Commands:
action Various action related sub-commands
bag Various rosbag related sub-commands
component Various component related sub-commands
daemon Various daemon related sub-commands
doctor Check ROS setup and other potential issues
interface Show information about ROS interfaces
launch Run a launch file
lifecycle Various lifecycle related sub-commands
multicast Various multicast related sub-commands
node Various node related sub-commands
param Various param related sub-commands
pkg Various package related sub-commands
run Run a package specific executable
security Various security related sub-commands
service Various service related sub-commands
test Run a ROS2 launch test
topic Various topic related sub-commands
trace Trace ROS nodes to get information on their execution
wtf Use `wtf` as alias to `doctor`
Call `ros2 <command> -h` for more detailed usage.
可以看到当前安装的ros2版本并不支持--share
参数,我们继续咨询了文心大模型3.5,
你的问题与代码和程序运行相关。
从你给出的错误信息来看,你遇到的问题是lttng module version >=2.10.7 required, found None
。这表明你的系统需要一个名为lttng的模块,且其版本应大于或等于2.10.7,但当前没有找到这个模块。
LTTng(Linux Trace Toolkit Next Generation)是一个强大的、低开销的、跨平台的开源系统、内核和应用程序的跟踪工具集。你可能需要在你的系统中安装这个工具来满足ROS 2的要求。
对于Windows系统,你可以尝试使用以下命令来安装LTTng:
- 首先,你需要打开“控制面板”并搜索“程序和功能”,然后点击“启用或关闭Windows功能”。
- 在“Windows功能”窗口中,找到并勾选“适用于Linux的Windows子系统”,然后点击“确定”。
- 重新启动电脑后,打开命令提示符并输入以下命令来安装LTTng:
choco install lttng-tools
请注意,这需要你的电脑已经安装了Chocolatey(一个Windows的包管理器)。如果没有,你需要首先安装它。
安装完成后,你应该能够运行ros2
命令了。如果仍然有问题,你可能需要检查你的ROS 2和LTTng的配置是否正确。
终端在输出信息提到“lttng module version >=2.10.7 required, found None”,文心大模型3.5也说到要安装LTTng,但是,他还说要打开“适用于Linux的Windows子系统”,这很奇怪,为什么ROS2需要依赖于WSL呢,无法理解;
当前教程给出命令ros2 launch urdf_tutorial display.launch.py model:=urdf/06-flexible.urdf
来启动可视化程序;不过跟上一个教程的情况类似,无法正常运行;
我们向其发送了终端中的提示信息:
D:\second_ros2_ws\src\urdf_tutorial\urdf>dir
驱动器 D 中的卷是 文档
卷的序列号是 A009-7878
D:\second_ros2_ws\src\urdf_tutorial\urdf 的目录
2023/10/27 15:45 .
2023/10/27 15:45 ..
2023/10/27 15:45 208 01-myfirst.urdf
2023/10/27 15:45 484 02-multipleshapes.urdf
2023/10/27 15:45 561 03-origins.urdf
2023/10/27 15:45 1,156 04-materials.urdf
2023/10/27 15:45 6,146 05-visual.urdf
2023/10/27 15:45 6,616 06-flexible.urdf
2023/10/27 15:45 11,397 07-physics.urdf
2023/10/27 15:45 7,054 08-macroed.urdf.xacro
8 个文件 33,622 字节
2 个目录 467,697,455,104 可用字节
D:\second_ros2_ws\src\urdf_tutorial\urdf>ros2 launch urdf_tutorial display.launch.py model:=urdf/06-flexible.urdf
[INFO] [launch]: All log files can be found below C:\Users\songyuc\.ros\log\2023-11-04-18-18-08-875486-DESKTOP-OB91EPG-26588
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): file not found: [WinError 2] 系 统找不到指定的文件。
而360智脑却表示:
根据你提供的终端提示信息,我们可以看到D:\second_ros2_ws\src\urdf_tutorial\urdf目录中存在多个urdf文件,但是ros2 launch urdf_tutorial display.launch.py模型指定的urdf/06-flexible.urdf文件是否存在以及是否位于正确的位置并未明确说明。因此,无法确定urdf文件是否存在以及是否位于正确的位置。
提示信息中已经明确显示urdf/06-flexible.urdf
文件位于D:\second_ros2_ws\src\urdf_tutorial\urdf
目录中,而它却说“未明确说明”,感觉360智脑的逻辑能力 is very poor;
robot_state_publisher
(revised)call install/setup.bat
我们已经在【ros2/ros2_documentation】上提出了issue,不过暂时没有获得回复;
在Win10上编译出现错误,相关提示信息如下:
D:\second_ros2_ws>colcon build --symlink-install --packages-select urdf_tutorial_r2d2
Starting >>> urdf_tutorial_r2d2
--- stderr: urdf_tutorial_r2d2
C:\Python38\lib\site-packages\setuptools\command\easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
C:\Python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
---
Finished <<< urdf_tutorial_r2d2 [3.30s]
Summary: 1 package finished [3.56s]
1 package had stderr output: urdf_tutorial_r2d2
WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)
于是等待开发者对issue进行回复;
rviz2 -d "D:\second_ros2_ws\install\urdf_tutorial_r2d2\share\urdf_tutorial_r2d2\r2d2.rviz"
cd "D:\ros2_ws"
cd "D:\ros2_ws" && call install/setup.bat
Note:只有执行sourcing操作后再运行
ros2 topic list
,才会看到教程里面展示的四个topics信息。
set ROS_DISCOVERY_SERVER=127.0.0.1:11811
此节中提到,
Tutorial: Run the bash script with the path to
setup.bash
file to source ROS 2 as an argument.
而.bash
文件无法直接在CMD终端中运行;
此外,教程中也没有提供Windows平台脚本;
我们已经提出issue#4037,不过尚未收到回复;
ros2 pkg create --build-type ament_cmake --dependencies rclcpp std_msgs -- sync_async_node_example_cpp
colcon build --merge-install --packages-select sync_async_node_example_cpp
SET FASTRTPS_DEFAULT_PROFILES_FILE=D:\ros2_ws\src\sync_async_node_example_cpp\SyncAsync.xml
call install/setup.bat
ros2 run sync_async_node_example_cpp SyncAsyncWriter
【Revised】:这里提到的“setup
bag”,实际上是“subset
bag”。
Note:此教程的开头提到
subset
bag 来自于教程《Recording and playing back data》。
执行以下命令输出bag中记录的turtle的坐标:
ros2 run bag_reading_cpp simple_bag_reader "D:\ros2_ws\bag_files\subset"
执行完毕后,命令提示符会闪烁,程序不会自动结束,需要手动Ctrl+C
进行结束。
该教程说到,
[1 Install WSL2]: On Windows, WSL (Windows Subsystem for Linux) improves the user experience with ROS 2 compared to native Windows installation, as it runs on a Linux platform. Install WSL with an Ubuntu version which is compatible with your ROS distribution and upgrade to WSL2 following the official Microsoft tutorial.
但是我们的ROS2是原生安装在Windows系统上的,所以我们不会通过WSL2进行安装;
值得注意的是,该教程并没有提供如何在Windows系统上natively安装webots_ros2
package,对此,我们在【cyberbotics/webots_ros2】的GitHub主页上提出issue询问:“webots_ros2是否支持原生Windows安装”;目前还没有收到回复;
关于Gazebo是否原生支持Windows,我们在【ros2/ros2_documentation】上提出了issue;
Gazebo的开发者在issue中回复:
Addisu Z. Taddese: Running Gazebo on Windows is not fully supported yet (see gazebosim/gz-sim#2089)
也就是说,Gazebo目前不支持在Windows上原生运行;
cryptography
的python包才能运行除非“downgrading the python module to “cryptography==38.0.4””,否则在【2. Generate a keystore】中运行命令ros2 security create_keystore demo_keystore
时,Windows-PS终端就会出现如下错误:
D:\dev\ros\sros2_demo>ros2 security create_keystore demo_keystore
Traceback (most recent call last):
File "C:\dev\ros2_iron\Scripts\ros2-script.py", line 33, in <module>
sys.exit(load_entry_point('ros2cli==0.25.2', 'console_scripts', 'ros2')())
File "C:\dev\ros2_iron\Lib\site-packages\ros2cli\cli.py", line 89, in main
rc = extension.main(parser=parser, args=args)
File "C:\dev\ros2_iron\Lib\site-packages\sros2\command\security.py", line 36, in main
return extension.main(args=args)
File "C:\dev\ros2_iron\Lib\site-packages\sros2\verb\create_keystore.py", line 38, in main
sros2.keystore.create_keystore(args.ROOT)
File "C:\dev\ros2_iron\Lib\site-packages\sros2\keystore\_keystore.py", line 82, in create_keystore
_utilities.create_smime_signed_file(
File "C:\dev\ros2_iron\Lib\site-packages\sros2\_utilities.py", line 67, in create_smime_signed_file
f.write(_sign_bytes(cert, private_key, content))
File "C:\dev\ros2_iron\Lib\site-packages\sros2\_utilities.py", line 140, in _sign_bytes
flags = SSLBinding.lib.PKCS7_DETACHED
AttributeError: module 'lib' has no attribute 'PKCS7_DETACHED'
此问题已经在[ros2/sros2#285]中进行了讨论,目前还需要进一步的解决方案。
此教程在开头提到:
“Before proceeding ensure you have completed the Setting up security tutorial.”
但是 Setting up security tutorial 目前在Windows上无法正常复现。
此教程在"validate the S/MIME signature of the governance file"时也会出现如下错误:
D:\dev\ros\sros2_demo\demo_keystore\private>openssl smime -verify -in governance.p7s -CAfile …/public/permissions_ca.cert.pem
Can’t open governance.p7s for reading, No such file or directory
16928:error:02001002:system library:fopen:No such file or directory:crypto\bio\bss_file.c:69:fopen(‘governance.p7s’,‘r’)
16928:error:2006D080:BIO routines:BIO_new_file:no such file:crypto\bio\bss_file.c:76:
经查看工作空间发现,目前D:\dev\ros\sros2_demo\demo_keystore\private
目录中没有governance.p7s
文件;
于是,我们决定先等待教程【Setting up security】以确认其执行效果完成后,再复现此教程;
此教程在开头提到:
“Before proceeding ensure you have completed the Setting up security tutorial.”
但是 Setting up security tutorial 目前在Windows上无法正常复现。
我们在【ros2/ros2_documentation】上针对此问题提出了issue,不过目前没有收到回复;
此教程在开头提到:
“Before proceeding ensure you have completed the Setting up security tutorial.”
但是 Setting up security tutorial 目前在Windows上无法正常复现。
Docker在Windows上是推荐使用 WSL 2 backend 后端,而我们目前的计划尚未包含对WSL2的支持;所以我们准备在需要进行Deployment部署测试的时候再来复现此教程;
查看python路径
Get-Command python | Select-Object -ExpandProperty Path
conda create --name ros_doc python=3.8.3
git clone --branch iron https://github.com/songyuc/ros2_documentation.git
make html
make test
PYTHON := python3
ifeq ($(OS),Windows_NT)
PYTHON := python
endif
BUILD = $(PYTHON) -m sphinx
.. code-block::
Here four spaces are used as the indent.
Note
在reStructuredText中,.. code-block::
指令后的空行通常应该是完全空白的,不包含任何字符,包括空格。这是因为reStructuredText的解析器可能会将包含空格的“空行”视为内容的一部分,从而影响代码块的正确解析。在【ros2/ros2_documentation】的 [Test / build] 中也会引发报错。
.. code-block:: console
后面要加入空行在使用curl.exe
下载文件时,遇到这样的问题:
D:\ros2_ws\src\learning_tf2_py\learning_tf2_py>D:\Professional\ROS2\curl-8.2.1_5-win64-mingw\bin\curl.exe -k
https://raw.githubusercontent.com/ros/geometry_tutorials/ros2/turtle_tf2_py/turtle_tf2_py/
static_turtle_tf2_broadcaster.py -o static_turtle_tf2_broadcaster.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (6) Could not resolve host: raw.githubusercontent.com
根据提示信息可知,终端目前无法正常连接raw.githubusercontent.com
,感觉应该是GFW的原因,所以需要在终端中手动设置代理;
ros2 run turtlesim turtle_teleop_key
之后,在终端中使用方向键操作turtle没有反应所以,在使用管理员模式开启了turtle-sim之后,“turtle_teleop_key”对应的终端也需要以管理员身份运行才能正常使用方向键操作turtle;