duckietown / gym-duckietown

Self-driving car simulator for the Duckietown universe
http://duckietown.org
Other
54 stars 19 forks source link

Joystick control script #33

Closed maximecb closed 6 years ago

maximecb commented 6 years ago

Currently, we have a manual_control.py script which allows us to control the duckiebot using the keyboard. It would be nice to have a joystick_control.py script which would allow us to control the robot with continuous actions, and to record demonstrations for imitation learning.

The pygame library can be used to get joystick input.

Requirements:

@bhairavmehta95

maximecb commented 6 years ago

@bhairavmehta95 Good work on the joystick_control script.

Some suggestions to make it even better:

bhairavmehta95 commented 6 years ago

Will take care of these.

bhairavmehta95 commented 6 years ago

I have a PR ready, but Github won't let me open it so I'll offer my suggestion here @maximecb

Adding almost all changes requested in #33 .

X button now stops the recording and deletes in no matter what. If episode finishes when recording, recording is now stopped & saved and the episode resets.

The only thing not added is the double joystick control - usually, double joysticks (one for vel, one for angle) is better if you can freely move in any axis of movement (i.e a player in a shooting game), but we can't. (Tested this also, and it felt really weird and hardly worked).

I'd suggest if we'd like to do this, we change acceleration to the triggers (forward = Right Trigger, reverse = Left Trigger), and then can use one joystick for the steering. Haven't played on in a while, but I believe this is how traditional racing games are done as well.

maximecb commented 6 years ago

@liampaull should the speed of the robot be 0.2m/s when the forward velocity action == 1.0? Is that how the gain calibration parameter works.