Skip to main content

Loop frequency regulation for asyncio

Project description

aiorate

build PyPI package Status

Loop frequency regulation for asyncio, with an API similar to rospy.Rate.

Installation

pip install aiorate

Example

import asyncio
import aiorate

async def main():
    frequency = 400.0  # [Hz]
    rate = aiorate.Rate(frequency, "my_rate_limiter")
    event_loop = asyncio.get_event_loop()
    while True:
        print(f"Hello from loop at {asyncio.get_event_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.1.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

aiorate-0.1-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page