当前位置:网站首页>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()
边栏推荐
- Research Report on development prediction and investment direction of nylon filament sewing thread in China (2022 Edition)
- 聊聊项目经理最爱使用的工具
- 网上股票开户安全吗?是否可靠?
- Equipment simulation and deduction training system software
- What are the six steps of the software development process? How to draw software development flow chart?
- Fix the black screen caused by iPhone system failure
- Glidefast consulting was selected as the elite partner of servicenow in 2022
- People help ant help task platform repair source code
- Maizeer: the two batches of products reported by the media have been taken off the shelves and sealed, and consumer appeals are accepted
- DNS
猜你喜欢

Technical secrets of ByteDance data platform: implementation and optimization of complex query based on Clickhouse

How to use JMeter function and mockjs function in metersphere interface test

Apache iceberg source code analysis: schema evolution

Cassette helicopter and alternating electric field magnetic manometer DPC

SQL injection vulnerability (MySQL and MSSQL features)

Kia recalls some K3 new energy with potential safety hazards

Leetcode 1380. Lucky numbers in the matrix (save the minimum number of each row and the maximum number of each column)

Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target

Petrv2: a unified framework for 3D perception of multi camera images

Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"
随机推荐
Check log4j problems using stain analysis
The new server is packaged with the source code of H5 mall with an operation level value of several thousand
DNS
Good looking UI mall source code has been scanned, no back door, no encryption
股票万1免5证券开户是合理安全的吗,怎么讲
At present, where is the most formal and safe account opening for futures speculation? How to open a futures account?
Apk signature process introduction [easy to understand]
Work and leisure suggestions of old programmers
Oom caused by improper use of multithreading
Depth first traversal and breadth first traversal [easy to understand]
(十七)DAC转换实验
Petrv2: a unified framework for 3D perception of multi camera images
期货先锋这个软件正规吗安全吗?选择哪家期货公司更安全?
. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes
Data warehouse (3) star model and dimension modeling of data warehouse modeling
Radhat builds intranet Yum source server
【Try to Hack】vulnhub DC4
Is it safe to open an ETF account online? What are the steps?
L'ouverture d'un compte d'actions en ligne est - elle sécurisée? Fiable?
Is Huishang futures a regular futures platform? Is it safe to open an account in Huishang futures?