Skip to content

foxtron-ev/foxtronpi-pyclient

Repository files navigation

Foxtronpi-pyclient

This is an example python project to control the FoxtronEV's car model FoxtronPi(D31x) under project FoxtronPI with python-doipclient and python-udsoncan.

📁 Project Contents

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

Recommendation — Insatll WSL before development

When working in a Windows environment, we recommend installing WSL first, as it will make subsequent Python development more convenient.

1. Install WSL+ubuntu-22.04

Open the windows CMD and type in the command

wsl --install -d Ubuntu-22.04

The 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.

2. Update Ubuntu

sudo apt update
sudo apt upgrade

3. How to launch WSL after exiting the installer or restarting your computer

Open the CMD and type in the wsl command.

wsl

Create the Python Virtual Environment

Why do we need to create a Python Virtual Environment?

A Python Virtual Environment helps isolate dependencies and prevents the global development environment from becoming messy when working on multiple projects.

  1. Install Python3 and Venv(If not already installed)
sudo apt update
sudo apt install python3 python3-venv python3-pip

Installation and setup the system requirements packages

1. Clone the repository

First,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-pyclient

2. Enter the project folder

cd foxtronpi-pyclient

3. Create a virtual environment folder called Pi(You may choose a different name)

python3 -m venv Pi

4. Activate the virtual environment

source Pi/bin/activate

5. Install the package requirements

pip install -r requirements.txt

6. Install cryptography

pip install cryptography

Execution Method

Read the status of vehicle signals

python3 read.py

Write the vehicle Control parameter

python3 write.py

Visual Studio Code development environment

Open VS code to develop Python code if you want, but make sure you are inside the foxtronpi-pyclient folder.

code .

About

Client examples to communicate the FoxtronPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages