def __init__(self): Linkbot.__init__(self) self.x = 0 self.y = 0 self.theta = 0 self.wheelbase = 3.75 #inches self.wheeldiameter = 3.5 #inches
#!/usr/bin/env python from barobo import Linkbot, BaroboCtx import barobo import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connectBluetooth('00:06:66:4D:F6:6F') linkbot.setAcceleration(240) linkbot.recordAnglesBegin() for _ in range(3): linkbot.setJointStates([ barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD, barobo.ROBOT_BACKWARD ], [120, 120, 120]) time.sleep(2) linkbot.setJointStates([ barobo.ROBOT_BACKWARD, barobo.ROBOT_BACKWARD, barobo.ROBOT_FORWARD ], [120, 120, 120]) time.sleep(2) linkbot.stop() linkbot.recordAnglesEnd() linkbot.recordAnglesPlot()
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print(linkbot.getJointAngles())
#!/usr/bin/env python # File: move.py # Move both joints of a Linkbot-I 90 degrees. from barobo import Linkbot linkbot = Linkbot() linkbot.connect() print ("Moving both joints 90 degrees...") linkbot.move(90, 0, 90)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print (linkbot.getVersion())
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot2 = Linkbot() linkbot.connect() linkbot2.connect() linkbot.resetToZero() linkbot2.resetToZero() print ("Moving joints to 90 degrees...") linkbot.driveToNB(90, 90, 90) linkbot2.driveToNB(90, 90, 90) time.sleep(1) print ("Moving joints to 0 degrees...") linkbot.driveToNB(0, 0, 0) linkbot2.driveToNB(0, 0, 0)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() linkbot.recordAnglesBegin(delay=0.1) linkbot.smoothMoveTo(1, 100, 100, 120, 360) linkbot.smoothMoveTo(2, 100, 100, 120, 360) linkbot.smoothMoveTo(3, 100, 100, 120, 360) linkbot.moveWait() linkbot.recordAnglesEnd() linkbot.recordAnglesPlot()
#!/usr/bin/env python from barobo import Linkbot, BaroboCtx import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connectBluetooth('00:06:66:4D:F6:6F') linkbot.resetToZero() linkbot.recordAnglesBegin(delay=0.1) linkbot.smoothMoveTo(1, 100, 100, 100, 360) linkbot.smoothMoveTo(2, 100, 100, 100, 360) linkbot.smoothMoveTo(3, 100, 100, 100, 360) linkbot.moveWait() linkbot.recordAnglesEnd() linkbot.recordAnglesPlot()
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print (linkbot.getColorRGB())
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() for _ in range(5): print (linkbot.getBatteryVoltage()) time.sleep(0.5)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print (linkbot) print (linkbot.getVersion()) linkbot.recordAnglesBegin() s = raw_input('Press enter to continue...') linkbot.recordAnglesEnd() linkbot.recordAnglesPlot() for i in range(1,4): linkbot.setJointSpeed(i, 120) while True: linkbot.moveToNB(360, 0, -360) linkbot.moveWait() linkbot.moveToNB(0, 0, 0) linkbot.moveWait()
#!/usr/bin/env python from barobo import Linkbot import time import sys if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() linkbot.stop() linkbot.setMotorPowers(-255, -255, -255)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.reboot()
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print(linkbot.getSerialID())
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print("Moving joint 1 90 degrees...") linkbot.moveJoint(1, 90) time.sleep(1) print("Moving joint 2...") linkbot.moveJoint(2, 90) time.sleep(1) print("Moving joint 3...") linkbot.moveJoint(3, 90) time.sleep(1)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print(linkbot.getFormFactor())
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() for _ in range(20): print (linkbot.getAccelerometerData()) time.sleep(0.5)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() for i in range(1, 4): print("Joint {} angle: {}".format(i, linkbot.getJointAngle(i)))
#!/usr/bin/env python # Note: This demo will only work if you have a Barobo breakout-board currently # attached to the linkbot. from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() adcs = map(linkbot.getBreakoutADC, range(0,8)) print(map(lambda x: x/1024.0*5.0, adcs))
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print ("Moving joint 1 90 degrees...") linkbot.moveJoint(1, 90) time.sleep(1) print ("Moving joint 2...") linkbot.moveJoint(2, 90) time.sleep(1) print ("Moving joint 3...") linkbot.moveJoint(3, 90) time.sleep(1)
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() #linkbot.setAcceleration(120) linkbot.resetToZero() linkbot.moveTo(180, 180, 180) linkbot.moveTo(0, 0, 0) linkbot.disconnect() time.sleep(1) linkbot.connect() #linkbot.setAcceleration(120) linkbot.resetToZero() linkbot.moveTo(180, 180, 180) linkbot.moveTo(0, 0, 0)
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connectBaroboLink() linkbot.resetToZero() print("Moving joints to 90 degrees...") linkbot.driveTo(90, 90, 90) time.sleep(1) print("Moving joints to 0 degrees...") linkbot.driveTo(0, 0, 0)
#!/usr/bin/env python from barobo import Linkbot, BaroboCtx import sys if sys.version_info[0] == 3: raw_input = input def jointcb(millis, j1, j2, j3): print('joint: {} {} {} {}'.format(millis, j1, j2, j3)) def accelcb(millis, j1, j2, j3): print('accel: {} {} {} {}'.format(millis, j1, j2, j3)) if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() instr = 'c' jointThresh = 1 accelThresh = 0.1 jointCBEnabled = False accelCBEnabled = False while instr != 'q': instr = raw_input( 'Commands:\n' '1 : Enable/Disable joint callback\n' '2 : Enable/Disable accel callback\n' '3 : Increase joint threshold\n' '4 : Decrease joint threshold\n' '5 : Increase accel threshold\n'
#!/usr/bin/env python from barobo import Linkbot def callback(mask, buttons, userdata): print ("Button press! mask: {} buttons: {}".format(hex(mask), hex(buttons))) if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.enableButtonCallback(callback) raw_input('Button callbacks have been enabled. Press buttons on the Linkbot. Hit Enter when done')
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print ("Moving joint 1 90 degrees...") linkbot.driveJointTo(1, 0) time.sleep(1) linkbot.driveJointTo(1, 90) time.sleep(1) linkbot.driveJointTo(1, 0) time.sleep(1) print ("Moving joint 2...") linkbot.driveJointTo(2, 90) time.sleep(1) linkbot.driveJointTo(2, 0) time.sleep(1) print ("Moving joint 3...") linkbot.driveJointTo(3, 90) time.sleep(1) linkbot.driveJointTo(3, 0)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print ("Moving all joints 90 degrees...") linkbot.move(90, 90, 90)
#!/usr/bin/env python import barobo from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print("Moving joints forwards...") linkbot.setJointSpeeds(120, 120, 120) linkbot.moveContinuous(barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD) raw_input("Press enter to stop.") linkbot.stop()
#!/usr/bin/env python from barobo import Linkbot, BaroboCtx import barobo import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connectBluetooth('00:06:66:4D:F6:6F') linkbot.setAcceleration(240) linkbot.recordAnglesBegin() for _ in range(3): linkbot.setJointStates( [barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD, barobo.ROBOT_BACKWARD], [120, 120, 120]) time.sleep(2) linkbot.setJointStates( [barobo.ROBOT_BACKWARD, barobo.ROBOT_BACKWARD, barobo.ROBOT_FORWARD], [120, 120, 120]) time.sleep(2) linkbot.stop() linkbot.recordAnglesEnd() linkbot.recordAnglesPlot()
#!/usr/bin/env python # File: move.py # Move both joints of a Linkbot-I 90 degrees. from barobo import Linkbot linkbot = Linkbot() linkbot.connect() print("Moving both joints 90 degrees...") linkbot.move(90, 0, 90)
#!/usr/bin/env python import barobo from barobo import Linkbot, BaroboCtx import time import sys if __name__ == "__main__": if len(sys.argv) != 2: print('Usage: {0} <Bluetooth MAC Address>'.format(sys.argv[0])) sys.exit(0) linkbot = Linkbot() linkbot.connectMobotBluetooth(sys.argv[1]) linkbot.resetToZero() print ("Moving joints forwards...") linkbot.setJointSpeeds(-120, 120, 120) linkbot.moveContinuous(barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD) raw_input("Press enter to stop.") linkbot.moveContinuous(barobo.ROBOT_BACKWARD, barobo.ROBOT_BACKWARD, barobo.ROBOT_BACKWARD) raw_input("Press enter to stop.") linkbot.resetToZero() linkbot.stop()
#!/usr/bin/env python from barobo import Linkbot import time if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print("Moving joint 1 90 degrees...") linkbot.driveJointTo(1, 0) time.sleep(1) linkbot.driveJointTo(1, 90) time.sleep(1) linkbot.driveJointTo(1, 0) time.sleep(1) print("Moving joint 2...") linkbot.driveJointTo(2, 90) time.sleep(1) linkbot.driveJointTo(2, 0) time.sleep(1) print("Moving joint 3...") linkbot.driveJointTo(3, 90) time.sleep(1) linkbot.driveJointTo(3, 0)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() for i in range(1,4): print ("Joint {} angle: {}".format(i, linkbot.getJointAngle(i)))
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print(linkbot.getVersion())
#!/usr/bin/env python import barobo from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print ("Moving joints forwards...") linkbot.setJointSpeeds(120, 120, 120) linkbot.moveContinuous(barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD, barobo.ROBOT_FORWARD) raw_input("Press enter to stop.") linkbot.stop()
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() print (linkbot.getJointAngles())
#!/usr/bin/env python from barobo import Linkbot, Dongle import time if __name__ == "__main__": linkbot = Linkbot() linkbot2 = Linkbot() linkbot.connect() linkbot2.connect() linkbot.resetToZero() linkbot2.resetToZero() print("Moving joints to 90 degrees...") linkbot.driveToNB(90, 90, 90) linkbot2.driveToNB(90, 90, 90) time.sleep(1) print("Moving joints to 0 degrees...") linkbot.driveToNB(0, 0, 0) linkbot2.driveToNB(0, 0, 0)
#!/usr/bin/env python from barobo import Linkbot if __name__ == "__main__": linkbot = Linkbot() linkbot.connect() linkbot.resetToZero() print("Moving all joints 90 degrees...") linkbot.move(90, 90, 90)