Ejemplo n.º 1
0
        self.goBackwardToGrabTreasure()
        time.sleep(0.1)
        self.ascendArm()
        time.sleep(3)
        self.deactivateMagnet()
        time.sleep(0.1)
        return True


if __name__ == "__main__":
    # __init__(self, wheelManager, robotVision, maestro, spc):
    # def __init__(self, wheelManager, cameraTower, videoCapture):

    m = Controller()
    spc = SerialPortCommunicator()
    wm = WheelManager(spc)

    rv = RobotVision(wm, CameraTower(m), cv2.VideoCapture(0))
    pa = PositionAdjuster(wm, rv, m, spc)

    while True:
        print "Voltage : ", pa.readCondensatorVoltage()
        time.sleep(5)
    # a = raw_input("Press to mode recharge")
    # pa.rechargeMagnet()
    # a = raw_input("Press to mode stop magnet")
    # pa.deactivateMagnet()
    # a = raw_input("Press to start magnet")
    # pa.activateMagnet()
    # a = raw_input("Press to stop magnet")
    # pa.deactivateMagnet()
Ejemplo n.º 2
0
 def setUp(self):
     self.wheelMotorMock = MagicMock()
     self.serialPortCommunicator = MagicMock()
     self.wheelManager = WheelManager(self.serialPortCommunicator)
Ejemplo n.º 3
0
import fcntl
from threading import Thread
from socketIO_client import SocketIO
import time
from Client.Robot.Movement.WheelManager import WheelManager
from Logic.BotDispatcher import BotDispatcher
import subprocess
c = os.path.dirname(__file__)
configPath = os.path.join(c, "..", "..", "Shared", "config.json")

subprocess.call(['./cameraSettings.sh'])
with open(configPath) as json_data_file:
    config = json.load(json_data_file)
socketIO = SocketIO(config['url'], int(config['port']))
spc = SerialPortCommunicator()
botDispatcher = BotDispatcher(WheelManager(spc), Controller(), spc)



def goToNextPosition(data):
    print("heading toward next coordinates")
    botDispatcher.lastPositionGoneTo = (data['positionTOx'], data['positionTOy'])
    botDispatcher.followPath(data)


def startRound(json):
    print("start round")
    botDispatcher.lastPositionGoneTo = (json['positionX'], json['positionY'])
    socketIO.emit("needNewCoordinates")

def alignToTreasure(json):