Skip to content

Commit 031418e

Browse files
Created State Machine Blind
1 parent aa9a594 commit 031418e

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

ros2/CStop.py

Whitespace-only changes.

ros2/Lane_Change.py

Whitespace-only changes.

ros2/Lane_Follower.py

Whitespace-only changes.

ros2/Machine.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from statemachine import StateMachine, State
2+
3+
class Car(StateMachine):
4+
# State Machine for the Cooper Union Intelligent Ground Vehicle
5+
Lane_Following = State("LF")
6+
Lane_Change = State("LC")
7+
# C stop is Controlled, E stop is Emergency
8+
Cstop = State("CS",initial=True)
9+
Estop = State("ES",final=True)
10+
11+
12+
Resume = Cstop.to(Lane_Following)
13+
Obj_Avoidance = Lane_Following.to(Lane_Change)
14+
Stop_Trigger = Lane_Following.to(Cstop) | Lane_Change.to(Cstop)
15+
Emergency_Trigger =(
16+
Lane_Following.to(Estop)
17+
| Lane_Change.to(Estop)
18+
| Cstop.to(Estop)
19+
)
20+
Return_To_Follow = Lane_Change.to(Lane_Following)
21+
22+
#The Lane Follow State
23+
@Lane_Following.enter
24+
def Follow():
25+
print("Following Lanes")
26+
27+
28+
@Cstop.enter
29+
def on_CStop():
30+
print("Car is Stopped temporarily")
31+
32+
@Estop.enter
33+
def on_EStop():
34+
print("UH OH")
35+
36+
if "__name__" == "__main__":
37+
test_machin = Car()
38+
img_path = "visualizer.png"
39+
test_machin._graph().write_png(img_path)

0 commit comments

Comments
 (0)