philkr / carla_utils

A list of utility functions for CARLA and beyond to allow for quicker prototyping.
MIT License
4 stars 1 forks source link

sensor synchronization by hooking into world.tick #19

Closed bradyz closed 3 years ago

bradyz commented 3 years ago

basing this off of this example and the MaxTickWorld class in replay.py

tested by doing

python3 -m carla_utils.replay town10_test.log tmp/ --config config/sensors/dashboard_multi.yaml --config_override "[setattr(s, 'target_actor',  497) for s in sensor]" "[setattr(s, 'output_format', 'jpg') for s in sensor]"

imageio's jpg is pretty fast, my tqdm progress bar says 20it/s, but using png cuts this to 8 it/s ...

philkr commented 3 years ago

Looks great. A few cosmetic changes (plus a way to access the sensors) then it's ready to merge. I'd suggest we make sensor_world behave like a dict (iterate over keys/sensor names, __getitem__ with sensor name). I like the _world and getattr trick, can you change MaxTickWorld to use the same style?

bradyz commented 3 years ago

fixed the tuple thing + changed maxtickworld to have the same getattr behavior

i'll take a stab at the access to sensors (i'm planning to implement this just by adding the processed data into the queue, along with the sensor name and timestamp)

bradyz commented 3 years ago

some fixes we discussed

one big issue that i haven't been able to figure out - when the replayer starts via client.replay_file, the client will keep replaying this file until it ends this is a problem when the user keyboard interrupts the replay script, and then the world terminates early

i bumped into this by

philkr commented 3 years ago

Let's open an issue for the interrupt. Maybe a try finally with client.stop_replayer works?

philkr commented 3 years ago

Three minor nags. Otherwise LGTM