This is an example python project to control the FoxtronEV's car model FoxtronPi(D31x) under project FoxtronPI with python-doipclient and python-udsoncan.
| File Name | Description |
|---|---|
FoxPi_read.py |
Function Library to Read Vehicle Signal Status(e.g. vehicle speed, lights, battary, motor, etc.) |
FoxPi_write.py |
Function Library to Control Vehicle Signals(e.g. acceleration, target speed, lights, gear shifting) |
FoxPi_DTC.py |
Function Library to Read and clear DTCs |
FoxPi_TP.py |
Function Library to send the TesterPresent service request and keep the connection alive. |
client_config.cpython-310-x86_64-linux-gnu.so |
Connection configuration (.so) file |
common.cpython-310-x86_64-linux-gnu.so |
Diagnostic configuration (.so) file |
README.md |
Project Documentation |
requirement.txt |
Package Requirements |
read.py |
Sample code: Read vehicle signal status |
write.py |
Sample code: Write vehicle control parameter |
When working in a Windows environment, we recommend installing WSL first, as it will make subsequent Python development more convenient.
Open the windows CMD and type in the command
wsl --install -d Ubuntu-22.04The system will automatically download and install some Linux kernel components.
Next, you’ll see an installation progress bar.
Once it finishes, a prompt will appear asking you to enter a username and password.
Note: When entering your password, nothing will appear in the terminal as you type — this is normal behavior. So, don’t worry if it looks like nothing is being entered, and avoid pressing keys repeatedly!
Once the username and password are entered, the setup is complete.
sudo apt update
sudo apt upgradeOpen the CMD and type in the wsl command.
wslA Python Virtual Environment helps isolate dependencies and prevents the global development environment from becoming messy when working on multiple projects.
- Install Python3 and Venv(If not already installed)
sudo apt update
sudo apt install python3 python3-venv python3-pipFirst,Open the CMD and type in the wsl.
Then, enter the following command after WSL starts:
git clone --branch main https://github.com/foxtron-ev/foxtronpi-pyclientcd foxtronpi-pyclientpython3 -m venv Pisource Pi/bin/activatepip install -r requirements.txtpip install cryptographypython3 read.pypython3 write.pyOpen VS code to develop Python code if you want, but make sure you are inside the foxtronpi-pyclient folder.
code .