diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | System/__init__.py (renamed from System_Python/__init__.py) | 0 | ||||
-rw-r--r-- | System/encoder.py (renamed from System_Python/encoder.py) | 0 | ||||
-rw-r--r-- | System/homework8.ipynb (renamed from System_Python/homework8.ipynb) | 0 | ||||
-rw-r--r-- | System/initialize_system.py (renamed from System_Python/initialize_system.py) | 0 | ||||
-rw-r--r-- | System/motor.py (renamed from System_Python/motor.py) | 0 | ||||
-rw-r--r-- | System/swingUp.py (renamed from System_Python/swingUp.py) | 0 | ||||
-rw-r--r-- | System/system.py (renamed from System_Python/system.py) | 3 | ||||
-rw-r--r-- | System/system_swingup_test.py (renamed from System_Python/system_swingup_test.py) | 0 | ||||
-rw-r--r-- | System/test_Encoder.py (renamed from System_Python/test_Encoder.py) | 2 | ||||
-rw-r--r-- | System/test_Motor.py (renamed from System_Python/test_Motor.py) | 0 | ||||
-rw-r--r-- | System/test_Return_Home.py (renamed from System_Python/test_Return_Home.py) | 0 | ||||
-rw-r--r-- | System/test_System.py (renamed from System_Python/test_System.py) | 10 |
13 files changed, 11 insertions, 7 deletions
@@ -102,3 +102,6 @@ venv.bak/ # mypy .mypy_cache/ + +# Results +Results/*.csv diff --git a/System_Python/__init__.py b/System/__init__.py index e69de29..e69de29 100644 --- a/System_Python/__init__.py +++ b/System/__init__.py diff --git a/System_Python/encoder.py b/System/encoder.py index ece7fd1..ece7fd1 100644 --- a/System_Python/encoder.py +++ b/System/encoder.py diff --git a/System_Python/homework8.ipynb b/System/homework8.ipynb index a9c28c9..a9c28c9 100644 --- a/System_Python/homework8.ipynb +++ b/System/homework8.ipynb diff --git a/System_Python/initialize_system.py b/System/initialize_system.py index 4eb287a..4eb287a 100644 --- a/System_Python/initialize_system.py +++ b/System/initialize_system.py diff --git a/System_Python/motor.py b/System/motor.py index b22dbe2..b22dbe2 100644 --- a/System_Python/motor.py +++ b/System/motor.py diff --git a/System_Python/swingUp.py b/System/swingUp.py index f14ef37..f14ef37 100644 --- a/System_Python/swingUp.py +++ b/System/swingUp.py diff --git a/System_Python/system.py b/System/system.py index c6145ce..58ba541 100644 --- a/System_Python/system.py +++ b/System/system.py @@ -6,6 +6,7 @@ from datetime import datetime from time import sleep
import RPi.GPIO as GPIO
import sys
+import os
# IO pin definitions
### Motor pins
@@ -67,7 +68,7 @@ class System: # Create and setup results file (to be sent back to the server and displayed/downloaded to the user)
# Results file is a CSV with the following entries: angle, position, speed
- self.result_filename = "/home/pi/test_results/" + datetime.now().strftime("%d-%m-%Y_%H:%M:%S") + ".csv"
+ self.result_filename = "Results/" + os.path.basename(sys.argv[0]).split('.')[0] + "_results.csv"
result_file = open(self.result_filename, "w+")
result_file.write("angle(" + angular_units + "),position(inches),speed(percentage)\n")
diff --git a/System_Python/system_swingup_test.py b/System/system_swingup_test.py index e13c7ca..e13c7ca 100644 --- a/System_Python/system_swingup_test.py +++ b/System/system_swingup_test.py diff --git a/System_Python/test_Encoder.py b/System/test_Encoder.py index b667cc1..9a2119a 100644 --- a/System_Python/test_Encoder.py +++ b/System/test_Encoder.py @@ -3,7 +3,7 @@ import time # Decide which pins to hook up to on the Pi before running clk_pin = 2 -cs_pin = 4 +cs_pin = 14 data_pin = 3 e = Encoder(clk_pin, cs_pin, data_pin) diff --git a/System_Python/test_Motor.py b/System/test_Motor.py index 80cff1e..80cff1e 100644 --- a/System_Python/test_Motor.py +++ b/System/test_Motor.py diff --git a/System_Python/test_Return_Home.py b/System/test_Return_Home.py index 244f99f..244f99f 100644 --- a/System_Python/test_Return_Home.py +++ b/System/test_Return_Home.py diff --git a/System_Python/test_System.py b/System/test_System.py index 32ff56d..21ed336 100644 --- a/System_Python/test_System.py +++ b/System/test_System.py @@ -10,12 +10,12 @@ def control_function(angle): return (abs(angle) / 180.0) * 100.0
# Main program
-sys = System()
+sys = System(angular_units = 'Radians')
while 1:
angle, linear = sys.measure()
- #print(angle)
- speed = control_function(angle)
+ print(angle)
+ """speed = control_function(angle)
print(speed)
- sys.adjust(speed)
+ sys.adjust(speed)"""
time.sleep(0.05)
-
\ No newline at end of file +
|