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

first stab at replay #10

Closed bradyz closed 3 years ago

bradyz commented 3 years ago

this branch is not ready to merge, just wanted to start some discussion on two questions -

thoughts on how to configure sensors? I'm thinking of creating yaml files that have the configurations of all the sensors (sensor type, pose, etc)...

Also, how should we save certain data types? Right now there are only RGB cameras, and the only information saved is the frame tick that the image was captured from - we should also save the pose at every time step.

philkr commented 3 years ago

I'd move most of this into recording. This way we can keep the top hierarchy slimmer.

philkr commented 3 years ago

A few comments on the structure:

No need to go over board with all options for now as long as we have an easy to extend framework. We can always add more options in later PRs as needed.

bradyz commented 3 years ago

here's some sample usage with using sensor config files

image

I have a hack for variables that i can whip up tomorrow.

and addressing the named outputs - this /tmp/my_first_recording_* seems like it could get messy - why not just have the structure like

/tmp/my_first_recording
    rgb
    rgb_left
    rgb_right

i.e. give each sensor access to the /tmp/my_first_recording directory, and do whatever they want inside here?

bradyz commented 3 years ago

did a big overhaul and ready for a new review - i think the structure is pretty stable now,
but certain implementations (the parsing json) could use a little work

philkr commented 3 years ago

@bradyz I rewrote most of the configuration system and tried to remove as much of the duplicate code as possible. I only tested the recording for now, and didn't test replay yet. There are a few things that remain to be done:

bradyz commented 3 years ago

i like the intense revamp of the config files - i've made a couple small changes to get sensors into replay

some issues remain:

right now i run this via

python3 -m carla_utils.replay town03.log tmp/ \
    --config config/sensors/dashboard_multi.yaml \
    --config_override "[setattr(s, 'target_actor', 2060) for s in sensor]" "[setattr(s, 'output_format', 'png') for s in sensor]"
philkr commented 3 years ago

What is the sync issue? I don't really get it.

output stream: I think we shouldn't overthink this. How about we just return a named list of sensors from the sensors function, allow output_format to be None, and cache the last output in each sensor? After all any code that accesses the sensors will have access to the context manager anyway.

I think config overrides are close. The setattr style is ugly though (I didn't even thing of that). I was thinking we can use ellipses and make sensors a special list to hangle this. Then we can use sensor[...].target_actor = 2060

bradyz commented 3 years ago

the callbacks are handled in a separate python thread (i think)

so even as the world ticks on, the sensors callbacks can be lagging behind
i run into the issue where the world has ticked all the way to the end of the recording, terminating the python program, but the sensors are not yet "caught up" and have not finished writing all the sensor data to disk

philkr commented 3 years ago

The callback threads are from carla itself? We should look into that.

bradyz commented 3 years ago

I don't know too much about how it's implemented - I took a look a couple days ago but didn't get much out of it.

At the end of the day for true sync mode we ll just need a barrier or something that waits for the sensors to get caught up with the world ( I implemented a crappy version of this right before the config rewrite)

bradyz commented 3 years ago

added the sensor warning + try/finally

let's take a final look soon then squash + merge