예제 #1
0
def INIT(robot):
    retval = ask("Please enter the name of a device (ptz, camera, etc.)",
                 (("Device", ""), ))
    if retval["ok"]:
        return [retval["Device"]]
    else:
        raise "Cancelled!"
예제 #2
0
 def __init__(self, portname=None, baudrate=None):
     Device.__init__(self, deviceType='ptz')
     if portname == None or baudrate == None:
         if portname == None:
             portname = '/dev/ttyS3'
         if baudrate == None:
             baudrate = 9600
         result = ask("Please enter the parameters for the Canon PTZ", (
             ("Port name", portname),
             ("Baud rate", baudrate),
         ))
     else:
         result = {'Port name': portname, 'Baud rate': baudrate}
     self.port = serial.Serial(result['Port name'],
                               baudrate=result['Baud rate'])
     self._send(controlModePacket())
     self._send(initPacket())
     self._send(opticalZoomPacket(0))
     self._send(digitalZoomPacket(1))
     self._send(panSlewPacket(MAX_PAN_SLEW))
     self._send(tiltSlewPacket(MAX_TILT_SLEW))
     self._send(defaultTiltRangePacket())
     self._pan = 0
     self._tilt = 0
     self._zoom = 0
     self._magnify = 1
     self._panSpeed = MAX_PAN_SLEW
     self._tiltSpeed = MAX_TILT_SLEW
     self.supports = ['pan', 'tilt', 'zoom', 'magnify']
     print 'Canon PTZ device ready'
예제 #3
0
def INIT(robot):
    retval = ask("Please enter the name of a device (ptz, camera, etc.)",
                 (("Device", ""),))
    if retval["ok"]:
        return [retval["Device"]]
    else:
        raise "Cancelled!"
예제 #4
0
 def __init__(self, portname=None, baudrate=None):
     Device.__init__(self, deviceType='ptz')
     if portname == None or baudrate == None:
         if portname == None:
             portname = '/dev/ttyS3'
         if baudrate == None:
             baudrate = 9600
         result = ask("Please enter the parameters for the Canon PTZ",
                      (("Port name", portname),
                       ("Baud rate", baudrate),
                       ))
     else:
         result = {'Port name': portname, 'Baud rate': baudrate}
     self.port = serial.Serial(result['Port name'],
                               baudrate=result['Baud rate'])
     self._send(controlModePacket())
     self._send(initPacket())
     self._send(opticalZoomPacket(0))
     self._send(digitalZoomPacket(1))
     self._send(panSlewPacket(MAX_PAN_SLEW))
     self._send(tiltSlewPacket(MAX_TILT_SLEW))
     self._send(defaultTiltRangePacket())
     self._pan = 0
     self._tilt = 0
     self._zoom = 0
     self._magnify = 1
     self._panSpeed = MAX_PAN_SLEW
     self._tiltSpeed = MAX_TILT_SLEW
     self.supports = ['pan', 'tilt', 'zoom', 'magnify']
     print 'Canon PTZ device ready'
예제 #5
0
def INIT():
    # For serial connected Roomba:
    dict = ask("What serial port is the Roomba connected to?",
               [("Serial Port", "/dev/rfcomm0"), ("Transfer rate", "57600")])
    return Roomba(port=dict["Serial Port"],
                  rate=int(dict["Transfer rate"]),
                  subtype="Roomba")
예제 #6
0
def INIT(robot):
    retval = ask(
        "Please enter what sensor group you would like to view (all, left, right, front-right, etc.)",
        (("Sensor group", ""), ))
    if retval["ok"]:
        return {"view": SimplePlot(robot, retval["Sensor group"])}
    else:
        raise "Cancelled!"
예제 #7
0
def INIT():
    # For serial connected Roomba:
    dict = ask("What serial port is the Roomba connected to?",
               [("Serial Port", "/dev/rfcomm0"),
                ("Transfer rate", "57600")])
    return Roomba(port = dict["Serial Port"],
                  rate = int(dict["Transfer rate"]),
                  subtype = "Roomba")
