Tinker-Twins/AutoDRIVE

Simulator Keyboard Control Issue

kevin1zc opened this issue · 7 comments

Hello. When I ran the simulator in manual mode to control the vehicle, some keys didn't work as stated in the paper. Low beam light ("G"), high beam light ("H"), and hazard indicator ("E") didn't work at all; when I pressed "R", it will start recording data instead of toggling right turn indicator.

Apart from these, is it normal to have a roughly 0.5s delay between pressing the key and the actuator taking effects?

The earlier versions of the simulator (<=V0.1.1) have the following input mapping:

Hardware User Input Function
Keyboard W/Up Arrow Drive Vehicle Forward
Keyboard S/Down Arrow Drive Vehicle Reverse
Keyboard A/Left Arrow Steer Vehicle Left
Keyboard D/Right Arrow Steer Vehicle Right
Keyboard G Toggle Headlights (Low Beam)
Keyboard H Toggle Headlights (High Beam)
Keyboard L Toggle Left Turn Indicator
Keyboard R Toggle Right Turn Indicator
Keyboard E Toggle Hazard Indicator
Keyboard A-Z, 0-9 and Special Characters Input Data through GUI
Mouse Click Interact with GUI
Mouse Scroll Zoom (Bird’s Eye View)

The later versions of the simulator (>=V0.2.0) have a new input mapping as follows:

  • Nigel (1:14 scale vehicle):
Hardware User Input Function
Keyboard W/Up Arrow Drive Vehicle Forward
Keyboard S/Down Arrow Drive Vehicle Reverse
Keyboard A/Left Arrow Steer Vehicle Left
Keyboard D/Right Arrow Steer Vehicle Right
Keyboard K Toggle Headlights (Low Beam)
Keyboard I Toggle Headlights (High Beam)
Keyboard J Toggle Left Turn Indicator
Keyboard L Toggle Right Turn Indicator
Keyboard M Toggle Hazard Indicator
Keyboard R Toggle Data Recording
Keyboard A-Z, 0-9 and Special Characters Input Data through GUI
Mouse Click Interact with GUI
Mouse Click and Drag Sideways Steer the Vehicle
Mouse Scroll Zoom (Bird’s Eye View)
  • OpenCAV (1:1 scale vehicle):
Hardware User Input Function
Keyboard W/Up Arrow Drive Vehicle Forward (not applicable if in R gear)
Keyboard S/Down Arrow Drive Vehicle Reverse (not applicable if in D gear)
Keyboard X Apply combi-brakes (puts the vehicle in N gear upon stopping)
Keyboard Space Bar Apply hand-brake (puts the vehicle in P gear upon stopping)
Keyboard A/Left Arrow Steer Vehicle Left
Keyboard D/Right Arrow Steer Vehicle Right
Keyboard K Toggle Headlights (Low Beam)
Keyboard I Toggle Headlights (High Beam)
Keyboard J Toggle Left Turn Indicator
Keyboard L Toggle Right Turn Indicator
Keyboard M Toggle Hazard Indicator
Keyboard U Toggle Parking Lights
Keyboard O Toggle Fog Lights
Keyboard R Toggle Data Recording
Keyboard A-Z, 0-9 and Special Characters Input Data through GUI
Mouse Click Interact with GUI
Mouse Click and Drag Sideways Steer the Vehicle
Mouse Scroll Zoom (Bird’s Eye View)

Regarding the delay between pressing a key and actuators taking effect, it is not a desired behavior. Does this happen only initially or all throughout the simulation? Did you check your frame rate in the heads-up display (HUD) panel on the right side? What kind of compute are you using to run the simulator?

Thank you for your reply. The new input mapping works for me. The delay is very obvious in Low Quality, slight in Ultra Quality, and unnoticable in High Quality, throughout the simulation. Frame rates in all 3 qualities are 60 or above. I'm running it in Ubuntu 20.04, on an i7-10700 and RTX 3080 desktop.

Btw, if I want to customize the simulator setup (i.e. add new scenes and vehicle models), what shall I do? I tried to directly open the source code in Unity but it could'd be properly loaded.

Is the delay only in actuation or other controls as well (e.g. vehicle lights should work almost instantaneously)? If it is only for actuation, the simulator models realistic actuator delays, so that might be what you are experiencing (which is an intended behaviour). This is what happens with physical vehicle as well - even if your control loop is very fast, the inertia of mechanical components and assemblies will cause a delay in actuation.

However, this should not change with the graphics quality. Could you please once again check carefully and confirm this? You can also share a video of the process, which can help us diagnose and rectify any potential issues.

In order to customize the simulator, you will need to work with the source code in Unity.

Could you possibly share a screenshot or video of what you mean by "it couldn't be properly loaded"? Did you encounter any errors?

Following are some general guidelines when working with the Unity project:

  • Try to use the exact same version of Unity as some packages may be version-specific.

  • When the project loads, it will default to an empty scene. In the "Project" panel, browse to the "Scenes" directory and select one of the pre-configured scenes (e.g. Tiny Town). These can also serve as templates for creating your own scenes!

  • The source code in AutoDRIVE Simulator branch may not be stable (we keep pushing the latest developments there). Try to download source files from one of the releases (e.g. Simulator-0.2.0) instead.

I upgraded my Ubuntu from 20.04 to 22.04 and now there's no control delay anymore. Everything runs smoothly.

For the source code, I'm now able to open and build the master branch with Unity Editor 2021.3.9f1. However, the released version 0.2.0 can't be opened in the dedicated version 2018.4.30f1. The editor just never showed up. I tried to open it in 2021.3.9f1 but there are compilation errors due to input argument changes of some functions in the parent class. I'll just use the master branch.