Created
January 21, 2018 01:57
-
-
Save Inkering/33bf8f01b1aa2a2b20c400cff850289c to your computer and use it in GitHub Desktop.
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
| import math | |
| while(1): | |
| robotLeft = 0 | |
| robotRight = 0 | |
| x = float(input("Input x \n")) | |
| y = float(input("Input y \n")) | |
| z = float(input("Input z \n")) | |
| if (z < -0.1): | |
| robotLeft = -z | |
| elif (z > 0.1): | |
| robotRight = z | |
| else: | |
| power = math.sqrt((x * x) + (y * y)) | |
| if (power > 1): | |
| power = 1 | |
| if (y > 0): | |
| power =- power | |
| scale = 1 - abs(x) | |
| if (x > 0): | |
| # left | |
| robotLeft = power * scale | |
| robotRight = power | |
| elif (x < 0): | |
| # right | |
| robotLeft = power | |
| robotRight = power * scale | |
| print("robotleft output", robotLeft, "\n") | |
| print("robotRight output", robotRight, "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment