CarSim
By default, the monoDrive Simulator uses PhysX for vehicle dynamics. Alternatively, monoDrive also supports co-simulation with CarSim.
Prerequisites
monoDrive Scenario Editor
- Windows 10
- Visual Studio build tools
- follow instructions from Unreal Engine here
- make sure the recommended workloads are selected, including
.NET desktop development
- monoDrive Scenario Editor
- monoDrive Client (C++, Python or LabVIEW)
monoDrive CarSim Integration Enabled
- Open
VehicleAI.uproject
with a text editor - Enable the two required plugins
{
"Name": "CarSim",
"Enabled": true,
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/2d712649ca864c80812da7b5252f5608"
},
{
"Name": "monoDriveVehiclesCarSim",
"Enabled": true
}
- Launch the editor and the integration will be built
CarSim Prerequisites
- VehicleSim Dynamics plugin for Unreal Engine 4.25
- CarSim 2020.0
- Minimum licenses:
- CarSim Browser and Graphical User Interface
- CarSim Solver for Windows
- Minimum licenses:
Create CarSim model
-
Open CarsSim
- accept default licensing and database location
-
Create new dataset
- File → New Dataset (empty)
- Category: monoDrive, Title: some title
-
Give simulation control to UE4
- Unselect 'Set driver controls here'
- Unselect 'Set time step here'
- Unselect 'Advanced settings'
-
Select vehicle
- Click drop down under 'Simulated Test Specifications'
- Click 'Vehicles' → 'Vehicle: Assembly'
- Select a model (e.g. 'D-Class, Sedan')
- Click drop down under 'Simulated Test Specifications'
-
(optional) Update params
- Under the selected vehicle, any parameters can be updated as desired
-
Visualization
- Under 'Run Control'
- select ERD 32-bit
- check 'Write all outputs'
- select ERD 32-bit
- Under the 'Video' button, open the drop down
- Click 'Vehicle References'
- select '13 Azm, 9 El, 18 m, No Yaw'
- Click 'Vehicle References'
- Click the dropdown for 'More plots' and select a number
- Populate these empty datasets with predefined plots
- Under 'Run Control'
-
Generate simfile
- Under 'Run Control', open the drop down next to 'Models'
- select 'Models: Transfer to Local Windows Directory'
- the title of this section should change to 'Run from Alternate Directory'
- Under the dataset drop down, select 'UE4 simfile generator'
- Open this dataset and click 'Duplicate' to make a copy
- Update the working directory and other fields as desired
- For example, set the directory to 'C:\Users\devin\dump\carsim'
- Open this dataset and click 'Duplicate' to make a copy
- Go back to the main dataset and select the copy for the simfile generator
- Click 'Generate Files for this Run'
- 'ue4simfile.sim' should appear in the working directory
- Under 'Run Control', open the drop down next to 'Models'
Configure the monoDrive Scenario
-
Open up the closed loop scenario file with a text editor
-
Find the vehicle with the
ego
tag -
Update the
class_path
to point at the CarSim vehicle and add a field to specify thesim_file
. It should read:
"class_path": "/Game/CarSim/VS_Core/CarSimDemoVehicle.CarSimDemoVehicle_C",
"sim_file" : "C:\\Users\\you\\path\\to\\ue4simfile.sim",
Running
-
Start the monoDrive Simulator
-
Click 'Generate Files for this Run' from CarSim
-
Run the configured closed loop example from LabVIEW
-
When done, stop both the LabVIEW client and the simulator
-
Go back to CarSim and click 'Video + Plot' to see results