当前位置:网站首页>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 threading
from rclpy.node import Node
class RotateWheelNode(Node):
def __init__(self):
# Create a Rate And thread
self.pub_rate = self.create_rate(5) #5Hz
# Create thread
self.thread_ = threading.Thread(target=self._thread_pub)
self.thread_.start()
def _thread_pub(self):
while rclpy.ok():
# Do something , Use rate Ensure the cycle frequency
self.pub_rate.sleep()
边栏推荐
- (16) ADC conversion experiment
- Report on research and investment prospects of UHMWPE industry in China (2022 Edition)
- Intel's open source deep learning tool library openvino will increase cooperation with local software and hardware parties and continue to open
- Penetration practice vulnhub range Tornado
- L'ouverture d'un compte d'actions en ligne est - elle sécurisée? Fiable?
- C language implementation of sum of two numbers [easy to understand]
- In depth Research Report on China's disposable sanitary products production equipment industry (2022 Edition)
- PHP implements sensitive word filtering system "suggestions collection"
- ZABBIX alarm execute remote command
- Oracle TRUNC function processing date format
猜你喜欢
Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)
Kernel stray cat stray dog pet adoption platform H5 source code
People help ant help task platform repair source code
How to write good code - Defensive Programming Guide
Rotation order and universal lock of unity panel
Oom caused by improper use of multithreading
Why should you consider using prism
Euler function: find the number of numbers less than or equal to N and coprime with n
June issue | antdb database participated in the preparation of the "Database Development Research Report" and appeared on the list of information technology and entrepreneurship industries
Data warehouse (3) star model and dimension modeling of data warehouse modeling
随机推荐
PIP version problems: PIP problems still occur when installing akshare and using Tsinghua source and Douban source
Oracle TRUNC function processing date format
Integer array merge [JS]
golang中的select详解
Sword finger offer II 105 Maximum area of the island
DNS
網上股票開戶安全嗎?是否可靠?
New patent applications and transfers
MySQL + JSON = King fried
Redis master-slave realizes 10 second check and recovery
From comedians to NBA Zhan Huang, check the encrypted advertisements during this super bowl
transform. Forward and vector3 Differences in the use of forward
The latest software scheme of the intelligent information management system of the armed police force
In depth evaluation and development trend prediction report of China's ice cream market (2022 Edition)
[beauty detection artifact] come on, please show your unique skill (is this beauty worthy of the audience?)
At present, where is the most formal and safe account opening for futures speculation? How to open a futures account?
Length of learning and changing
ACL 2022 | decomposed meta learning small sample named entity recognition
Product service, operation characteristics
Penetration practice vulnhub range Nemesis