在 VisionFive2 上体验 ROS2 humble
一、系统准备
参考 在 VisionFive2 上安装 ROS2 humble 安装并配置 ROS2 humble
确保 ros2 --help 命令可以得到以下输出
[openeuler@openEuler-riscv64 ~]$ ros2 --help
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:
bag Various rosbag related sub-commands
daemon Various daemon related sub-commands
Call `ros2 <command> -h` for more detailed usage.
二、基础命令测试
-
ros2 pkg
执行 ros2 pkg executables turtlesim ,输出如下
[openeuler@openEuler-riscv64 ~]$ ros2 pkg executables turtlesim
turtlesim draw_square
turtlesim mimic
turtlesim turtle_teleop_key
turtlesim turtlesim_node
执行 ros2 pkg list ,输出如下
[openeuler@openEuler-riscv64 ~]$ ros2 pkg list
action_msgs
ament_cmake
ament_cmake_core
ament_cmake_export_definitions
ament_cmake_export_dependencies
ament_cmake_export_include_directories
ament_cmake_export_interfaces
ament_cmake_export_libraries
ament_cmake_export_link_flags
ament_cmake_export_targets
ament_cmake_gen_version_h
ament_cmake_gmock
ament_cmake_gtest
ament_cmake_include_directories
ament_cmake_libraries
ament_cmake_pytest
…………
执行 ros2 pkg prefix turtlesim ,输出如下
[openeuler@openEuler-riscv64 ~]$ ros2 pkg prefix turtlesim
/opt/ros/humble
-
ros2 topic
执行 ros2 topic list ,输出如下
[openeuler@openEuler-riscv64 ~]$ ros2 topic list
/parameter_events
/rosout
执行 ros2 topic info /rosout ,输出如下
[openeuler@openEuler-riscv64 ~]$ ros2 topic info /rosout
Type: rcl_interfaces/msg/Log
Publisher count: 1
Subscription count: 0
-
ros2 node
分别执行命令 ros2 run demo_nodes_cpp talker , ros2 node list ,输出如图
分别执行命令 ros2 run demo_nodes_cpp talker , ros2 node info /talker ,输出如图
-
ros2 service
分别执行命令 ros2 run demo_nodes_cpp talker , ros2 service list ,输出如图
三、通信测试
topic 通信
分别执行 ros2 run demo_nodes_cpp talker 和 ros2 run demo_nodes_cpp listener ,输出如图
分别执行命令 ros2 topic pub -r 1 /chatter std_msgs/msg/String "data: Hello VisionFive2" ,ros2 run demo_nodes_cpp listener ,输出如下
service 通信
分别执行 ros2 run demo_nodes_cpp add_two_ints_server 和 ros2 run demo_nodes_cpp add_two_ints_client ,输出如图
四、跑个小海龟
跑了一下小海龟和 rqt,由于需要图形界面支持,为了方便录制这儿使用了 ssh 进行 X11 转发,然后录制
分别在两个终端执行 ros2 run turtlesim turtlesim_node 和 ros2 run turtlesim turtle_teleop_key 可以看到小海龟窗口弹出,并且可在终端控制
新打开一个新终端,执行 ros2 run rqt_service_caller rqt_service_caller ,可以更改小海龟的轨迹参数。
详情请查看视频
在 visionfive2 上测试 ros2 humble
|