Closed bhairavmehta95 closed 6 years ago
Why did the duckie cross the road? To get to his home in the master branch :sweat_smile:
Haha nice!
On Thu 12 Jul, 2018, 8:45 PM Bhairav Mehta, notifications@github.com wrote:
[image: duckie] https://user-images.githubusercontent.com/10503729/42666664-78a7856c-8614-11e8-8067-481cc9df420d.gif
Why did the duckie cross the road? To get to his home in the master branch 😅
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/duckietown/gym-duckietown/pull/39#issuecomment-404692479, or mute the thread https://github.com/notifications/unsubscribe-auth/AHSlFlhJlJ7wPKF15vOXQerRrQo3fKvdks5uF-3AgaJpZM4VOInx .
Looks pretty cool.
The main thing I don't like though is that we're adding so many new variables to the simulator. This is a lot of code, and as you pointed out, the simulator class is getting a little too fat.
I'm a bit torn because I can see that you put quite a bit of efford trying to numpy-ify this code for efficiency. At the same time, I think maybe it's not necessary for this. We might only have a handful of moving duckies in a given map, so maybe we can make the tradeoff.
I'm thinking, we probably want to start factoring things in a more OOP way. Currently, I just have a dictionary for objects. We probably want to have a base class for objects. WorldObj or something like that. Each object should have a position, an angle, a step()
method, probably also a render()
method, and another method that tells us if its static or not, is_static
. Then we can have a DuckieObj class that inherits from this base class. That way, all of the duckie's parameters can be encapsulated within the duckie object itself. What do you think?
Two other details:
Totally agree -- what I will say is that when I had some problems writing this efficient version, I switched to a more OO way, and while it ends up being way simpler, you can't use the advantages of numpy (which as you pointed out, for our use case is probably okay, but that's why I ended trying to make this version work).
I would prefer the class / OO method bc of the fact it makes the code way cleaner, and it seems that you do as well, so I will start making the switch to this. The nice thing is that if after that is implemented, it drops the efficiency by too much, we can always just revert and merge this commit.
This PR deals with adding dynamic obstacles - in this case, only pedestrian duckies that walk across the road, which can be specified by adding:
To the object's description in the YAML File.
In domain rand. mode, they walk across the same specified distance (
ROAD_TILE_WIDTH
) at randomized speeds, and have randomized time intervals between their walks.I tried to vectorize as much as possible (see
_update_dynamic_obs()
andupdate_pedestrians()
) and I tried to run as many tests as possible, but we will need to play around with it to get especially the speed that they should walk across correct. I believe my current setting is a bit too high.Tested w. draw-bbox mode + domain-rand mode, as well as different combinations of maps. To test, I've added a small map called
loop_obstacles_pedestrians
.