当前位置:网站首页>When the fixed frequency artifact falls in love with multithreading | ros2 fixed frequency topic release demo
When the fixed frequency artifact falls in love with multithreading | ros2 fixed frequency topic release demo
2022-07-01 18:02:00 【Fish flavored ROS】
We want to publish topics at a fixed rate , May adopt ROS2 Timing artifact in Rate, Unclear Rate You can read this article of Xiaoyu :ROS Can you use the fixed frequency artifact in
In order to be able to recycle all the time rate, We open a separate thread for publishing joint_states Topic data , stay ROS2 In the program, the routine of opening a thread separately for topic publishing is as follows :
import threadingfrom rclpy.node import Nodeclass RotateWheelNode(Node):def __init__(self):# Create a Rate And threadself.pub_rate = self.create_rate(5) #5Hz# Create threadself.thread_ = threading.Thread(target=self._thread_pub)self.thread_.start()def _thread_pub(self):while rclpy.ok():# Do something , Use rate Ensure the cycle frequencyself.pub_rate.sleep()
边栏推荐
- Equipment simulation and deduction training system software
- Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target
- Cassette helicopter and alternating electric field magnetic manometer DPC
- Nearly 60% of the employees strongly support Ctrip's "3+2" working mode, and work at home for two days a week
- Extract the compressed package file and retrieve the password
- 2022 Heilongjiang latest fire protection facility operator simulation test question bank and answers
- China biodegradable plastics market forecast and investment strategy report (2022 Edition)
- SQL injection vulnerability (MySQL and MSSQL features)
- Intel's open source deep learning tool library openvino will increase cooperation with local software and hardware parties and continue to open
- Yuancosmos game farmersworld farmers world - core content of the second conference in China!
猜你喜欢

. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes

What are the legal risks of NFT brought by stars such as curry and O'Neill?

2022 Heilongjiang latest fire protection facility operator simulation test question bank and answers

An example of data analysis of an old swatch and an old hard disk disassembly and assembly combined with the sensor of an electromagnetic press

How to retrieve the password for opening Excel files
![Integer array merge [JS]](/img/0d/70535e0eb1c299bda25159b58c70d7.png)
Integer array merge [JS]

Apache iceberg source code analysis: schema evolution

Good looking UI mall source code has been scanned, no back door, no encryption

Euler function: find the number of numbers less than or equal to N and coprime with n

DNS
随机推荐
Work and leisure suggestions of old programmers
Nielseniq found that 60% of the re launched products had poor returns
Openlayers customize bubble boxes and navigate to bubble boxes
[2. Basics of Delphi grammar] 4 Object Pascal operators and expressions
DRF --- response rewrite
Relationship between sensor size, pixel, dpi resolution, inch and millimeter
Yuancosmos game farmersworld farmers world - core content of the second conference in China!
反射型XSS漏洞
提交review时ReviewBoard出现500错误解决方法
Glidefast consulting was selected as the elite partner of servicenow in 2022
Rotation order and universal lock of unity panel
MFC obtains local IP (used more in network communication)
China PBAT resin Market Forecast and Strategic Research Report (2022 Edition)
RadHat搭建内网YUM源服务器
Yolov5 practice: teach object detection by hand
Detailed explanation of string's trim() and substring()
Review Net 20th anniversary development and 51aspx growth
Integer array merge [JS]
Unity3d extended toolbar
ISO 27001 Information Security Management System Certification