예제 #8
0
def INIT(robot):
    retval = ask("Please enter what sensor group you would like to view (all, left, right, front-right, etc.)",
                 (("Sensor group", ""),
                  ))
    if retval["ok"]:
        return {"view": SimplePlot(robot, retval["Sensor group"])}
    else:
        raise "Cancelled!"
예제 #9
0
def INIT(robot):
    retval = ask("Please enter the index numbers of the left and right cameras",
                 (("Left", "0"),
                  ("Right", "1"),
                  ))
    left = int(retval["Left"])
    right = int(retval["Right"])
    leftCamera = robot.camera[left]
    rightCamera = robot.camera[right]
    return {"camera": StereoCamera(leftCamera, rightCamera)}
예제 #10
0
def INIT(robot):
    retval = ask(
        "Please enter the index numbers of the left and right cameras", (
            ("Left", "0"),
            ("Right", "1"),
        ))
    left = int(retval["Left"])
    right = int(retval["Right"])
    leftCamera = robot.camera[left]
    rightCamera = robot.camera[right]
    return {"camera": StereoCamera(leftCamera, rightCamera)}
예제 #11
0
def INIT():
    retval = ask("Please enter the Hemisson Data",
                 (("Port", "6665"),
                  ("Baud", 115200)))
    if retval["ok"]:
        # For serial connected Hemisson:
        return KheperaRobot(port = retval["Port"],
                            rate = int(retval["Baud"]),
                            subtype = "Hemisson")
    else:
        raise "Cancelled!" 
예제 #12
0
def INIT():
	retval = ask("Please enter the Simulator Connection Data",
		     (("Port", "60000"),
		      ("Host", "localhost"),
		      ("Start devices", "1"),))
	if retval["ok"]:
		return TCPRobot(retval["Host"],
				int(retval["Port"]),
				startDevices=int(retval["Start devices"]))
	else:
		raise "Cancelled!"
예제 #13
0
def INIT():
    retval = ask("Please enter the Simulator Connection Data", (
        ("Port", "60000"),
        ("Host", "localhost"),
        ("Start devices", "1"),
    ))
    if retval["ok"]:
        return TCPRobot(retval["Host"],
                        int(retval["Port"]),
                        startDevices=int(retval["Start devices"]))
    else:
        raise "Cancelled!"
예제 #14
0
def INIT(robot):
    retval = ask("Please enter the parameters for the Video4Linux Camera",
                 (("Width", "160"),
                  ("Height", "120"),
                  ("Channel", "0"),                  
                  ))
    if retval["ok"]:
        return {"camera" : V4LCamera( int(retval["Width"]), 
                                      int(retval["Height"]), 
                                      channel = int(retval["Channel"]), 
                                      visionSystem = VisionSystem())}
    else:
        raise "Cancelled!"
예제 #15
0
def INIT():
    retval = ask("Please enter the Player Data",
                 (("Port", "6665"), ("Host", "localhost"),
                  ("Start devices?", "yes")))
    if retval["ok"]:
        startDevices = 1
        if retval["Start devices?"] != "yes":
            startDevices = 0
        return PlayerRobot("Player6665",
                           port=int(retval["Port"]),
                           hostname=retval["Host"],
                           startDevices=startDevices)
    else:
        raise "Cancelled!"
예제 #16
0
def INIT(robot):
    if len(robot.camera) == 1:
        index = 0
    elif len(robot.camera) > 1:
        retval = ask("Please enter the index number of the camera to split 2 ways", (("Index", "0"),))

        index = int(retval["Index"])
    else:
        raise AttributeError, "you need a camera already loaded"
    baseCamera = robot.camera[index]
    cameras = [0] * 2
    for i in range(2):
        cameras[i] = FourwayCamera(baseCamera, 2, i)
    return [{"camera": cameras[0]}, {"camera": cameras[1]}]
