Skip to content

Commit

Permalink
add section about vehicle's specification
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiye Shizhi committed Jan 15, 2025
1 parent d8fcc8e commit c0a3c69
Showing 1 changed file with 86 additions and 1 deletion.
87 changes: 86 additions & 1 deletion doc/2_vehicle_model/2_vehicle_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,89 @@ class XYArray:
return XYArray(translated_data)
```

In this code, a given data to Constructor is x-y 2D array. Then, the data can be transformed based on the vehicle's position (x, y) and yaw angle. After the data was transformed, a new XYArray object with the transformed data is returned.
In this code, a given data to Constructor is x-y 2D array. Then, the data can be transformed based on the vehicle's position (x, y) and yaw angle. After the data was transformed, a new XYArray object with the transformed data is returned.

### 2.4.3 Specification class
Implementing Vehicle's specification class as follow. This class is used to manage each parameters for the vehicle's control.

```python
"""
vehicle_specification.py
Author: Shisato Yano
"""

import sys
from pathlib import Path

sys.path.append(str(Path(__file__).absolute().parent) + "/../visualization")
from min_max import MinMax

class VehicleSpecification:
"""
Vehicle Specification parameters class
"""

def __init__(self, f_len_m=2.0, r_len_m=0.0, tire_r_m=0.3,
tire_w_m=0.12, axle_half_m=0.5, color='k',
line_w=1.0, line_type='-', area_size=10.0,
x_lim=MinMax(-30, 30), y_lim=MinMax(-30, 30),
max_accel_mps2=3.0):
"""
Constructor
f_len_m: length[m] from origin to center of front axle
r_len_m: length[m] from origin to center of rear axle
tire_r_m: tire's radius[m]
tire_w_m: tire's half of width[m]
color: vehicle's color
line_w: plot line's width
line_type: plot line's type
area_size: plot area size[m]
x_lim: min/max values of x-axis
y_lim: min/max values of y-axis
max_accel_mps2: maximum acceleration/deceleration[m/s2]
"""

self.f_len_m = f_len_m
self.f_edge_m = self.f_len_m + 0.5

self.r_len_m = r_len_m
self.r_edge_m = self.r_len_m + 0.5

self.tread_m = 0.25 * (1.0 + self.f_len_m + self.r_len_m)
self.width_m = 1.0 * self.tread_m
self.wheel_base_m = self.f_len_m + self.r_len_m

self.tire_r_m = tire_r_m
self.tire_w_m = tire_w_m
self.axle_half_m = axle_half_m

self.color = color
self.line_w = line_w
self.line_type = line_type
self.area_size = area_size

self.x_lim = x_lim
self.y_lim = y_lim

self.max_accel_mps2 = max_accel_mps2
```

The vehicle has the following parameters as specification.

* Length from origin to center of front axle[m]
* Length from origin to center of rear axle[m]
* Length from origin to edge of front body[m]
* Length from origin to edge of rear body[m]
* Length of Tread[m]
* Body's width[m]
* Length of wheel base[m]
* Tire's radius[m]
* Tire's width[m]
* Half of axle length[m]
* Drawing color
* Type of line
* Size of zoom area around vehicle[m]
* Limitation in x axis[m]
* Limitation in y axis[m]
* Maximum acceleration[m/s2]

0 comments on commit c0a3c69

Please sign in to comment.