aboutsummaryrefslogtreecommitdiffstats
path: root/System_Python/test_System.py
diff options
context:
space:
mode:
authordamic014 <damic014@umn.edu>2019-10-13 22:14:47 -0500
committerdamic014 <damic014@umn.edu>2019-10-13 22:14:47 -0500
commit9c54528920a03fe046c50bc582067d8f2514d1c8 (patch)
tree001e66d5200982387158b3bda93b27d53b2743cb /System_Python/test_System.py
parentEncoder class (diff)
downloadee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.tar
ee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.tar.gz
ee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.tar.bz2
ee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.tar.lz
ee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.tar.xz
ee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.tar.zst
ee4511w-9c54528920a03fe046c50bc582067d8f2514d1c8.zip
Add System library and system test file. Still need to finalize some implementation details (linear encoder, motor orientation, etc.). Need to compile and test on RPi still.
Convert naming in other libraries to follow Python naming scheme.
Diffstat (limited to 'System_Python/test_System.py')
-rw-r--r--System_Python/test_System.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/System_Python/test_System.py b/System_Python/test_System.py
new file mode 100644
index 0000000..af218e0
--- /dev/null
+++ b/System_Python/test_System.py
@@ -0,0 +1,17 @@
+# This test file implements a super simple control-type function for testing the System library.
+# DO NOT TEST ON ASSEMBLED PHYSICAL SYSTEM! It will probably break it.
+
+from system import System
+
+# Return a speed based on current encoder angle.
+# Convert an angle to speed (180 degrees = max speed)
+def control_function(angle):
+ return (angle / 180.0) * 100.0
+
+# Main program
+sys = System()
+while 1:
+ angle, linear = sys.measure()
+ speed = control_function(angle)
+ sys.adjust(speed)
+ \ No newline at end of file