-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
743572f
commit 3568511
Showing
7 changed files
with
134 additions
and
75 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
ros2/cmd/src/state_machines/function_tests/function_test_f5_4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#Test FV4. Obstacle detection. Lane Changing (goes straight, detects obstacle, and changes lanes) | ||
|
||
|
||
from State_Machine_Executor import main | ||
from State_Machine_Interface import Interface | ||
|
||
class Function_Test_F3_1(): | ||
def __init__(self, interface): | ||
self.interface = interface | ||
|
||
|
||
# State transistion logic | ||
def function_test(self): | ||
barrel_count = 0 | ||
barrel_data = [] | ||
self.interface.car_SM.Resume() | ||
|
||
ZED_TO_BUMPER = 0.4 | ||
barrel1_distance_threshold = 4.572 | ||
barrel2_distance_threshold = 3 | ||
stop_dist = 0.9144 | ||
|
||
while barrel_count < 1: | ||
barrel_data = self.interface.Object_Detection(barrel1_distance_threshold, object_lists=["Barrel"],check_in_lane=True) | ||
self.interface.Run() | ||
if(barrel_data[0]): | ||
self.interface.car_SM.Obj_Avoidance() | ||
if(self.interface.current_lane): | ||
self.interface.Run([0.254,-3.048,0]) | ||
else: | ||
self.interface.Run([0.254,3.048,0]) | ||
barrel_detected += 1 | ||
|
||
while barrel_count == 1: | ||
barrel_data = self.interface.Object_Detection(barrel2_distance_threshold, object_lists=["Barrel"],check_in_lane=True) | ||
self.interface.Run() | ||
if(barrel_data[0]): | ||
self.interface.car_SM.Stop_Trigger() | ||
self.interface.Run((barrel_data[1]+ZED_TO_BUMPER) - stop_dist) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
34 changes: 34 additions & 0 deletions
34
ros2/cmd/src/state_machines/function_tests/function_test_f6.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#Executor | ||
from State_Machine_Executor import main | ||
from State_Machine_Interface import Interface | ||
|
||
|
||
# Test FV.1 (Go straight and stop five feet away from detected person) | ||
|
||
class Function_Test_FV_1: | ||
# Get data from 5 meters away | ||
threshold_distance = 5 # meters | ||
|
||
def __init__(self, interface: Interface): | ||
self.interface = interface | ||
|
||
# State transistion logic | ||
def function_test(self): | ||
person_detected = False | ||
distance = 0 | ||
self.interface.car_sm.Resume() | ||
while not person_detected: | ||
obj_data = self.interface.Object_Detection( | ||
self.threshold_distance, object_list=["Person"] | ||
) | ||
if obj_data[0]: | ||
distance = obj_data[1] | ||
person_detected = True | ||
self.interface.Run() | ||
# 1.524 = 5 feet to meters | ||
self.interface.car_sm.Stop_Trigger() | ||
self.interface.Run(distance - 1.524) | ||
|
||
|
||
if __name__ == "__main__": | ||
main("Function_Test_Q3",Function_Test_FV_1) |
48 changes: 48 additions & 0 deletions
48
ros2/cmd/src/state_machines/function_tests/function_test_f7_1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#Test F7.1 Pothole Detection | ||
|
||
|
||
from State_Machine_Executor import main | ||
from State_Machine_Interface import Interface | ||
|
||
class Function_Test_F3_1(): | ||
def __init__(self, interface): | ||
self.interface = interface | ||
|
||
# State transistion logic | ||
def function_test(self): | ||
pothole_detected = False | ||
barrel_detected = False | ||
pothole_data = [] | ||
barrel_data = [] | ||
self.interface.car_SM.Resume() | ||
|
||
ZED_TO_BUMPER = 0.4 | ||
pothole_distance_threshold = 4.572 | ||
barrel_distance_threshold = 3 | ||
stop_dist = 0.9144 | ||
|
||
while not pothole_detected: | ||
pothole_data = self.interface.Object_Detection(pothole_distance_threshold, object_lists=["PotHole"],check_in_lane=True) | ||
self.interface.Run() | ||
if(pothole_data[0]): | ||
self.interface.car_SM.Obj_Avoidance() | ||
if(self.interface.current_lane): | ||
self.interface.Run([0.254,-3.048,0]) | ||
else: | ||
self.interface.Run([0.254,3.048,0]) | ||
pothole_detected = True | ||
|
||
while not barrel_detected: | ||
barrel_data = self.interface.Object_Detection(barrel_distance_threshold, object_lists=["Barrel"],check_in_lane=True) | ||
self.interface.Run() | ||
if(barrel_data[0]): | ||
self.interface.car_SM.Stop_Trigger() | ||
self.interface.Run((barrel_data[1]+ZED_TO_BUMPER) - stop_dist) | ||
barrel_detected = True | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
22 changes: 0 additions & 22 deletions
22
ros2/cmd/src/state_machines/function_tests/function_test_fv2.py
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
ros2/cmd/src/state_machines/function_tests/function_test_fv2_2.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
ros2/cmd/src/state_machines/function_tests/function_test_v4.py
This file was deleted.
Oops, something went wrong.