Example #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!"
Example #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'
Example #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!"
Example #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'
Example #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")
Example #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!"
Example #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")
Example #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!"
Example #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)}
Example #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)}
Example #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!" 
Example #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!"
Example #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!"
Example #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!"
Example #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!"
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]}]
Example #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!"
Example #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!"
Example #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]}]
Example #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]}]
Example #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"]) 
Example #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"]) 
Example #23
0
def INIT():
    dict = ask("Which Rovio do you wish to connect to?",
               [("Rovio IP/URL", "")])
    return RovioRobot(dict["Rovio IP/URL"]) 
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"])
Example #25
0
def INIT():
    dict = ask("Which Rovio do you wish to connect to?",
               [("Rovio IP/URL", "")])
    return RovioRobot(dict["Rovio IP/URL"])
Example #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"])