예제 #17
0
def INIT(robot):
    retval = ask("Please enter the parameters for the Video4Linux Camera",
                 (("Device", "/dev/video0"),
                  ("Width", "160"),
                  ("Height", "120"),
                  ("Channel", "0"),                  
                  ))
    if retval["ok"]:
        return {"camera" : V4LCamera( int(retval["Width"]), 
                                      int(retval["Height"]), 
                                      device = retval["Device"],
                                      channel = int(retval["Channel"]), 
                                      visionSystem = VisionSystem())}
    else:
        raise "Cancelled!"
예제 #18
0
def INIT():
    retval = ask("Please enter the Player Data",
                 (("Port", "6665"),
                  ("Host", "localhost"),
                  ("Start devices?", "yes")))
    if retval["ok"]:
        startDevices = 1
        if retval["Start devices?"] != "yes":
            startDevices = 0
        return PlayerRobot("Player6665",
                           port = int(retval["Port"]),
                           hostname = retval["Host"],
                           startDevices=startDevices)
    else:
        raise "Cancelled!"
예제 #19
0
def INIT(robot):
    if len(robot.camera) == 1:
        index = 0
    elif len(robot.camera) > 1:
        retval = ask(
            "Please enter the index number of the camera to split 2 ways",
            (("Index", "0"), ))

        index = int(retval["Index"])
    else:
        raise AttributeError("you need a camera already loaded")
    baseCamera = robot.camera[index]
    cameras = [0] * 2
    for i in range(2):
        cameras[i] = FourwayCamera(baseCamera, 2, i)
    return [{"camera": cameras[0]}, {"camera": cameras[1]}]
예제 #20
0
def INIT(robot):
    if len(robot.camera) == 1:
        index = 0
    elif len(robot.camera) > 1:
        retval = ask("Please enter the index number of the camera to split 4 ways",
                     (("Index", "0"),))
        
        index = int(retval["Index"])
    else:
        raise AttributeError, "you need a camera already loaded"
    baseCamera = robot.camera[index]
    cameras = [0] * 4
    rotate = [0] * 4
    rotate[2] = 1
    for i in range(4):
        cameras[i] = FourwayCamera(baseCamera, 4, i, rotate[i])
    return [{"camera": cameras[0]},
            {"camera": cameras[1]},
            {"camera": cameras[2]},
            {"camera": cameras[3]}]
예제 #21
0
def INIT():
    # replace "aibo" with your dog's IP or DNS name
    dict = ask("Which Rovio do you wish to connect to?",
               [("Rovio IP/URL", "")])
    return RovioRobot(dict["Rovio IP/URL"]) 
예제 #22
0
def INIT():
    # replace "aibo" with your dog's IP or DNS name
    dict = ask("What Aibo do you want to connect onto?",
               [("AIBO name or IP", "")])
    return AiboRobot(dict["AIBO name or IP"]) 
예제 #23
0
def INIT():
    dict = ask("Which Rovio do you wish to connect to?",
               [("Rovio IP/URL", "")])
    return RovioRobot(dict["Rovio IP/URL"]) 
예제 #24
0
def INIT():
    # replace "aibo" with your dog's IP or DNS name
    dict = ask("Which Rovio do you wish to connect to?", [("Rovio IP/URL", "")])
    return RovioRobot(dict["Rovio IP/URL"])
예제 #25
0
def INIT():
    dict = ask("Which Rovio do you wish to connect to?",
               [("Rovio IP/URL", "")])
    return RovioRobot(dict["Rovio IP/URL"])
예제 #26
0
def INIT():
    # replace "aibo" with your dog's IP or DNS name
    dict = ask("What Aibo do you want to connect onto?",
               [("AIBO name or IP", "")])
    return AiboRobot(dict["AIBO name or IP"])