Skip to content
Snippets Groups Projects
Commit 81670905 authored by mehtank's avatar mehtank
Browse files

Enable websockets

parent 6d2efe04
No related merge requests found
Pipeline #9 canceled with stages
......@@ -18,7 +18,7 @@ def convertServo(axis):
return rescale(joystick.get_axis(axis), 0, 180 )
def convertThrust(data):
return abs(rescale(data, -255, 255))
return abs(rescale(data, -80, 80))
#helper function to assign the proper hbridge values
def convertHBridge(data):
......@@ -35,7 +35,7 @@ def convertAxis(axis):
if __name__ == "__main__":
target = "ws://192.168.4.1:81"
#Set up connection to Blimp Board over websocket
#ws = create_connection(target)
ws = create_connection(target)
# Set up joystick
pygame.init()
......@@ -77,12 +77,12 @@ if __name__ == "__main__":
[ (180 - convertServo(camera_l) + convertServo(camera_r)) // 2 ]
print(cmd)
#ws.send_binary(cmd)
ws.send_binary(cmd)
pygame.time.wait(10)
pygame.time.wait(100)
except KeyboardInterrupt:
done = True
#ws.close()
ws.close()
pygame.quit()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment