Skip to content

Commit 30c2439

Browse files
committed
Update stress test script and result
1 parent d74f0e6 commit 30c2439

2 files changed

Lines changed: 42 additions & 24 deletions

File tree

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,37 @@ S7RTT is not intended to replace Ruckig for multi-DOF cases, but it offers disti
3131
![](doc/img/Compare_Boundary_4.png)
3232
* However, more often than not, even within the constraints, Ruckig still attempts to insert a Brake motion, which leads to a suboptimal final solution.
3333
![](doc/img/Compare_Boundary_3.png)
34-
* More seriously, Ruckig frequently reports solution failures, which is unacceptable in practical applications. Below are the results of stress tests under random conditions.
34+
* Specifically, Ruckig recommends using "m" as the unit. If you use "mm" with a large jerk, planning failures will occur frequently, while S7RTT recommends using "mm" as the unit. Below is a comparison of scaled random stress tests in normal operation:
3535
```
3636
################################################################################
3737
FINAL STATISTICS
3838
################################################################################
39-
Total Tests: 10000
39+
Total Tests: 100000
4040
----------------------------------------
4141
CATEGORY | S7RTT | RUCKIG
4242
----------------------------------------
43-
Plan Failures | 0 | 751
43+
Plan Failures | 0 | 0
4444
Sim Acc Failures | 0 | 0
4545
----------------------------------------
46-
Faster Count | 756 | 1
47-
Draws | 8492 | 8492
46+
Faster Count | 6356 | 5
47+
Draws | 93639 | 93639
48+
################################################################################
49+
```
50+
51+
* Below are comparisons of some random extreme cases:
52+
```
53+
################################################################################
54+
FINAL STATISTICS
55+
################################################################################
56+
Total Tests: 100000
57+
----------------------------------------
58+
CATEGORY | S7RTT | RUCKIG
59+
----------------------------------------
60+
Plan Failures | 0 | 169
61+
Sim Acc Failures | 23 | 192
62+
----------------------------------------
63+
Faster Count | 418 | 91
64+
Draws | 99130 | 99130
4865
################################################################################
4966
```
5067

python/Test_Stress_WithRuckig.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import math
66

77
REPORT_RUCKIG_ISSUES = False
8-
REPORT_S7RTT_ISSUES = True
8+
REPORT_S7RTT_ISSUES = False
99
REPORT_RUCKIG_SLOWS = False
10-
REPORT_S7RTT_SLOWS = True
10+
REPORT_S7RTT_SLOWS = False
1111

1212
SIM_TOLERANCE = 1e-3
13+
RUCKIG_SCALE = 1000
1314

1415
try:
1516
from S7RTT import S7RTT, MotionState
@@ -65,11 +66,11 @@ def run_stress_test_with_sim(num_tests=10000):
6566
for i in range(1, num_tests + 1):
6667
cnt_total_run += 1
6768

68-
j_max = random.uniform(0.1, GLOBAL_J_LIMIT)
69-
a_upper_bound = min(GLOBAL_A_LIMIT, j_max * 10.0)
70-
a_max = random.uniform(0.1, a_upper_bound)
71-
v_upper_bound = min(GLOBAL_V_LIMIT, a_max * 10.0)
72-
v_max = random.uniform(0.1, v_upper_bound)
69+
j_max = random.uniform(10, GLOBAL_J_LIMIT)
70+
a_upper_bound = min(GLOBAL_A_LIMIT, j_max * 1.0)
71+
a_max = random.uniform(10, a_upper_bound)
72+
v_upper_bound = min(GLOBAL_V_LIMIT, a_max * 1.0)
73+
v_max = random.uniform(10, v_upper_bound)
7374

7475
p_limit = 5000.0
7576
p_start = random.uniform(-p_limit, p_limit)
@@ -119,15 +120,15 @@ def run_stress_test_with_sim(num_tests=10000):
119120
try:
120121
otg = Ruckig(1)
121122
inp = InputParameter(1)
122-
inp.current_position = [p_start]
123-
inp.current_velocity = [v_start]
124-
inp.current_acceleration = [a_start]
125-
inp.target_position = [p_target]
126-
inp.target_velocity = [v_target]
127-
inp.target_acceleration = [a_target]
128-
inp.max_velocity = [v_max]
129-
inp.max_acceleration = [a_max]
130-
inp.max_jerk = [j_max]
123+
inp.current_position = [p_start/RUCKIG_SCALE]
124+
inp.current_velocity = [v_start/RUCKIG_SCALE]
125+
inp.current_acceleration = [a_start/RUCKIG_SCALE]
126+
inp.target_position = [p_target/RUCKIG_SCALE]
127+
inp.target_velocity = [v_target/RUCKIG_SCALE]
128+
inp.target_acceleration = [a_target/RUCKIG_SCALE]
129+
inp.max_velocity = [v_max/RUCKIG_SCALE]
130+
inp.max_acceleration = [a_max/RUCKIG_SCALE]
131+
inp.max_jerk = [j_max/RUCKIG_SCALE]
131132

132133
res_traj = Trajectory(1)
133134
result = otg.calculate(inp, res_traj)
@@ -137,7 +138,7 @@ def run_stress_test_with_sim(num_tests=10000):
137138
final_state = res_traj.at_time(rk_dur)
138139
rk_end_p = final_state[0][0]
139140

140-
if abs(rk_end_p - p_target) > SIM_TOLERANCE:
141+
if abs(rk_end_p * RUCKIG_SCALE - p_target) > SIM_TOLERANCE / RUCKIG_SCALE :
141142
rk_ok = False
142143
cnt_rk_fail_sim += 1
143144
rk_error_reason = f"Accuracy Fail (Diff={abs(rk_end_p - p_target):.4f})"
@@ -225,6 +226,6 @@ def run_stress_test_with_sim(num_tests=10000):
225226

226227
if __name__ == "__main__":
227228
try:
228-
run_stress_test_with_sim(10000)
229+
run_stress_test_with_sim(100000)
229230
except KeyboardInterrupt:
230-
print("\nTesting stopped by user.")
231+
print("\nTesting stopped by user.")

0 commit comments

Comments
 (0)