Skip to content

Instantly share code, notes, and snippets.

@Inkering
Created January 21, 2018 01:57
Show Gist options
  • Save Inkering/33bf8f01b1aa2a2b20c400cff850289c to your computer and use it in GitHub Desktop.
Save Inkering/33bf8f01b1aa2a2b20c400cff850289c to your computer and use it in GitHub Desktop.
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