Skip to content

Commit

Permalink
Add launch detection to example iface scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MB3hel committed Jun 11, 2023
1 parent 3da1f67 commit 2ec2234
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 7 deletions.
File renamed without changes.
5 changes: 4 additions & 1 deletion iface/example/gamepad_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

import signal
from .arp_gamepad import Gamepad, NetMgr
from arp_gamepad import Gamepad, NetMgr
import time
from control_board import ControlBoard, Simulator

Expand Down
6 changes: 5 additions & 1 deletion iface/example/gamepad_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

import signal
from .arp_gamepad import Gamepad, NetMgr
from arp_gamepad import Gamepad, NetMgr
import time
from control_board import ControlBoard, Simulator

Expand Down
7 changes: 6 additions & 1 deletion iface/example/gamepad_sassist.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

import signal
from .arp_gamepad import Gamepad, NetMgr
from arp_gamepad import Gamepad, NetMgr
import time
from control_board import ControlBoard, Simulator

Expand Down Expand Up @@ -85,3 +89,4 @@ def run(cb: ControlBoard, s: Simulator) -> int:
def dummy_handler(signum, frame):
# Used temporarily suppress ctrl-c
pass

4 changes: 4 additions & 0 deletions iface/example/mode_dhold.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import threading
Expand Down
4 changes: 4 additions & 0 deletions iface/example/mode_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import threading
Expand Down
4 changes: 4 additions & 0 deletions iface/example/mode_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import threading
Expand Down
4 changes: 4 additions & 0 deletions iface/example/mode_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import threading
Expand Down
4 changes: 4 additions & 0 deletions iface/example/mode_sassist1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import threading
Expand Down
4 changes: 4 additions & 0 deletions iface/example/mode_sassist2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import threading
Expand Down
4 changes: 4 additions & 0 deletions iface/example/motor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time

Expand Down
4 changes: 4 additions & 0 deletions iface/example/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator


Expand Down
4 changes: 4 additions & 0 deletions iface/example/sensordata.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator
import time
import platform
Expand Down
6 changes: 6 additions & 0 deletions iface/example/whyreset.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
# Version: 1.0.0
################################################################################

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)


from control_board import ControlBoard, Simulator


Expand All @@ -37,3 +42,4 @@ def run(cb: ControlBoard, s: Simulator) -> int:
print("Query reset cause failed!")
return 0


8 changes: 4 additions & 4 deletions iface/scripts/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")
exit(1)

from control_board import ControlBoard, Simulator


Expand All @@ -7,7 +11,3 @@ def run(cb: ControlBoard, s: Simulator) -> int:
# s will be None unless running under simulation, in which case it is a simulator instance
# Return an error code from this function (launch.py will exit with the error code returned here)
return 0


if __name__ == "__main__":
print("Do not run this script directly. Use launch.py to run it.")

0 comments on commit 2ec2234

Please sign in to comment.