Skip to content

Commit 618d34a

Browse files
committed
Cleaned up useless comments
1 parent c3932c8 commit 618d34a

16 files changed

+3
-495
lines changed

Auto_KF.h

-23
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@ void Auto_KF(Leg* leg) {
66

77
// take error during state 3
88
if (leg->state == 3) {
9-
// left_leg->Input is the average of the measured torque
10-
// left_leg->PID_Stepoint is the reference
119
if (abs(leg->PID_Setpoint) >= 0.9 * abs(leg->Setpoint_Ankle * leg->coef_in_3_steps)) { //If target is greater than 90% of setpoint
12-
// Serial.print(" Torque measured ");
13-
// Serial.println(leg->Input);
1410
leg->Torque_Sum_90P += leg->Input; // Sum torques
1511
leg->count_err ++; // Increment counter
16-
// Serial.println(leg->Torque_Sum_90P);
17-
// Serial.println(leg->count_err);
1812
leg->auto_KF_update = true; // Raise auto KF flag
19-
//Serial.println("INSIDE");
2013
} else {
2114
return;
2215
}
@@ -31,20 +24,13 @@ void Auto_KF(Leg* leg) {
3124
leg->Mean_Torque_90P = leg->Torque_Sum_90P / leg->count_err;
3225

3326

34-
// Serial.print(" Ref ");
35-
// Serial.print(leg->Setpoint_Ankle * leg->coef_in_3_steps);
36-
// Serial.print(" , 90% Setpoint Mean Torque");
37-
// Serial.print(leg->Mean_Torque_90P);
38-
// Serial.println(" ");
3927
if (leg->Mean_Torque_90P * leg->Setpoint_Ankle * leg->coef_in_3_steps <= 0) {
4028
// if the sign are not concord, no auto update of KF
41-
// Serial.println("Signals not concord");
4229
leg->auto_KF_update = false; //added after test of 11/7/18
4330
return;
4431
}
4532

4633
if ( abs((leg->Mean_Torque_90P - (leg->Setpoint_Ankle * leg->coef_in_3_steps)) / (leg->Setpoint_Ankle * leg->coef_in_3_steps)) < 0.01) {
47-
// Serial.println("Stop Auto KF");
4834
leg->auto_KF_update = false; //added after test of 11/7/18
4935
return;
5036
}// if the error is less than 1% no need to change KF
@@ -58,13 +44,6 @@ void Auto_KF(Leg* leg) {
5844
leg->KF = 1;
5945
}
6046

61-
// Serial.print("Setpoint Ankle");
62-
// Serial.print(leg->Setpoint_Ankle);
63-
// Serial.print("coeff");
64-
// Serial.print(leg->coef_in_3_steps);
65-
// Serial.print("Desired leg->KF ");
66-
// Serial.println(leg->KF);
67-
6847
if (leg->KF >= leg->max_KF) {
6948
leg->KF = leg->max_KF;
7049
}
@@ -76,8 +55,6 @@ void Auto_KF(Leg* leg) {
7655
leg->Mean_Torque_90P = 0;
7756
leg->Torque_Sum_90P = 0;
7857
leg->count_err = 0;
79-
// Serial.print("Actual leg->KF ");
80-
// Serial.println(leg->KF);
8158
leg->auto_KF_update = false; // to be able to do this cycle just once every step, i.e. during the whole state 1 I have to execute this cycle just once
8259
}// end of if state=1
8360

Balance_Ctrl.ino

-35
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ void Steady_Balance_Baseline() {
2525
right_leg->FSR_Toe_Steady_Balance_Baseline /= count_steady_baseline;
2626
right_leg->FSR_Heel_Steady_Balance_Baseline /= count_steady_baseline;
2727

28-
// Serial.println("Steady Balance Baseline");
29-
// Serial.println(left_leg->FSR_Toe_Steady_Balance_Baseline);
30-
// Serial.println(left_leg->FSR_Heel_Steady_Balance_Baseline);
31-
// Serial.println(right_leg->FSR_Toe_Steady_Balance_Baseline);
32-
// Serial.println(right_leg->FSR_Heel_Steady_Balance_Baseline);
3328
FLAG_STEADY_BALANCE_BASELINE = 0;
3429

3530
}
@@ -58,19 +53,8 @@ void Balance_Baseline() {
5853

5954
if (right_leg->FSR_Heel_Balance_Baseline <= fsr(right_leg->fsr_sense_Heel))
6055
right_leg->FSR_Heel_Balance_Baseline = fsr(right_leg->fsr_sense_Heel);
61-
//
62-
// count_balance++;
6356
} else {
6457

65-
// left_leg->FSR_Toe_Balance_Baseline /= count_balance;
66-
// left_leg->FSR_Heel_Balance_Baseline /= count_balance;
67-
// right_leg->FSR_Toe_Balance_Baseline /= count_balance;
68-
// right_leg->FSR_Heel_Balance_Baseline /= count_balance;
69-
// Serial.println("Dynamic Balance Baseline");
70-
// Serial.println(left_leg->FSR_Toe_Balance_Baseline);
71-
// Serial.println(left_leg->FSR_Heel_Balance_Baseline);
72-
// Serial.println(right_leg->FSR_Toe_Balance_Baseline);
73-
// Serial.println(right_leg->FSR_Heel_Balance_Baseline);
7458
FLAG_BALANCE_BASELINE = 0;
7559

7660
}
@@ -81,15 +65,6 @@ void Balance_Baseline() {
8165
//-----------------------------------------------------------
8266
double Balance_Torque_ref(Leg * leg) {
8367
// first balance control which is linear to the current level of force
84-
// Serial.print("[ ");
85-
// Serial.print(leg->FSR_Toe_Average);
86-
// Serial.print(", ");
87-
// Serial.print(leg->FSR_Toe_Balance_Baseline);
88-
// Serial.print("] ");
89-
// Serial.print(" ");
90-
// Serial.print((leg->FSR_Toe_Average / leg->FSR_Toe_Balance_Baseline) - (leg->FSR_Heel_Average / leg->FSR_Heel_Balance_Baseline));
91-
// Serial.print(" -> ");
92-
// Serial.println(min(1, (leg->FSR_Toe_Average / leg->FSR_Toe_Balance_Baseline)) - min(1, (leg->FSR_Heel_Average / leg->FSR_Heel_Balance_Baseline)));
9368

9469
return (min(1, (leg->FSR_Toe_Average / leg->FSR_Toe_Balance_Baseline)) - min(1, (leg->FSR_Heel_Average / leg->FSR_Heel_Balance_Baseline))) * (leg->Prop_Gain) * (leg->Setpoint_Ankle);
9570

@@ -101,16 +76,6 @@ double Balance_Torque_ref(Leg * leg) {
10176
double Balance_Torque_ref_based_on_Steady(Leg * leg) {
10277
// balance control which depends on the steady and dynamic baseline.
10378

104-
// Serial.print("[ ");
105-
// Serial.print(leg->FSR_Toe_Average);
106-
// Serial.print(", ");
107-
// Serial.print(leg->FSR_Toe_Balance_Baseline);
108-
// Serial.print("] ");
109-
// Serial.print(" ");
110-
// Serial.print((leg->FSR_Toe_Average / leg->FSR_Toe_Balance_Baseline) - (leg->FSR_Heel_Average / leg->FSR_Heel_Balance_Baseline));
111-
// Serial.print(" -> ");
112-
// Serial.println(min(1, (leg->FSR_Toe_Average - leg->FSR_Toe_Steady_Balance_Baseline) / ( leg->FSR_Toe_Balance_Baseline - FSR_Toe_Steady_Balance_Baseline)) - min(1, (leg->FSR_Heel_Average / leg->FSR_Heel_Balance_Baseline)));
113-
11479
// Steady_multiplier Dynamic_multiplier to increase or decrease the sentitivitiness of the control to the baseline, it works as a gain that allows to engage the max torque earlier or later.
11580
// in other words change the reference dimension of the estimated convex hull
11681

BioFeedback_functions.ino

-10
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ void takeHeelStrikeAngle(Leg* leg) {
33

44
leg->Heel_Strike += (pot(leg->Potentiometer_pin) + leg->Biofeedback_bias); //Take baseline knee angle data
55
leg->Heel_Strike_Count++;
6-
// right_leg->Heel_Strike_Count++;
76
Serial.print("Heel strike sum and n of steps: ");
87
Serial.print(leg->Heel_Strike);
98
Serial.print(" , ");
10-
// Serial.println(leg->Heel_Strike_Count);
119

1210
if (leg->BioFeedback_Baseline_flag == true) {
13-
//if (right_leg->BioFeedback_Baseline_flag == true) {
14-
// Heel_strike_update_and_biofeedback(leg);
1511
Heel_strike_update_and_biofeedback(right_leg);
1612
}
1713
return;
@@ -22,12 +18,9 @@ void BioFeedback_Baseline(Leg* leg) {
2218
// calculate the baseline
2319

2420
if (leg->BioFeedback_Baseline_flag == false) {
25-
// if (right_leg->Heel_Strike_Count >= leg->n_step_biofeedback_base)
2621
if (leg->Heel_Strike_Count >= leg->n_step_biofeedback_base)
2722
{
2823
Serial.print("UPDATING BASELINE for the BioFeedback : ");
29-
// Serial.println(leg->Heel_Strike);
30-
// Serial.println(leg->Heel_Strike_Count);
3124
leg->Heel_Strike_baseline = leg->Heel_Strike / leg->Heel_Strike_Count;
3225
leg->BioFeedback_Baseline_flag = true;
3326
leg->BIO_BASELINE_FLAG = false;
@@ -46,10 +39,8 @@ void Heel_strike_update_and_biofeedback(Leg * leg) {
4639
Serial.println("Inside Heel strike");
4740

4841
if (leg->Heel_Strike_Count >= leg->n_step_biofeedback) {
49-
// if (right_leg->Heel_Strike_Count >= leg->n_step_biofeedback){
5042
Serial.println("Inside first if Heel strike");
5143
leg->Heel_Strike_mean = leg->Heel_Strike / leg->Heel_Strike_Count;
52-
// leg->Heel_Strike_mean = leg->Heel_Strike / right_leg->Heel_Strike_Count;
5344
Serial.print("Heel_Strike_mean = ");
5445
Serial.print(leg->Heel_Strike_mean);
5546
Serial.print(" ; Difference between mean and desired : ");
@@ -72,7 +63,6 @@ void Heel_strike_update_and_biofeedback(Leg * leg) {
7263
Serial.println(leg->Frequency);
7364
}
7465
leg->Heel_Strike_Count = 0;
75-
// right_leg->Heel_Strike_Count = 0;
7666
leg->Heel_Strike = 0;
7767
}
7868
return;

Calibrate_and_Read_Sensors.ino

-17
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,8 @@ void FSR_calibration()
9090
}
9191
else {
9292

93-
// left_leg->p_steps->voltage_peak_ref = left_leg->fsr_Combined_peak_ref;
94-
// right_leg->p_steps->voltage_peak_ref = right_leg->fsr_Combined_peak_ref;
95-
96-
// What I need to comment out
97-
9893
FSR_FIRST_Cycle = 1;
9994
FSR_CAL_FLAG = 0;
100-
// if (FLAG_TWO_TOE_SENSORS) {
101-
// Serial.println(left_leg->fsr_Combined_peak_ref);
102-
// Serial.println(right_leg->fsr_Combined_peak_ref);
103-
// Serial.println(" ");
104-
// } else {
105-
// Serial.println(left_leg->fsr_Toe_peak_ref);
106-
// Serial.println(left_leg->fsr_Heel_peak_ref);
107-
// Serial.println(" ");
108-
// Serial.println(right_leg->fsr_Toe_peak_ref);
109-
// Serial.println(right_leg->fsr_Heel_peak_ref);
110-
// Serial.println(" ");
111-
// }
11295
}
11396
}
11497

Check_LED_BT.ino

-6
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ double Check_LED_BT(const unsigned int LED_BT_PIN_l, double LED_BT_Voltage_l, in
1212
*(p_count_l) = 0;
1313

1414
if ( LED_BT_Voltage_l <= 2 && flag_done_once_bt == false) {
15-
// Serial.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DISCONNECTED! ");
16-
// Serial.print("VOLTAGE : ");
17-
// Serial.println(LED_BT_Voltage_l);
1815

1916
bluetooth.flush();
2017
flag_done_once_bt = true;
@@ -23,9 +20,6 @@ double Check_LED_BT(const unsigned int LED_BT_PIN_l, double LED_BT_Voltage_l, in
2320

2421
if (LED_BT_Voltage_l > 2.5 && flag_done_once_bt == true) {
2522
flag_done_once_bt = false;
26-
// Serial.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RECONNECTED! ");
27-
// Serial.print("VOLTAGE : ");
28-
// Serial.println(LED_BT_Voltage_l);
2923
}
3024
}
3125

Control_Adjustment.ino

+1-40
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ int take_baseline(int R_state_l, int R_state_old_l, steps* p_steps_l, int* p_fla
2121
{
2222
p_steps_l->peak = 0;
2323
p_steps_l->flag_start_plant = false;
24-
// Serial.println(" BASE Dorsi too short");
2524
return 0;
2625
} else {
2726
p_steps_l->flag_start_plant = true; // Parameters inizialized Start a step
28-
// Serial.println(" BASE Start Plantar");
2927
}
3028
}
3129
}
@@ -37,7 +35,6 @@ int take_baseline(int R_state_l, int R_state_old_l, steps* p_steps_l, int* p_fla
3735
// if you transit from 3 to 1 plantar flexion is completed and start dorsiflexion
3836

3937
if ((R_state_old_l == 3) && (R_state_l == 1 || R_state_l == 2)) {
40-
// Serial.println(" BASE Start Dorsi");
4138

4239
// start dorsiflexion
4340

@@ -48,21 +45,16 @@ int take_baseline(int R_state_l, int R_state_old_l, steps* p_steps_l, int* p_fla
4845
if (p_steps_l->plant_time <= step_time_length)
4946
{
5047
p_steps_l->flag_start_plant = false;
51-
// Serial.println("BASE Plant too short"); // it means is a glitch not a real step
5248
return 0;
5349
} else {
5450
p_steps_l->flag_start_plant = false; // you have provided one plant
55-
// Serial.println("Increase Plant number");
5651
p_steps_l->count_plant_base++; // you have accomplished a step
57-
// Serial.println(p_steps_l->count_plant_base);
5852
}
5953

60-
// Serial.print(" BASE Plant Time = ");
61-
// Serial.println(p_steps_l->plant_time);
6254

6355
if ((p_steps_l->count_plant_base) >= 2) { // avoid the first step just to be sure
6456

65-
// // this is the time window of the filter for the dorsiflexion
57+
// this is the time window of the filter for the dorsiflexion
6658
if (((p_steps_l->count_plant_base) - 2) >= n_step_baseline) {
6759

6860
p_steps_l->dorsi_mean = 0;
@@ -96,29 +88,19 @@ int take_baseline(int R_state_l, int R_state_old_l, steps* p_steps_l, int* p_fla
9688
p_steps_l->plant_peak_mean_temp = 1.0 * (p_steps_l->plant_peak_mean_temp) / n_step_baseline; //Gain (1.0) was 0.9 2/25/2019 GO
9789

9890
//HERE
99-
100-
// Serial.println("BASE before return");
101-
// Serial.print(" Peak ");
102-
// Serial.println(p_steps_l->peak);
103-
// Serial.print(" N ");
104-
// Serial.println(p_steps_l->count_plant_base);
10591
}
10692
else {
10793
p_steps_l->four_step_dorsi_time[p_steps_l->count_plant_base - 2] = p_steps_l->dorsi_time;
10894

10995
p_steps_l->four_step_plant_time[p_steps_l->count_plant_base - 2] = p_steps_l->plant_time;
11096

11197
p_steps_l->four_step_plant_peak[p_steps_l->count_plant_base - 2] = p_steps_l->peak;
112-
// Serial.println("Inside Peak vector ");
11398

11499
for (int i = 0; i < n_step_baseline; i++) {
115-
// Serial.println(p_steps_l->four_step_plant_peak[i]);
116100
}
117101
}
118102

119103
if (((p_steps_l->count_plant_base) - 2) >= n_step_baseline) {
120-
// Serial.print("BASE return peak mean temporary");
121-
// Serial.println(p_steps_l->plant_peak_mean_temp);
122104
}
123105
if (((p_steps_l->count_plant_base) - 2) >= n_step_baseline) {
124106
(p_steps_l->count_plant_base) = 0;
@@ -181,10 +163,6 @@ double Control_Adjustment(Leg* leg, int R_state_l, int R_state_old_l, steps* p_s
181163

182164

183165
if (taking_baseline_l == 0 && p_steps_l->plant_peak_mean_temp != p_steps_l->plant_peak_mean) {
184-
// Serial.println("Updated peak mean values");
185-
// Serial.print(p_steps_l->plant_peak_mean);
186-
// Serial.print(" -> ");
187-
// Serial.println(p_steps_l->plant_peak_mean_temp);
188166
p_steps_l->plant_peak_mean = p_steps_l->plant_peak_mean_temp;
189167
}
190168

@@ -263,14 +241,6 @@ double Control_Adjustment(Leg* leg, int R_state_l, int R_state_old_l, steps* p_s
263241
// start dorsiflexion
264242
p_steps_l->dorsi_time = millis();
265243

266-
// if (p_steps_l->flag_N3_adjustment_time) { // If you wanted to adjust the smoothing as a function of the speed
267-
// // check for the first step in order to see if everything started properly
268-
// if (p_steps_l->n_steps == 1) {
269-
// Serial.println(" N3 Adj activated");
270-
// }
271-
// p_steps_l->n_steps++;
272-
// }
273-
274244
// calculate plantarflexion
275245
p_steps_l->plant_time = millis() - (p_steps_l->plant_time);
276246

@@ -284,9 +254,6 @@ double Control_Adjustment(Leg* leg, int R_state_l, int R_state_old_l, steps* p_s
284254

285255
p_steps_l->flag_start_plant = false; // you have provided one step
286256

287-
// Serial.print(" Plant Time = ");
288-
// Serial.println(p_steps_l->plant_time);
289-
290257
if (p_steps_l->count_plant >= 2) {
291258
// this is the time window of the filter for the plantarflexion
292259
if (p_steps_l->count_plant - 2 >= n_step_baseline) {
@@ -309,12 +276,6 @@ double Control_Adjustment(Leg* leg, int R_state_l, int R_state_old_l, steps* p_s
309276
p_steps_l->plant_mean = p_steps_l->plant_mean / n_step_baseline;
310277
}
311278

312-
// if (p_steps_l->flag_N3_adjustment_time) {
313-
// N3_l = round((p_steps_l->plant_mean) * p_steps_l->perc_l);
314-
// if (N3_l <= 4) N3_l = 4;
315-
// if (N3_l >= 500) N3_l = 500;
316-
// }
317-
318279

319280
}//end if R old 3 i.e. finish plantarflexion
320281
}// end if flag_start_plant

0 commit comments

Comments
 (0)