This program was made by and for the Solar Car Team at UVA. This program generates simulated CAN Messages.
- Clone this repo onto your machine
cdinto the project folder- Create a python virtual environment (
py -m venv .venv) and activate it (.\.venv\Scripts\activate)- you may need to use
pythonorpython3instead ofpy - on Mac, run
source ./.venv/bin/activateto activate the virtual environment
- you may need to use
- Install dependencies (
pip install -r requirements.txt) - Add the CAN Messages submodule by running
git submodule update --init --recursive
Setting up the Config file
A JSON file must be created. It contains a dictionary (outer dictionary) of dictionaries (inner dictionaries). The keys to the outer dictionary are CAN message names (like ECUMotorCommands); its value is an inner dictionary. The inner dictionary contains key-value pairs for signals of the CAN message and their value (like "throttle": 25). Signals left undefined will be assumed to be 0.
The value of a signal will be re-evaluated for every message generated. The value can be dynamically set by using a python expression in a string for a signal's value; the expression can contain these elements:
mathpackage functions.randompackage functions (random was imported asrand)i, which is the iteration number of the current message
See config_example.json for an example.
Running the Program
After completing the steps in Installation, run py main.py path number
- replace
pathwith the path of the Config JSON file - replace
numberwith the number of messages to be created; can use scientific notation (like1e3) - the output is stored in
out.txt