当前位置:网站首页>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()
边栏推荐
- Fix the problem that easycvr device video cannot be played
- Explain in detail the process of realizing Chinese text classification by CNN
- (十七)DAC转换实验
- Alibaba cloud Li Feifei: China's cloud database has taken the lead in many mainstream technological innovations abroad
- To improve the efficiency of office collaboration, trackup may be the best choice
- SLO is increasingly used to achieve observability | Devops
- 徽商期货是正规期货平台吗?在徽商期货开户安全吗?
- pyqt5中,在控件上画柱状图
- Report on research and investment prospects of UHMWPE industry in China (2022 Edition)
- Is it safe to open a stock account by mobile phone? What do you need to bring with you to open an account?
猜你喜欢
![Htt [ripro network disk link detection plug-in] currently supports four common network disks](/img/e4/c06b94243cdbe391b8b2124ff30789.jpg)
Htt [ripro network disk link detection plug-in] currently supports four common network disks

Kernel stray cat stray dog pet adoption platform H5 source code

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

Penetration practice vulnhub range Nemesis

Wechat applet blind box - docking wechat payment

Encryption and decryption of tinyurl in leetcode

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

Common design parameters of solid rocket motor

Replace UUID, nanoid is faster and safer!
![[C supplement] [string] display the schedule of a month by date](/img/9c/5fcc6bfc8fe0f433c0d1eba92b5c3e.jpg)
[C supplement] [string] display the schedule of a month by date
随机推荐
[splishsplash] about how to receive / display user parameters, MVC mode and genparam on GUI and JSON
Detailed explanation of string's trim() and substring()
手机开户股票开户安全吗?那么开户需要带些什么?
To improve the efficiency of office collaboration, trackup may be the best choice
Penetration practice vulnhub range Tornado
ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing
Is online stock account opening safe? Is it reliable?
China PBAT resin Market Forecast and Strategic Research Report (2022 Edition)
Work and leisure suggestions of old programmers
Subnet division and summary
Research Report on China's enzyme Market Forecast and investment strategy (2022 Edition)
transform. Forward and vector3 Differences in the use of forward
MySQL + JSON = King fried
Product service, operation characteristics
Three dimensional anti-terrorism Simulation Drill deduction training system software
Debiasing word embeddings | talking about word embedding and deviation removal # yyds dry goods inventory #
The difference and relationship between iteratible objects, iterators and generators
Redis -- data type and operation
Gold, silver and four job hopping, interview questions are prepared, and Ali becomes the champion
Is it safe to open an ETF account online? What are the steps?