Skip to content

Commit c0a3c69

Browse files
author
Shiye Shizhi
committed
add section about vehicle's specification
1 parent d8fcc8e commit c0a3c69

File tree

1 file changed

+86
-1
lines changed

1 file changed

+86
-1
lines changed

doc/2_vehicle_model/2_vehicle_model.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,89 @@ class XYArray:
189189
return XYArray(translated_data)
190190
```
191191

192-
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.
192+
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.
193+
194+
### 2.4.3 Specification class
195+
Implementing Vehicle's specification class as follow. This class is used to manage each parameters for the vehicle's control.
196+
197+
```python
198+
"""
199+
vehicle_specification.py
200+
201+
Author: Shisato Yano
202+
"""
203+
204+
import sys
205+
from pathlib import Path
206+
207+
sys.path.append(str(Path(__file__).absolute().parent) + "/../visualization")
208+
from min_max import MinMax
209+
210+
class VehicleSpecification:
211+
"""
212+
Vehicle Specification parameters class
213+
"""
214+
215+
def __init__(self, f_len_m=2.0, r_len_m=0.0, tire_r_m=0.3,
216+
tire_w_m=0.12, axle_half_m=0.5, color='k',
217+
line_w=1.0, line_type='-', area_size=10.0,
218+
x_lim=MinMax(-30, 30), y_lim=MinMax(-30, 30),
219+
max_accel_mps2=3.0):
220+
"""
221+
Constructor
222+
f_len_m: length[m] from origin to center of front axle
223+
r_len_m: length[m] from origin to center of rear axle
224+
tire_r_m: tire's radius[m]
225+
tire_w_m: tire's half of width[m]
226+
color: vehicle's color
227+
line_w: plot line's width
228+
line_type: plot line's type
229+
area_size: plot area size[m]
230+
x_lim: min/max values of x-axis
231+
y_lim: min/max values of y-axis
232+
max_accel_mps2: maximum acceleration/deceleration[m/s2]
233+
"""
234+
235+
self.f_len_m = f_len_m
236+
self.f_edge_m = self.f_len_m + 0.5
237+
238+
self.r_len_m = r_len_m
239+
self.r_edge_m = self.r_len_m + 0.5
240+
241+
self.tread_m = 0.25 * (1.0 + self.f_len_m + self.r_len_m)
242+
self.width_m = 1.0 * self.tread_m
243+
self.wheel_base_m = self.f_len_m + self.r_len_m
244+
245+
self.tire_r_m = tire_r_m
246+
self.tire_w_m = tire_w_m
247+
self.axle_half_m = axle_half_m
248+
249+
self.color = color
250+
self.line_w = line_w
251+
self.line_type = line_type
252+
self.area_size = area_size
253+
254+
self.x_lim = x_lim
255+
self.y_lim = y_lim
256+
257+
self.max_accel_mps2 = max_accel_mps2
258+
```
259+
260+
The vehicle has the following parameters as specification.
261+
262+
* Length from origin to center of front axle[m]
263+
* Length from origin to center of rear axle[m]
264+
* Length from origin to edge of front body[m]
265+
* Length from origin to edge of rear body[m]
266+
* Length of Tread[m]
267+
* Body's width[m]
268+
* Length of wheel base[m]
269+
* Tire's radius[m]
270+
* Tire's width[m]
271+
* Half of axle length[m]
272+
* Drawing color
273+
* Type of line
274+
* Size of zoom area around vehicle[m]
275+
* Limitation in x axis[m]
276+
* Limitation in y axis[m]
277+
* Maximum acceleration[m/s2]

0 commit comments

Comments
 (0)