from RobotVacuumCleaner import * import time rob = RobotVacuumCleaner() rob.moveForward(128, 1)
from RobotVacuumCleaner import * rob = RobotVacuumCleaner() rob.reset()
from RobotVacuumCleaner import * rob = RobotVacuumCleaner() leftStart, rightStart = rob.readEncoderValues() rob.controlWheels(100, 96, 2) leftEnd, rightEnd = rob.readEncoderValues() rightOverdrive = (float(rightEnd - rightStart) / float(leftEnd - leftStart)) print rightOverdrive rob.controlWheels(100, int(float(96) / rightOverdrive), 2) print int(float(92) / rightOverdrive) leftStart = leftEnd rightStart = rightEnd leftEnd, rightEnd = rob.readEncoderValues() verifyRightOverdrive = (float(rightEnd - rightStart) / float(leftEnd - leftStart)) print verifyRightOverdrive
from RobotVacuumCleaner import * rob = RobotVacuumCleaner() rob.start()
from RobotVacuumCleaner import * rob = RobotVacuumCleaner() rob.querySensors((21, 22, 23, 24, 25, 26, 35)) chargingState = rob.readU8() & 0x7 voltage = rob.readU16() current = rob.readI16() temperature = rob.readI8() batteryCharge = rob.readU16() batteryCapacity = rob.readU16() batteryChargePercent = float(batteryCharge) / float(batteryCapacity) * 100.0 oiMode = rob.readU8() & 0x3 print "Charging state: %d" % chargingState print "OI Mode: %d" % oiMode print "Voltage: %f V" % (float(voltage) / 1000.0) print "Current: %f A" % (float(current) / 1000.0) print "Temperature: %d deg C" % temperature print "Battery Charge: %d mAh (%f%%)" % (batteryCharge, batteryChargePercent) print "Battery Capacity: %d mAh" % batteryCapacity
from RobotVacuumCleaner import * rob = RobotVacuumCleaner() rob.stop()
from RobotVacuumCleaner import * rob = RobotVacuumCleaner() rob.readAngleSensor() leftStart, rightStart = rob.readEncoderValues() rob.turnRight(200, 1.05) leftEnd, rightEnd = rob.readEncoderValues() print float(leftEnd - leftStart) print float(rightStart - rightEnd) time.sleep(1) print rob.readAngleSensor()