This project implements a kinematics model that allows simulation, analysis, and visualization using parameters of unsprung hardpoints.
- Python 3.9+
- MatPlotLib 3.10+
- Numpy 2.3+
- Pandas 2.3+
- Scipy 1.16+
Install required packages with:
pip install -r requirements.txt
If using the Jupyter notebook:
- To download VS Code:
- Download it following the instructions here: https://code.visualstudio.com/download
- Once downloaded, open VS Code and on the slide bar on the left, click the logo with 4 squares (that is extensions). Download the Jupyter extension (ensure it is only
Jupyterand not Jupyter Slide Show or anything else).
- To clone the repository:
- If you have Git installed on your computer, copy into the terminal or VS code using the command:
git clone https://github.com/LHRIC/LapSim.git - If you do not have Git, click the green
Codebutton in the upper right-hand corner of the LAPSIM HOMEPAGE ON THE GITHUB WEBSITE. There should be a drop-down, clickdownload ZIP. Once downloaded, unzip the folder and place it somewhere accessible, such asDesktop. - Now go to VS Code, and click open folder, it will now pop up your file system. Open LapSim. You should now see all of the files on the left-hand side of your VS Code.
- If you have Git installed on your computer, copy into the terminal or VS code using the command:
- To install the Python environment:
- Open up your terminal (Open a terminal by clicking the terminal button on the top bar, there should be a drop-down, then click on new terminal) and type in
pyorwhich pythonto check if you have Python already installed.- After typing in the command, if a directory such as
/opt/anaconda3/bin/pythonpops up, then Python is already installed. Then, check the version by typing in the terminalpython --versionorpython3 --version. - If no directory pops up, the easiest way to set up Python is using MiniConda (it is free and pretty lightweight). Check if you have Conda my typing in the terminal
conda.- Install MiniConda:
- Download the installer from this link: https://www.anaconda.com/download/success
- Once downloaded, open your computer terminal (you can find this by clicking the Windows logo and searching for the terminal, or if you're on a Mac, find it in LaunchPad). In the terminal, type
conda. A lot of text should pop up.- If it does, then it is working. If it does not, then you need to edit your environmental variables and add MiniConda to your path. (If you are on a Windows computer, find
Edit the system environmental variables, open this by finding it in the search. - Click on the
Advancedtab, at the bottom of the page, click onEnvironmental Variables... - Select
Pathunder System variables, then clickEdit... - Press
Newand copy in the install path for MiniConda which should be something likeC:\Users\<user name>\miniconda3\Script
- If it does, then it is working. If it does not, then you need to edit your environmental variables and add MiniConda to your path. (If you are on a Windows computer, find
- Once you have downloaded MiniConda, restart your VS Code by closing it and opening it again. This will link the Conda
- Install MiniConda:
- After typing in the command, if a directory such as
- Open up your terminal (Open a terminal by clicking the terminal button on the top bar, there should be a drop-down, then click on new terminal) and type in
- Add the desired hardpoints by either changing:
- The
.yamlfile that is in the parameters folder. - If you would like to add your own
.yamlfile, ensure that it is in the parameters folder and in the first cell, thekin_model_1.from_hardpoints('<filename.yaml>')reflects it. - If you would like to use an Excel sheet with the hardpoints, ensure that the labels of each hard point follow the convention detailed below. Ensure that the Excel file is in the parameters folder and that you are using the correct function with the corresponding file name
test_kin_model.from_xlsx('parameters/<filename>.xlsx', steering_delta, front_left_delta, rear_left_delta)
- The
- Open the
kinematics_model.ipynbfile, or if you want to compare two sets of hardpoints, usekinematic_report_comparisons.ipynb - Before running, download the required Python libraries. Either download by typing in
pip install -r requirements.txtor install each individually aspip install numpy,pip install pandas. - Click
Run all, it will prompt to choosePythonorKernel, clickKerneland selectbase, it should be the Conda environment. - Run cells sequentially to build the kinematic arrays, analyze results, and visualize. NOTE: If you change something like the hard points file or Excel sheet, you will need to rerun all of the cells (especially the FIRST cell). THIS IS VERY IMPORTANT, OR THE CODE WILL NOT PROCESS THE NEW DATA.
If using the Python script:
- Do the previous steps 1-6. To run the script, open the terminal and type in
python kinematics_model.py
Common Mistakes and How to Debug:
- Python version is too old, update the version by
- Window:
python -m pip install --upgrade piporpython -m pip install --upgrade pip --user - MacOS:
python3 -m pip install --upgrade pipor if you have homebrewbrew upgrade python
- Window:
- Copying and pasting the error into ChatGPT is very helpful.