f1tenth/f1tenth_gym

Individual lap time observation and lap count config

Opened this issue · 4 comments

Currently, there is no option to change the number of laps that the agent drives before terminated and done are flagged as true. Additionally, the lap time observation is actually a total time observation for all (two) laps in this case.

The _check_done function would need to be rewritten to accomodate a config setting. The lap times calculation would need to be reworked to compute current lap time.

Yes, this might be part of #90.

Having the centerline, we can easily compute the lap using the progress (ie. simply check s coordinate).
The question is how to compute the lap and the laptime when starting from random positions along the track.
Shall we increase the lap everytime the car crosses the finish line?

About the lap time infos. We could return a list of lap times or the current lap time.
Any preference @AhmadAmine998 ?

If the car is starting from a random position along the track, I say we re-order the s-coordinates from the centerline so that the point on the centerline with the closest index is now s=0 and increments accordingly. It should be doable using numpy roll.

I think a list of lap times can be useful if someone is implementing a controller/planner that uses a history of laptimes (i.e LMPC). It could also come in handy for debugging and performance monitoring.

It is definitely doable to change the starting point but it becomes messy with multiple agents. Each vehicle would have a different lap.

I think it would be nice to be able to pick a specific progress value to place the start/finish line