From 17321027561cb54e0fd30d11609b6f60878750e8 Mon Sep 17 00:00:00 2001 From: Ziqi Yin Date: Thu, 13 Sep 2012 20:23:30 -0700 Subject: [PATCH 01/12] h5_file and defaults_config --- defaults.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults.cfg b/defaults.cfg index d0df2b1..793c870 100755 --- a/defaults.cfg +++ b/defaults.cfg @@ -1,5 +1,5 @@ [data] -base = /media/Data/Documents/School/UC Davis/Bicycle Mechanics +base = /home/stefenyin/bicycle/bi_pypa pathToDatabase = %(base)s/BicycleDataProcessor/InstrumentedBicycleData.h5 pathToCorruption = %(base)s/BicycleDataProcessor/data-corruption.csv pathToRunMat = %(base)s/BicycleDAQ/data From ec9c67ec899b1e0525150e553050296ff06199d8 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Fri, 28 Sep 2012 13:29:13 -0700 Subject: [PATCH 02/12] Changed the default.cfg because I changed the name of the home directory --- defaults.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults.cfg b/defaults.cfg index 793c870..b815bb2 100644 --- a/defaults.cfg +++ b/defaults.cfg @@ -1,5 +1,5 @@ [data] -base = /home/stefenyin/bicycle/bi_pypa +base = /home/stefenstudy/bicycle/bi_pypa pathToDatabase = %(base)s/BicycleDataProcessor/InstrumentedBicycleData.h5 pathToCorruption = %(base)s/BicycleDataProcessor/data-corruption.csv pathToRunMat = %(base)s/BicycleDAQ/data From d337c72b3349c61baf3ebeae33b3eab3c28afa0c Mon Sep 17 00:00:00 2001 From: StefenYin Date: Mon, 1 Oct 2012 23:17:08 -0700 Subject: [PATCH 03/12] Updated the default.cfg --- defaults.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults.cfg b/defaults.cfg index b815bb2..793c870 100644 --- a/defaults.cfg +++ b/defaults.cfg @@ -1,5 +1,5 @@ [data] -base = /home/stefenstudy/bicycle/bi_pypa +base = /home/stefenyin/bicycle/bi_pypa pathToDatabase = %(base)s/BicycleDataProcessor/InstrumentedBicycleData.h5 pathToCorruption = %(base)s/BicycleDataProcessor/data-corruption.csv pathToRunMat = %(base)s/BicycleDAQ/data From 2581dd8007f6fde2067d3e81d85645c683643388 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 12:58:34 -0700 Subject: [PATCH 04/12] Built the compute_rear_wheel_rate() function into computedSignals category, for front_wheel_rate calculation --- bicycledataprocessor/main.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index aa186a0..7632377 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -735,7 +735,6 @@ def task_signals(self): self.compute_rear_wheel_contact_rates() self.compute_rear_wheel_contact_points() self.compute_front_wheel_contact_points() - self.topSig = 'task' def compute_signals(self): @@ -762,6 +761,7 @@ def compute_signals(self): self.compute_steer_rate() self.compute_yaw_roll_pitch_rates() self.compute_steer_torque() + self.compute_rear_wheel_rate() def truncate_signals(self): """Truncates the calibrated signals based on the time shift.""" @@ -803,6 +803,23 @@ def check_time_shift(self, maxNRMS): 'time shift is {}, which is greater '.format(str(nrms)) + 'than the maximum allowed: {}'.format(str(maxNRMS)))) + def compute_rear_wheel_rate(self): + """ + Computes computedSignals of the rear wheel rate from truncatedSignals. + + """ + try: + rearWheelRate = self.truncatedSignals['RearWheelRate'] + except AttributeError: + print('RearWheelRate is not availabe.') + else: + rearWheelRate = rearWheelRate.convert_units('radian/second') + + rearWheelRate.name = 'RearWheelRate' + rearWheelRate.units = 'radian/second' + self.computedSignals[rearWheelRate.name] = rearWheelRate + + def compute_rear_wheel_contact_points(self): """Computes the location of the wheel contact points in the ground plane.""" From b15c6979a8633515bb5ef9b6484a804131c87725 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 13:11:32 -0700 Subject: [PATCH 05/12] Added self.bicycleRiderMooreParameters into load_rider func for parameters inputs --- bicycledataprocessor/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index 7632377..09ee8ac 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -1231,6 +1231,9 @@ def load_rider(self, pathToParameterData): self.bicycleRiderParameters =\ bp.io.remove_uncertainties(self.bicycle.parameters['Benchmark']) + self.bicycleRiderMooreParameters =\ + benchmark_to_moore(self.bicycleRiderParameters) + def plot(self, *args, **kwargs): ''' Returns a plot of the time series of various signals. From 0adff7a3295f9a6ecf8e5cc9f8ea1aeb1b5e7c27 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 13:13:37 -0700 Subject: [PATCH 06/12] Changed the mooreparameters input way for the compute_front_wheel_contact_points func --- bicycledataprocessor/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index 09ee8ac..384512d 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -856,7 +856,7 @@ def compute_front_wheel_contact_points(self): q4 = self.taskSignals['RollAngle'] q7 = self.taskSignals['SteerAngle'] - p = benchmark_to_moore(self.bicycleRiderParameters) + p = self.bicycleRiderMooreParameters f = np.vectorize(front_contact) q9, q10 = f(q1, q2, q3, q4, q7, p['d1'], p['d2'], p['d3'], p['rr'], From 862b3f2ddd4071183686bc21e6d2da2ba2cdd331 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 13:17:43 -0700 Subject: [PATCH 07/12] Changed the way of importing dtk.bicycle --- bicycledataprocessor/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index 384512d..42088ac 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -24,7 +24,8 @@ from tables import NoSuchNodeError import dtk.process as process -from dtk.bicycle import front_contact, benchmark_to_moore +import dtk.bicycle as bi + import bicycleparameters as bp # local dependencies @@ -858,7 +859,7 @@ def compute_front_wheel_contact_points(self): p = self.bicycleRiderMooreParameters - f = np.vectorize(front_contact) + f = np.vectorize(bi.front_contact) q9, q10 = f(q1, q2, q3, q4, q7, p['d1'], p['d2'], p['d3'], p['rr'], p['rf']) @@ -1232,7 +1233,7 @@ def load_rider(self, pathToParameterData): bp.io.remove_uncertainties(self.bicycle.parameters['Benchmark']) self.bicycleRiderMooreParameters =\ - benchmark_to_moore(self.bicycleRiderParameters) + bi.benchmark_to_moore(self.bicycleRiderParameters) def plot(self, *args, **kwargs): ''' From 687a8a02627beb337c1a7d321c6244b87c5d940b Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 14:07:50 -0700 Subject: [PATCH 08/12] Built the compute_front_wheel_rate func, and Added FrontWheelRate into the database --- bicycledataprocessor/database.py | 1 + bicycledataprocessor/main.py | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bicycledataprocessor/database.py b/bicycledataprocessor/database.py index a05202c..b7bcbdd 100644 --- a/bicycledataprocessor/database.py +++ b/bicycledataprocessor/database.py @@ -96,6 +96,7 @@ def __init__(self, **kwargs): 'PitchRate', 'PullForce', 'RearWheelRate', + 'FrontWheelRate' 'RollAngle', 'RollRate', 'ForwardSpeed', diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index 42088ac..baa96d2 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -736,6 +736,7 @@ def task_signals(self): self.compute_rear_wheel_contact_rates() self.compute_rear_wheel_contact_points() self.compute_front_wheel_contact_points() + self.compute_front_wheel_rate() self.topSig = 'task' def compute_signals(self): @@ -807,7 +808,6 @@ def check_time_shift(self, maxNRMS): def compute_rear_wheel_rate(self): """ Computes computedSignals of the rear wheel rate from truncatedSignals. - """ try: rearWheelRate = self.truncatedSignals['RearWheelRate'] @@ -820,6 +820,30 @@ def compute_rear_wheel_rate(self): rearWheelRate.units = 'radian/second' self.computedSignals[rearWheelRate.name] = rearWheelRate + def compute_front_wheel_rate(self): + """Calculates the front wheel rate based on the data of rear_wheel_rate. + """ + + bp = self.bicycleRiderParameters + mp = self.bicycleRiderMooreParameters + + q2 = self.taskSignals['RollAngle'] + q3 = bp['lam'] + q4 = self.taskSignals['SteerAngle'] + u1 = self.taskSignals['YawRate'] + u1 = self.taskSignals['YawRate'] + u2 = self.taskSignals['RollRate'] + u3 = self.taskSignals['PitchRate'] + u5 = self.taskSignals['RearWheelRate'] + + f = np.vectorize(bi.front_wheel_rate) + + u6 = f(q2, q3, q4, u1, u2, u3, u5, mp['rr'], mp['rf'], + mp['d1'], mp['d2'], mp['d3']) + + u6.name = 'FrontWheelRate' + u6.units = 'radian/second' + self.taskSignals['FrontWheelRate'] = u6 def compute_rear_wheel_contact_points(self): """Computes the location of the wheel contact points in the ground From 2e27ad9da81a85ed9926a2780540372b87357467 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 16:36:45 -0700 Subject: [PATCH 09/12] Built the compute_front_wheel_steer_yaw_angle func --- bicycledataprocessor/database.py | 4 +++- bicycledataprocessor/main.py | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/bicycledataprocessor/database.py b/bicycledataprocessor/database.py index b7bcbdd..f95d902 100644 --- a/bicycledataprocessor/database.py +++ b/bicycledataprocessor/database.py @@ -96,7 +96,9 @@ def __init__(self, **kwargs): 'PitchRate', 'PullForce', 'RearWheelRate', - 'FrontWheelRate' + 'FrontWheelRate' + 'FrontWheelYawAngle' + 'FrontWheelSteerAngle' 'RollAngle', 'RollRate', 'ForwardSpeed', diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index baa96d2..7bf8d2e 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -737,6 +737,7 @@ def task_signals(self): self.compute_rear_wheel_contact_points() self.compute_front_wheel_contact_points() self.compute_front_wheel_rate() + self.compute_front_wheel_steer_yaw_angle() self.topSig = 'task' def compute_signals(self): @@ -845,6 +846,29 @@ def compute_front_wheel_rate(self): u6.units = 'radian/second' self.taskSignals['FrontWheelRate'] = u6 + def compute_front_wheel_steer_yaw_angle(self): + """Calculates the yaw angle of the front wheel. + """ + + bp = self.bicycleRiderParameters + + q1 = self.taskSignals['YawAngle'] + q2 = self.taskSignals['RollAngle'] + q3 = bp['lam'] + q4 = self.taskSignals['SteerAngle'] + + f = np.vectorize(bi.front_wheel_steer_yaw_angle) + + frontWheel_SteerAngle, frontWheel_YawAngle = f(q1, q2, q3, q4) + + frontWheel_SteerAngle.name = 'FrontWheelSteerAngle' + frontWheel_SteerAngle.units = 'radian' + self.taskSignals['FrontWheelSteerAngle'] = frontWheel_SteerAngle + + frontWheel_YawAngle.name = 'FrontWheelYawAngle' + frontWheel_YawAngle.units = 'radian' + self.taskSignals['FrontWheelYawAngle'] = frontWheel_YawAngle + def compute_rear_wheel_contact_points(self): """Computes the location of the wheel contact points in the ground plane.""" From ec0cf8ba3173e9b283afede334eb8af00429685b Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 22:29:41 -0700 Subject: [PATCH 10/12] Built compute_signals_derivatives func for easy inputting a dictionary into other funcs, and Built the compute_contact_force_rear_longitudinal_N1_nonslip func --- bicycledataprocessor/database.py | 1 + bicycledataprocessor/main.py | 53 +++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/bicycledataprocessor/database.py b/bicycledataprocessor/database.py index f95d902..4f0631a 100644 --- a/bicycledataprocessor/database.py +++ b/bicycledataprocessor/database.py @@ -99,6 +99,7 @@ def __init__(self, **kwargs): 'FrontWheelRate' 'FrontWheelYawAngle' 'FrontWheelSteerAngle' + 'LongitudinalRearContactForce_Nonslip' 'RollAngle', 'RollRate', 'ForwardSpeed', diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index 7bf8d2e..cc4e83c 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -738,6 +738,8 @@ def task_signals(self): self.compute_front_wheel_contact_points() self.compute_front_wheel_rate() self.compute_front_wheel_steer_yaw_angle() + self.compute_signals_derivatives() + self.compute_contact_force_rear_longitudinal_N1_nonslip() self.topSig = 'task' def compute_signals(self): @@ -866,9 +868,58 @@ def compute_front_wheel_steer_yaw_angle(self): self.taskSignals['FrontWheelSteerAngle'] = frontWheel_SteerAngle frontWheel_YawAngle.name = 'FrontWheelYawAngle' - frontWheel_YawAngle.units = 'radian' + frontWheel_YawAngle.unitss = 'radian' self.taskSignals['FrontWheelYawAngle'] = frontWheel_YawAngle + def compute_signals_derivatives(self): + """Calculate the acceleration of some signals by time_derivative. + """ + + try: + yawRate = self.taskSignals['YawRate'] + rollRate = self.taskSignals['RollRate'] + pitchRate = self.taskSignals['PitchRate'] + steerRate = self.taskSignals['SteerRate'] + rearWheelRate = self.taskSignals['RearWheelRate'] + frontWheelRate = self.taskSignals['FrontWheelRate'] + except AttributeError: + print('YawRate, RollRate, PitchRate, SteerRate, or/and '\ + 'RearWheelRate, FrontWheelRate are not availabe.') + else: + yawAcc = yawRate.time_derivative() + rollAcc = rollRate.time_derivative() + pitchAcc = pitchRate.time_derivative() + steerAcc = steerRate.time_derivative() + rearWheelAcc = rearWheelRate.time_derivative() + frontWheelAcc = frontWheelRate.time_derivative() + + yawAcc.name = 'YawAcc' + self.taskSignals[yawAcc.name] = yawAcc + rollAcc.name = 'RollAcc' + self.taskSignals[rollAcc.name] = rollAcc + pitchAcc.name = 'PitchAcc' + self.taskSignals[pitchAcc.name] = pitchAcc + steerAcc.name = 'SteerAcc' + self.taskSignals[steerAcc.name] = steerAcc + rearWheelAcc.name = 'RearWheelAcc' + self.taskSignals[rearWheelAcc.name] = rearWheelAcc + frontWheelAcc.name = 'FrontWheelAcc' + self.taskSignals[frontWheelAcc.name] = frontWheelAcc + + def compute_contact_force_rear_longitudinal_N1_nonslip(self): + """Calculate the longitudinal contact force of rear wheel under + the constraint condition.""" + + bp = self.bicycleRiderParameters + + f = np.vectorize(bi.contact_force_rear_longitudinal_N1_nonslip) + + Fx_r_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) + + Fx_r_ns.name = 'LongitudinalRearContactForce_Nonslip' + Fx_r_ns.units = 'newton' + self.taskSignals[Fx_r_ns.name] = Fx_r_ns + def compute_rear_wheel_contact_points(self): """Computes the location of the wheel contact points in the ground plane.""" From ff845fb6a5e293da152e77813e06f6547a18f253 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Tue, 30 Oct 2012 23:52:52 -0700 Subject: [PATCH 11/12] Built the rest of compute_contact_force funcs --- bicycledataprocessor/database.py | 14 ++++++++-- bicycledataprocessor/main.py | 47 +++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/bicycledataprocessor/database.py b/bicycledataprocessor/database.py index 4f0631a..09e2c0d 100644 --- a/bicycledataprocessor/database.py +++ b/bicycledataprocessor/database.py @@ -94,20 +94,30 @@ def __init__(self, **kwargs): 'FrameAccelerationY', 'FrameAccelerationZ', 'PitchRate', + 'PitchAcc' 'PullForce', 'RearWheelRate', + 'RearWheelAcc' 'FrontWheelRate' + 'FrontWheelAcc' 'FrontWheelYawAngle' 'FrontWheelSteerAngle' - 'LongitudinalRearContactForce_Nonslip' + 'LongRearConForce_Nonslip' + 'LatRearConForce_Nonslip' + 'LongFrontConForce_Nonslip' + 'LatFrontConForce_Nonslip' 'RollAngle', 'RollRate', + 'RollAcc' 'ForwardSpeed', 'SteerAngle', 'SteerRate', + 'SteerAcc' 'SteerTorque', 'tau', # why tau? - 'YawRate'] + 'YawAngle' + 'YawRate' + 'YawAcc'] def _task_table_class(self): """Creates a class that is used to describe the table containing meta diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index cc4e83c..ef43644 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -740,6 +740,9 @@ def task_signals(self): self.compute_front_wheel_steer_yaw_angle() self.compute_signals_derivatives() self.compute_contact_force_rear_longitudinal_N1_nonslip() + self.compute_contact_force_rear_lateral_N2_nonslip() + self.compute_contact_force_front_longitudinal_N1_nonslip() + self.compute_contact_force_front_lateral_N2_nonslip() self.topSig = 'task' def compute_signals(self): @@ -916,10 +919,52 @@ def compute_contact_force_rear_longitudinal_N1_nonslip(self): Fx_r_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - Fx_r_ns.name = 'LongitudinalRearContactForce_Nonslip' + Fx_r_ns.name = 'LongRearConForce_Nonslip' Fx_r_ns.units = 'newton' self.taskSignals[Fx_r_ns.name] = Fx_r_ns + def compute_contact_force_rear_lateral_N2_nonslip(self): + """Calculate the lateral contact force of rear wheel under + the constraint condition.""" + + bp = self.bicycleRiderParameters + + f = np.vectorize(bi.contact_force_rear_lateral_N2_nonslip) + + Fy_r_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) + + Fy_r_ns.name = 'LatRearConForce_Nonslip' + Fy_r_ns.units = 'newton' + self.taskSignals[Fy_r_ns.name] = Fy_r_ns + + def compute_contact_force_front_longitudinal_N1_nonslip(self): + """Calculate the longitudinal contact force of front wheel under + the constraint condition.""" + + bp = self.bicycleRiderParameters + + f = np.vectorize(bi.contact_force_front_longitudinal_N1_nonslip) + + Fx_f_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) + + Fx_f_ns.name = 'LongFrontConForce_Nonslip' + Fx_f_ns.units = 'newton' + self.taskSignals[Fx_f_ns.name] = Fx_f_ns + + def compute_contact_force_front_lateral_N2_nonslip(self): + """Calculate the lateral contact force of front wheel under + the constraint condition.""" + + bp = self.bicycleRiderParameters + + f = np.vectorize(bi.contact_force_front_lateral_N2_nonslip) + + Fy_f_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) + + Fy_f_ns.name = 'LatFrontConForce_Nonslip' + Fy_f_ns.units = 'newton' + self.taskSignals[Fy_f_ns.name] = Fy_f_ns + def compute_rear_wheel_contact_points(self): """Computes the location of the wheel contact points in the ground plane.""" From 200f33855db26fc017bf5cc2098cf52f982bd4e2 Mon Sep 17 00:00:00 2001 From: StefenYin Date: Wed, 31 Oct 2012 00:32:47 -0700 Subject: [PATCH 12/12] Combined four contact force funcs into one func, compute_contact_force_nonslip Because they need to be transfered to body-fixed coordinates for each wheel, and Imported sin and cos in main.py. Here, you can also build a func for coordinates (N -> body-fixed of each wheel) transformation in Signalprocessing or dtk --- bicycledataprocessor/main.py | 61 ++++++++++++++---------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/bicycledataprocessor/main.py b/bicycledataprocessor/main.py index ef43644..2093742 100644 --- a/bicycledataprocessor/main.py +++ b/bicycledataprocessor/main.py @@ -17,6 +17,7 @@ # dependencies import numpy as np +from numpy import sin, cos from scipy import io from scipy.integrate import cumtrapz from scipy.optimize import curve_fit @@ -739,10 +740,8 @@ def task_signals(self): self.compute_front_wheel_rate() self.compute_front_wheel_steer_yaw_angle() self.compute_signals_derivatives() - self.compute_contact_force_rear_longitudinal_N1_nonslip() - self.compute_contact_force_rear_lateral_N2_nonslip() - self.compute_contact_force_front_longitudinal_N1_nonslip() - self.compute_contact_force_front_lateral_N2_nonslip() + self.compute_contact_force_nonslip() + self.topSig = 'task' def compute_signals(self): @@ -909,58 +908,44 @@ def compute_signals_derivatives(self): frontWheelAcc.name = 'FrontWheelAcc' self.taskSignals[frontWheelAcc.name] = frontWheelAcc - def compute_contact_force_rear_longitudinal_N1_nonslip(self): - """Calculate the longitudinal contact force of rear wheel under - the constraint condition.""" + def compute_contact_force_nonslip(self): + """Calculate the contact force of each wheel under the constraint + condition. Here, the forces are expressed by body-fixed coordinates.""" bp = self.bicycleRiderParameters - f = np.vectorize(bi.contact_force_rear_longitudinal_N1_nonslip) + f0 = np.vectorize(bi.contact_force_rear_longitudinal_N1_nonslip) + Fx_r_n = f0(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - Fx_r_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) + f1 = np.vectorize(bi.contact_force_rear_lateral_N2_nonslip) + Fy_r_n = f1(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - Fx_r_ns.name = 'LongRearConForce_Nonslip' - Fx_r_ns.units = 'newton' - self.taskSignals[Fx_r_ns.name] = Fx_r_ns + f2 = np.vectorize(bi.contact_force_front_longitudinal_N1_nonslip) + Fx_f_n = f2(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - def compute_contact_force_rear_lateral_N2_nonslip(self): - """Calculate the lateral contact force of rear wheel under - the constraint condition.""" + f3 = np.vectorize(bi.contact_force_front_lateral_N2_nonslip) + Fy_f_n = f3(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - bp = self.bicycleRiderParameters + yawAngle = self.taskSignals['YawAngle'] + frontWheelYawAngle = self.taskSignals['FrontWheelYawAngle'] - f = np.vectorize(bi.contact_force_rear_lateral_N2_nonslip) + Fx_r_ns = cos(yawAngle) * Fx_r_n + sin(yawAngle) * Fy_r_n + Fy_r_ns = -sin(yawAngle) * Fx_r_n + cos(yawAngle) * Fy_r_n + Fx_f_ns = cos(frontWheelYawAngle) * Fx_f_n + sin(frontWheelYawAngle) * Fy_f_n + Fy_f_ns = -sin(frontWheelYawAngle) * Fx_f_n + cos(frontWheelYawAngle) * Fy_f_n - Fy_r_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) + Fx_r_ns.name = 'LongRearConForce_Nonslip' + Fx_r_ns.units = 'newton' + self.taskSignals[Fx_r_ns.name] = Fx_r_ns Fy_r_ns.name = 'LatRearConForce_Nonslip' Fy_r_ns.units = 'newton' self.taskSignals[Fy_r_ns.name] = Fy_r_ns - def compute_contact_force_front_longitudinal_N1_nonslip(self): - """Calculate the longitudinal contact force of front wheel under - the constraint condition.""" - - bp = self.bicycleRiderParameters - - f = np.vectorize(bi.contact_force_front_longitudinal_N1_nonslip) - - Fx_f_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - Fx_f_ns.name = 'LongFrontConForce_Nonslip' Fx_f_ns.units = 'newton' self.taskSignals[Fx_f_ns.name] = Fx_f_ns - def compute_contact_force_front_lateral_N2_nonslip(self): - """Calculate the lateral contact force of front wheel under - the constraint condition.""" - - bp = self.bicycleRiderParameters - - f = np.vectorize(bi.contact_force_front_lateral_N2_nonslip) - - Fy_f_ns = f(bp['lam'], self.bicycleRiderMooreParameters, self.taskSignals) - Fy_f_ns.name = 'LatFrontConForce_Nonslip' Fy_f_ns.units = 'newton' self.taskSignals[Fy_f_ns.name] = Fy_f_ns