当前位置:网站首页>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()
边栏推荐
- DNS
- (16) ADC conversion experiment
- Countdownlatch blocking wait for multithreading concurrency
- Nearly 60% of the employees strongly support Ctrip's "3+2" working mode, and work at home for two days a week
- Session layer of csframework, server and client (1)
- Penetration practice vulnhub range Keyring
- Subnet division and summary
- Is it safe to open a stock account by mobile phone? What do you need to bring with you to open an account?
- Good looking UI mall source code has been scanned, no back door, no encryption
- Radhat builds intranet Yum source server
猜你喜欢

DNS

New patent applications and transfers
![[beauty detection artifact] come on, please show your unique skill (is this beauty worthy of the audience?)](/img/e8/f43f5583e330fbc0cb6c0188711707.jpg)
[beauty detection artifact] come on, please show your unique skill (is this beauty worthy of the audience?)

Wechat applet blind box - docking wechat payment

How to write good code - Defensive Programming Guide

Setting up a time server requires the client to automatically synchronize the time of the server at 9 a.m. every day
![[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

Extract the compressed package file and retrieve the password

Yolov5 practice: teach object detection by hand

Penetration practice vulnhub range Keyring
随机推荐
Depth first traversal and breadth first traversal [easy to understand]
Alibaba cloud Li Feifei: China's cloud database has taken the lead in many mainstream technological innovations abroad
Gold, silver and four job hopping, interview questions are prepared, and Ali becomes the champion
Detailed explanation of string's trim() and substring()
Is it safe to open a stock account by mobile phone? What do you need to bring with you to open an account?
麦趣尔:媒体报道所涉两批次产品已下架封存,受理消费者诉求
網上股票開戶安全嗎?是否可靠?
Nielseniq found that 60% of the re launched products had poor returns
pyqt5中,在控件上画柱状图
Replace UUID, nanoid is faster and safer!
Fix the problem that easycvr device video cannot be played
How to write good code - Defensive Programming Guide
Intel's open source deep learning tool library openvino will increase cooperation with local software and hardware parties and continue to open
PHP implements sensitive word filtering system "suggestions collection"
Yuancosmos game farmersworld farmers world - core content of the second conference in China!
Petrv2: a unified framework for 3D perception of multi camera images
Euler function: find the number of numbers less than or equal to N and coprime with n
. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes
Unity3d extended toolbar
Redis -- data type and operation