This file contains hidden or 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
| # NOTE: this code should go in your userControl or "user_control" function | |
| # NOTE: I am assuming that you have the motor groups and other things defined before the constant-loop. | |
| while True: | |
| # the axis may be wrong, I'm blind coding this (not looking at the API docs for the axis) | |
| velocityMultiplier = controller.axis4.position() / 100 # get the current position (0-100) and divide it by 100 (becomes 0 or 1 or 0.something) | |
| sidewaysMultiplier = controller.axis3.position() / 100 # get the current position (0-100) and divide it by 100 (becomes 0 or 1 or 0.something) | |
| # HEY!!! new function! | |
| # the `abs(number)` function is literally the |number| in math. It gets the absolute value of whatever the number is. |