Feature/async sources (#46)

* WIP: Added async file reader.

* Async resampling and synchronization refactored.

* Add async mqtt publisher. Remove queue from joint.

* Add async zmq publisher and subscriber.

* Modify integration tests for streaming.

* Name refactoring resampler.

* Added async source/sink to factory.

* Refactor joint and add integration tests.

* Add termcolor dev dependency

* Add conosole source and sink

* Add cli interface for different protocols

* Removed files unfit for merge.

* Fix review requests.

* Restore use of $MSB_CONFIG_DIR for now.

It seems that the default behaviour is not looking for
.config/heisskleber

* Remove version test, causing unnecessary failures.
This commit is contained in:
Felix Weiler
2024-01-22 11:23:00 +01:00
committed by GitHub
parent d25130b848
commit 78ba98a587
30 changed files with 645 additions and 187 deletions

View File

@@ -7,9 +7,6 @@ from heisskleber.stream.resampler import Resampler, ResamplerConf
async def main():
# topic1 = "/msb-fwd-body/imu"
# topic2 = "/msb-102-a/imu"
# topic2 = "/msb-102-a/rpy"
topic1 = "topic1"
topic2 = "topic2"
@@ -22,18 +19,8 @@ async def main():
resampler1 = Resampler(resampler_config, sub1)
resampler2 = Resampler(resampler_config, sub2)
_ = asyncio.create_task(sub1.run())
_ = asyncio.create_task(sub2.run())
# async for resampled_dict in resampler2.resample():
# print(resampled_dict)
gen1 = resampler1.resample()
gen2 = resampler2.resample()
while True:
m1 = await anext(gen1)
m2 = await anext(gen2)
m1, m2 = await asyncio.gather(resampler1.receive(), resampler2.receive())
print(f"epoch: {m1['epoch']}")
print(f"diff: {diff(m1, m2)}")