MLTS-point-mass
Minimum lap time of a point mass with a G-G-V constraint, solved as an OCP with CasADi and IPOPT.
Installation
pip install MLTS-point-mass
The examples (tracks, vehicles, scripts) are in the repository:
git clone https://github.com/GiacomoCorradini/MLTS-point-mass.git
cd MLTS-point-mass
pip install -e ".[examples]"
Usage
python examples/run_mlts.py examples/tracks/Catalunya.txt # --ggv, --vehicle, --step, --save sol.csv
python examples/plot_ggv.py
python examples/plot_mesh.py
import json
from mlts_point_mass import MLTS, read_track
from mlts_point_mass.define_mesh import build_dense_start_end_mesh
track = "examples/tracks/Catalunya.txt"
vehicle = json.load(open("examples/vehicle_1/vehicle.json"))
ggv = json.load(open("examples/vehicle_1/ggv_envelope.json"))
mlts = MLTS(track, vehicle, ggv)
sol = mlts.solution(x0=[0, 0, 30, 0, 0]) # initial guess [n, Xi, V, ax, ay]
# Mesh: uniform step in m (default 1), or nodes built with mlts_point_mass.define_mesh
s = read_track(track)["abscissa"]
nodes, _ = build_dense_start_end_mesh(s, coarse_step=5.0, dense_step=1.0)
sol = mlts.solution(
x0=[0, 0, 30, 0, 0],
mesh=nodes,
weights={"w__ax": 1e-4}, # cost weights: w__T (lap time), w__ax, w__ay (control rate)
)
sol (dict, arrays sampled on the mesh along s):
| Field | Description |
|---|---|
success, status, iterations, solve_time |
IPOPT outcome (last iterate returned if not converged) |
abscissa |
curvilinear abscissa s of the centreline [m] |
distance |
distance travelled along the trajectory [m] |
time |
lap time [s] |
n |
lateral offset from the centreline [m] |
Xi |
heading relative to the centreline [rad] |
kappa |
centreline curvature [1/m] |
kappa_trj |
trajectory curvature ay / V² [1/m] |
yaw_rate |
ay / V [rad/s] |
V, ax, ay |
speed [m/s], longitudinal and lateral acceleration [m/s²] |
x_trj, y_trj, z_trj |
optimal trajectory [m] |
x_mid_line, y_mid_line, z_mid_line |
centreline [m] |
x_margin_L/R, y_margin_L/R, z_margin_L/R |
left / right track borders [m] |
Inputs
- track: path of the track file (tab separated,
#comments) orDataFramewith columnsabscissa,curvature,dir_mid_line,x_mid_line,y_mid_line,width_no_kerbs_L,width_no_kerbs_R; optionalelevation,slope(positive uphill),banking(positive: right side up), default 0. - vehicle (dict):
W_totalwidth [m],v_max[m/s]; optionalv_min(5.0),tau_ax,tau_ay(0.03 s). - ggv, either:
- CSV /
DataFramewith columnsV, ax, ay: boundary samples at each speed (symmetric inay); - FWBW dict: tables
ax_max(ay, V),ax_min(ay, V),ay_max(V), see ggv_envelope.json.
- CSV /
- ggv_scales: grip scaling
[mu],[mu_ax, mu_ay]or[mu_ax_max, mu_ax_min, mu_ay].
The GGV constraint is (rho / r)^2 <= 1, with rho the distance of (ax, ay) from the diagram centre and r that of the boundary in the same direction.
Metadata
Release files for MLTS-point-mass 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mlts_point_mass-0.1.0.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlts_point_mass-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / mlts_point_mass-0.1.0.tar.gz
| Download URL | mlts_point_mass-0.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67ba58c638fba237fd3d15e3ccb6b220e1d3748b2721994bac0a965ad3b83f49
|
|
BLAKE2b-256 checksum How to use checksums |
09f59f61f2fcf6ce1cebc116e09ba9e2ce9ae542e4da86ad3aa52bb04c792568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / mlts_point_mass-0.1.0-py3-none-any.whl
| Download URL | mlts_point_mass-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fe3ebeccfead3ecfdcf55d347418c1124a7ffef6f7b7eedd77bbb390031b2ab
|
|
BLAKE2b-256 checksum How to use checksums |
2de7df9f829979d5776cb440705944ce64cd086ae1caf76c2314e6c01faf3783
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|