The SightLab Driving Simulation provides a flexible platform for creating and customizing driving experiences. Located in the ExampleScripts-Driving folder, it supports various hardware configurations including desktop, VR headsets, and custom input devices. See the Download Button below for an expanded version with more city maps and features.
Dynamic engine audio with speed-based pitch adjustment
Elevation and ramp support
Variable Speed Control
HUD display of speed, fixations, timestamp, and gear status
Gear shift system to toggle between Drive and Reverse
Dynamic animations of RPM, MPH gauges, steering wheel, tires, and more
Multi-user capabilities
Eye tracking, physiological data, data collection (see below)
Analysis Features
Driver attention and fixation tracking
Car velocity, average mph per trial or condition, position and rotation saved to data files (can add custom data as well)
Interactive session replay
Gaze pattern visualization
Performance metrics logging
Physiological tracking integration
Heat map analysis
Instructor view with real time control and monitoring
Environmental Features
Day/Night/Fog cycles
Variable lighting conditions
Traffic simulation
360° media integration
Customizable obstacles and pedestrians
Included Scripts
Driving_GUI_Main.py This is the main script to run. uses the GUI to select environments. If you downloaded the expanded version this includes 3 city maps, freeway ramps and night and day scenes. The standard version in SightLab Example Scripts just has one city with day and night cycles (note: SightLab 2.6.6 and later now include all the maps)
Driving_Main_noGUI.py uses only code, but has similar functionality to Driving_GUI
Driving_GUI_Traffic.py shows adding some cross traffic flow. Can modify the code and stim file (in Resources) to adjust speed and number of additional cars. Uses collision detection to check whether your vehicle collides with any others. Note: can add traffic to all scripts if set ADD_TRAFFIC = True in the config file (see below)
Driving_Simulator_360 (additional download) - shows using a 360 video to simulate driving in New York
Driving_Config.py Used to configure additional options (see below)
In the expanded driving download there is also a folder called Longer_Road that has an endlessly stretching highway
For 360 Video Drive through example with Mixed Media contact support@worldviz.com (see below for info)
Controls
Keyboard controls available to all. Additionally, see the SightLab Controls page for more.
View adjustment: T, F, G, H keys
Start/Next trial: Spacebar
Save/Store Position: v key
Select Viewpoint:b key
Reset Viewpointi
XBOX/Game Controller
Steering: Left Stick- Turn left or right
Gas: Right Trigger
Brake: Left Trigger
Toggle Gear: Press X to toggle between reverse and drive (must come to a stop first)
Look Around: Right stick or use the mouse
Select Button: Change Viewpoints
Desktop Controls
Movement: WASD keys
Gas: = key
Brake: - key
Toggle Gear: Press Y to toggle between reverse and drive (must come to a stop first)
VR Controls
General VR
Steering: Left Stick- Turn left or right
Gas: Right Trigger (for some headsets, also need to hold the RH B button)
Brake: Left Trigger
Toggle Gear: Press Y to toggle between reverse and drive (must come to a stop first)
View adjustment: WASD, X, and Z keys
SteamVR/Vive Specific
Steering: RH trackpad (left/right)
Gas: RH system button
Brake: RH grip button
Steering Wheel Controllers
Wheel motion - Turns car left and right
Gas and Brake - Mapped to gas and brake pedals
Tested and verified, but can easily add additional ones:
To add a new wheel, run the wheel_inspector.py script in the modules folder, then press on the gas to see which ID is for throttle and the same for brake. You can then also press each button to find the ID (or run the Set Up Game Controllers program in Windows). Modify one of the included wheel input files (such as the g923_input.py) and change the necessary IDs for the throttle, axis and clutch. Button mappings for things such as viewpoints can be set up by making a copy of one of the wheel vizconnect files and modifying those under "mappings". Contact support@worldviz.com for more information.
self.wheel_axis=0# Steering wheel: -1 to +1self.throttle_axis=1# Throttle pedal: 1.0 when not pressed, -1.0 when fully pressedself.brake_axis=2# Brake pedal: 1.0 when not pressed, -1.0 when fully pressed self.clutch_axis=3# Clutch pedal: 1.0 when not pressed, varies when pressed
Running the GUI Example
Run Driving_GUI_Main.py. Pressing spacebar will start the experiment or proceed to the next trial. Data will be saved in the data folder.
Notes
If the car shoots up into the air on starting you may need to physically move back a little bit to avoid triggering the collision detection while it's starting.
Session Replay
After running a session, use SightLabVR_Replay.py to view a playback of your session, including the car's movement. Can check "Follow Mode" to see the first person in the car or it will show the default third person view.
Customization
Changing the Environment
Place a new environment file in the Resources/environments folder.
(for the GUI) Select the new environment using the GUI:
Change the path to your new vehicle in Driving_Config.py as well as references to items that can be animated or used (headlights, wheels, steering wheel, mph and rpm gauge)
CAR_MODEL='Resources/jeepmodel.osgb'
To add regions of interest to items inside the vehicle, this is a different setup since the car is set to disable intersections (for the elevation detection). You need to add a region in Inspector, then right click and choose "Save" in the scene graph on the left. Then add the regions directly and parent to the car, such as this code below.
Import car class from module (make sure car_module.py exists next to your main script):
fromcar_moduleimportCar
Set up the car instance in Driving_Config.py (note that STEERING_WHEEL_NAME and individual wheels are optional if you want a steering wheel that turns and tires that spin).
5. Setup the link of the driving transport to the car
rawTransport=vizconnect.getRawTransport('driving')transport=vizconnect.getTransport('driving')transportNode=transport.getNode3d()my_car.link_to_transport(transportNode)#Optionally change position of transporttransportNode.setPosition([0.25,0.65,0.35])
Changing View Position in Car
Run the script using the Vizard editor and use either the TFGH, ZX keys to position your viewpoint if Desktop or WASD, ZX for HMD
Press the 'v' key when your position looks correct
This will print out your current position in the Vizard interactive window
Copy and paste this position into the Driving_Config.py PASSENGER_POSITION or in the code under the hardware options
The Driving Config provides extensive customization options:
# Driving_Config.pyCAR_MODEL='Resources/jeepmodel.osgb'#CAR_MODEL = 'sightlab_resources/objects/car.osgb'#CAR_MODEL = 'Resources/bmw.osgb'STEERING_WHEEL_NAME='Steering_Real Car 22_Body_0'ENGINE_AUDIO='Resources/engine_sound8.wav'PASSENGER_POSITION=[-0.08379964530467987,-0.23322515189647675,0.14180484414100647]PASSENGER_POSITION_TRUCK=[0.2632506489753723,0.556177020072937,0.3184721767902374]THIRD_PERSON_VIEW=[0.6829884052276611,1.5265825986862183,-3.218057870864868]CLOSER_IN_VIEW=[0.2637367844581604,0.556177020072937,0.5279949903488159]CAR_STARTING_POSITION=[0.25,0,0.35]ENGINE_VOLUME=0.2FRONT_RIGHT_WHEEL='FR_Real Car 22_Body_0'FRONT_LEFT_WHEEL='FL_Real Car 22_Body_0'BACK_RIGHT_WHEEL='BR_Real Car 22_Body_0'BACK_LEFT_WHEEL='BL_Real Car 22_Body_0'MPH_GAUGE='mph_gauge'RPM_GAUGE='Dok 1_Real Car 22_Body_0'ENVIRONMENT_MODEL="Resources/environments/street_day.osgb"#Fallback environment model for non-GUIUSE_COLLISION=True#Set to true for elevation detectionCOLLISION__UPDATE_TYPE="update"#set to "timer" if frame rate going too low. "update" is smootherCOLLISION_UPDATE_INTERVAL=0.07#If using timer set the rate to update. Lower numbers smoother but lower framerate#CAR_TYPE = 'Truck'CAR_TYPE='Car'COAST_RATE=0.1#Higher Number, faster stop. Reduced from 0.35 to allow longer coasting and turningMAX_SPEED=27.5#Note this is multiplied by 2, so for 50mph, put 25ADD_TRAFFIC=True
Customizing Controls
Navigate to the vizconnect file in util_files/sightlab_utils/vizconnect_configs.
Go to Advanced > Transports > Driving > Mappings and Acceleration/Deceleration under "Events".
Modify the mappings as needed.
Note: You may need to set permissions on the file to edit the vizconnect.
Advanced Versions
Contact sales@worldviz.com for information on advanced versions:
Version that shows driving over elevations and ramps
360 video driving simulator (combining 3D models and 360 videos)
Flying simulator
360 Driving Simulator Instructions (Available Upon Request)