-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront_brakes.py
30 lines (24 loc) · 1.01 KB
/
front_brakes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import numpy as np
import scipy.io as spio
class FrontBrakes(object):
def __init__(self, brake_front_proporation, tire_radius):
mat = spio.loadmat('data/brake_data.mat', squeeze_me=True)
self.brake_front_proporation = brake_front_proporation
self.brake_torque = 0
self.front_brake_w = 0
self.pedal_position_percentage_map = np.array(
mat['pedal_position_percentage'])
self.total_brake_force_map = np.array(mat['f_total_brake'])
self.tire_radius = tire_radius
def compute_step(self, front_wheel_w, beta):
if beta < 0:
self.brake_torque = self.tire_radius * - \
np.interp(-beta * 100, self.pedal_position_percentage_map,
self.total_brake_force_map) * self.brake_front_proporation
else:
self.brake_torque = 0
self.brake_w = front_wheel_w
return {
"brake_torque": self.brake_torque,
"front_brake_w": self.front_brake_w
}