Loop frequency regulator for asyncio.
Project description
aiorate
Loop frequency regulator for asyncio with an API similar to rospy.Rate
.
Installation
pip install aiorate
Example
import asyncio
import aiorate
async def main():
rate = aiorate.Rate(400.0) # Hz
while True:
loop_time = asyncio.get_event_loop().time()
print(f"Hello from loop at {loop_time:.3f} s")
await rate.sleep()
if __name__ == "__main__":
asyncio.run(main())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiorate-0.3.tar.gz
(11.8 kB
view hashes)
Built Distribution
aiorate-0.3-py3-none-any.whl
(7.1 kB
view hashes)