您现在的位置是:首页 >学无止境 >ROS2 python 通信demo网站首页学无止境
ROS2 python 通信demo
简介ROS2 python 通信demo
已创建包:test_kiki
test_kiki/test_kiki文件夹
两个py文件即两个node
talk.py
listen.py
package.xml文件中添加依赖
找到<build_type>ament_python</build_type>
下面添加
<exec_depend>rclpy</exec_depend>
<exec_depend>std_msgs</exec_depend>
即import 的包
setup.py中添加入口
entry_points={
'console_scripts': [
'talk_node = test_kiki.talk:main',
'listen_node = test_kiki.listen:main'
],
},
编译
colcon build
启动
ros2 run test_kiki talk_node
ros2 run test_kiki listen_node
也可以手动发布话题消息
ros2 topic pub /topic std_msgs/msg/String ' hello how are you '
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。





U8W/U8W-Mini使用与常见问题解决
QT多线程的5种用法,通过使用线程解决UI主界面的耗时操作代码,防止界面卡死。...
stm32使用HAL库配置串口中断收发数据(保姆级教程)
分享几个国内免费的ChatGPT镜像网址(亲测有效)
Allegro16.6差分等长设置及走线总结