def connectProxies(self):
     cfg = config.load(sys.argv[1])
     self.jdrc = comm.init(cfg, "precise_landing")
     self.myCMDVel = self.jdrc.getCMDVelClient("precise_landing.myCMDVel")
     if not self.myCMDVel:
         raise Exception("could not create client with name:myCMDVel")
     print("myCMDVel is connected")
     self.myCamera = self.jdrc.getCameraClient("precise_landing.myCamera")
     if not self.myCamera:
         raise Exception("could not create client with name:myCamera")
     print("myCamera is connected")
     self.myDroneExtra = self.jdrc.getArDroneExtraClient(
         "precise_landing.myDroneExtra")
     if not self.myDroneExtra:
         raise Exception("could not create client with name:myDroneExtra")
     print("myDroneExtra is connected")
     self.myNavData = self.jdrc.getNavdataClient(
         "precise_landing.myNavData")
     if not self.myNavData:
         raise Exception("could not create client with name:myNavData")
     print("myNavData is connected")
     self.myPose3D = self.jdrc.getPose3dClient("precise_landing.myPose3D")
     if not self.myPose3D:
         raise Exception("could not create client with name:myPose3D")
     print("myPose3D is connected")
예제 #2
0
def getCamera(cfg):
    cfg = config.load(sys.argv[1])
    jdrc = comm.init(cfg, 'Color_Filter')
    proxy = jdrc.getCameraClient('Color_Filter')
    from Camera.cameraSegment import CameraSegment
    cam = CameraSegment(proxy)
    return cam
	def connectProxies(self):
		cfg = config.load(sys.argv[1])
		self.jdrc = comm.init(cfg, "force_landing")
		self.myExtra = self.jdrc.getArDroneExtraClient("force_landing.myExtra")
		if not self.myExtra:
			raise Exception("could not create client with name:myExtra")
		print("myExtra is connected")
예제 #4
0
	def __init__(self,argv=sys.argv):
		self.lock = threading.Lock()
		self.dist=0
		self.ic = None
		try:
			cfg = config.load(sys.argv[1])
			jdrc = comm.init(cfg, 'Referee')
			self.ic = jdrc.getIc()
			self.properties = self.ic.getProperties()

			proxyStr = jdrc.getConfig().getProperty("Referee.CatPose3D.Proxy")
			self.basePoseAr = self.ic.stringToProxy(proxyStr)
			self.poseProxy = jderobot.Pose3DPrx.checkedCast(self.basePoseAr)
			print self.poseProxy
			if not self.basePoseAr:
				raise Runtime("Cat Pose3D -> Invalid proxy")
	
			proxyStr = jdrc.getConfig().getProperty("Referee.MousePose3D.Proxy")
			self.baseRedPoseAr = self.ic.stringToProxy(proxyStr)
			self.poseRedProxy = jderobot.Pose3DPrx.checkedCast(self.baseRedPoseAr)
			print self.poseRedProxy
			if not self.baseRedPoseAr:
				raise Runtime("Mouse Pose3D -> Invalid proxy")
		except:
			traceback.print_exc()
			status = 1
    def __init__(self, configFile, cam):

        cfg = config.load(configFile)
        #starting comm
        jdrc = comm.init(cfg, '3DReconstruction')
        ic = jdrc.getIc()
        properties = ic.getProperties()

        data = jdrc.getConfig().getProperty("3DReconstruction." + cam +
                                            ".data")
        print(data)

        self.K = np.array([
            data["K"][0], data["K"][1], data["K"][2], data["K"][4],
            data["K"][5], data["K"][6], data["K"][8], data["K"][9],
            data["K"][10]
        ],
                          dtype=np.double).reshape(3, 3)
        self.RT = np.array([
            data["RT"][0], data["RT"][1], data["RT"][2], data["RT"][3],
            data["RT"][4], data["RT"][5], data["RT"][6], data["RT"][7],
            data["RT"][8], data["RT"][9], data["RT"][10], data["RT"][11], 0, 0,
            0, 1
        ],
                           dtype=np.double).reshape(4, 4)
        self.width = data["Size"][0]
        self.height = data["Size"][1]
예제 #6
0
def selectVideoSource(cfg):
    """
    @param cfg: configuration
    @return cam: selected camera
    @raise SystemExit in case of unsupported video source
    """
    source = cfg['ObjectDetector']['Source']
    if source.lower() == 'local':
        from Camera.local_camera import Camera
        cam_idx = cfg['ObjectDetector']['Local']['DeviceNo']
        print('  Chosen source: local camera (index %d)' % (cam_idx))
        cam = Camera(cam_idx)
    elif source.lower() == 'video':
        from Camera.local_video import Camera
        video_path = cfg['ObjectDetector']['Video']['Path']
        print('  Chosen source: local video (%s)' % (video_path))
        cam = Camera(video_path)
    elif source.lower() == 'stream':
        # comm already prints the source technology (ICE/ROS)
        import comm
        import config
        cfg = config.load(sys.argv[1])
        jdrc = comm.init(cfg, 'ObjectDetector')
        proxy = jdrc.getCameraClient('ObjectDetector.Stream')
        from Camera.stream_camera import Camera
        cam = Camera(proxy)
    else:
        raise SystemExit(
            ('%s not supported! Supported source: Local, Video, Stream') %
            (source))

    return cam
예제 #7
0
    def __init__(self, argv=sys.argv):
        self.lock = threading.Lock()
        self.dist = 0
        self.ic = None
        try:
            cfg = config.load(sys.argv[1])
            jdrc = comm.init(cfg, 'Referee')
            self.ic = jdrc.getIc()
            self.properties = self.ic.getProperties()

            proxyStr = jdrc.getConfig().getProperty("Referee.CatPose3D.Proxy")
            self.basePoseAr = self.ic.stringToProxy(proxyStr)
            self.poseProxy = jderobot.Pose3DPrx.checkedCast(self.basePoseAr)
            print self.poseProxy
            if not self.basePoseAr:
                raise Runtime("Cat Pose3D -> Invalid proxy")

            proxyStr = jdrc.getConfig().getProperty(
                "Referee.MousePose3D.Proxy")
            self.baseRedPoseAr = self.ic.stringToProxy(proxyStr)
            self.poseRedProxy = jderobot.Pose3DPrx.checkedCast(
                self.baseRedPoseAr)
            print self.poseRedProxy
            if not self.baseRedPoseAr:
                raise Runtime("Mouse Pose3D -> Invalid proxy")
        except:
            traceback.print_exc()
            status = 1
예제 #8
0
    def __init__(self):
        """
        Camera object constructor
        @param data: parsed YAML config. file
        """
        # Creation of the Camera through the comm-ICE proxy.
        try:
            cfg = config.load(sys.argv[1])
        except IndexError:
            raise SystemExit("Error: Missing YML file. \n Usage: python2"
                             "digitclassifier.py digitclassifier.yml")

        jdrc = comm.init(cfg, "DigitClassifier")

        self.lock = threading.Lock()

        # Acquire first image
        try:
            self.cam = jdrc.getCameraClient("DigitClassifier.Camera")

            if self.cam.hasproxy():
                self.im = self.cam.getImage()
            else:
                print("Interface camera not connected")
                exit()

        except:
            traceback.print_exc()
            exit()
예제 #9
0
	def connectProxies(self):
		cfg = config.load(sys.argv[1])
		self.jdrc = comm.init(cfg, "sample1")
		self.myMotors = self.jdrc.getMotorsClient("sample1.myMotors")
		if not self.myMotors:
			raise Exception("could not create client with name:myMotors")
		print("myMotors is connected")
예제 #10
0
def init(port: str, baudrate: int):
    comm.init(port, baudrate)

    # test device
    comm.execute('AT')

    # disable echo
    # comm.execute('ATE0')

    # enable call indication
    # comm.execute('AT+CLIP=1')
    comm.execute('AT+CMGF=0')
    comm.execute('AT+CPMS=?')
    comm.execute('AT+CPMS?')
    comm.execute('AT+CPMS="MT","ME","SM"')
    comm.execute('AT+CPMS="SM"')
    # comm.execute('AT+CMGD=1,4')
    logging.info('init serial')
예제 #11
0
    def __init__(self):
        cfg = config.load("follow_line_conf.yml")
        #starting comm
        jdrc = comm.init(cfg, 'FollowLineF1')

        self.camera = jdrc.getCameraClient("FollowLineF1.Camera")
        self.motors = jdrc.getMotorsClient("FollowLineF1.Motors")

        self.algorithm = MyAlgorithm(self.camera, self.motors)

        print "Follow_Line Components initialized OK"
 def connectProxies(self):
     cfg = config.load(sys.argv[1])
     self.jdrc = comm.init(cfg, "pose_simulated")
     self.myCmdvel = self.jdrc.getCMDVelClient("pose_simulated.myCmdvel")
     if not self.myCmdvel:
         raise Exception("could not create client with name:myCmdvel")
     print("myCmdvel is connected")
     self.myCamera = self.jdrc.getCameraClient("pose_simulated.myCamera")
     if not self.myCamera:
         raise Exception("could not create client with name:myCamera")
     print("myCamera is connected")
예제 #13
0
    def __init__(self, cfg):

        print("En constructor")
        cfg = config.load(cfg)

        #starting comm
        jdrc = comm.init(cfg, 'JdeRobotKids.Sim')
        self.camera = jdrc.getCameraClient("JdeRobotKids.Sim.Camera")
        self.motors = jdrc.getMotorsClient("JdeRobotKids.Sim.Motors")
        self.irLeft = jdrc.getIRClient("JdeRobotKids.Sim.IRLeft")
        self.irRight = jdrc.getIRClient("JdeRobotKids.Sim.IRRight")
        self.us = jdrc.getSonarClient("JdeRobotKids.Sim.Sonar")
예제 #14
0
    def __init__(self, cfg):
	 
        print("En constructor")
        cfg = config.load(cfg)
        
        #starting comm
        jdrc= comm.init(cfg, 'JdeRobotKids.Sim')
        self.camera = jdrc.getCameraClient("JdeRobotKids.Sim.Camera")
        self.motors = jdrc.getMotorsClient("JdeRobotKids.Sim.Motors")    
        self.irLeft = jdrc.getIRClient("JdeRobotKids.Sim.IRLeft")    
        self.irRight = jdrc.getIRClient("JdeRobotKids.Sim.IRRight") 
        self.us = jdrc.getSonarClient("JdeRobotKids.Sim.Sonar")    
예제 #15
0
    def __init__(self):
        cfg = config.load("Kibotics.yml")
        print("En constructor")
        Kibotics.__init__(self)
        #cfg = config.load(cfg)

        #starting comm
        jdrc = comm.init(cfg, 'Kibotics.Sim')
        self.camera = jdrc.getCameraClient("Kibotics.Sim.Camera")
        self.motors = jdrc.getMotorsClient("Kibotics.Sim.Motors")
        self.irLeft = jdrc.getIRClient("Kibotics.Sim.IRLeft")
        self.irRight = jdrc.getIRClient("Kibotics.Sim.IRRight")
        self.us = jdrc.getSonarClient("Kibotics.Sim.Sonar")
예제 #16
0
	def connectProxies(self):
		cfg = config.load(sys.argv[1])
		self.jdrc = comm.init(cfg, "bump_and_go")
		self.myMotors = self.jdrc.getMotorsClient("bump_and_go.myMotors")
		if not self.myMotors:
			raise Exception("could not create client with name:myMotors")
		print("myMotors is connected")
		self.myLaser = self.jdrc.getLaserClient("bump_and_go.myLaser")
		if not self.myLaser:
			raise Exception("could not create client with name:myLaser")
		print("myLaser is connected")
		self.myPose = self.jdrc.getPose3dClient("bump_and_go.myPose")
		if not self.myPose:
			raise Exception("could not create client with name:myPose")
		print("myPose is connected")
예제 #17
0
    def __init__(self):
        
        cfg = config.load("vacuum_cleaner_conf.yml")

        #starting comm
        jdrc= comm.init(cfg,'VacuumCleaner')

        self.motors = jdrc.getMotorsClient("VacuumCleaner.Motors")
        self.pose3d = jdrc.getPose3dClient("VacuumCleaner.Pose3D")
        self.laser = jdrc.getLaserClient("VacuumCleaner.Laser").hasproxy()
        self.bumper = jdrc.getBumperClient("VacuumCleaner.Bumper")

        self.algorithm = MyAlgorithm(self.motors, self.pose3d, self.laser, self.bumper)

        print "Vacuum_Cleaner initialized OK"
예제 #18
0
    def __init__(self,configFile,cam):

        cfg = config.load(configFile)
        #starting comm
        jdrc= comm.init(cfg, '3DReconstruction')
        ic = jdrc.getIc()
        properties = ic.getProperties()

        data = jdrc.getConfig().getProperty("3DReconstruction."+cam+".data")
        print(data)

        self.K=np.array([data["K"][0],data["K"][1],data["K"][2],data["K"][4], data["K"][5],data["K"][6],data["K"][8],data["K"][9],data["K"][10]],dtype=np.double).reshape(3,3)
        self.RT=np.array([data["RT"][0],data["RT"][1],data["RT"][2],data["RT"][3], data["RT"][4],data["RT"][5],data["RT"][6],data["RT"][7],data["RT"][8],data["RT"][9],data["RT"][10],data["RT"][11],0,0,0,1],dtype=np.double).reshape(4,4)
        self.width=data["Size"][0]
        self.height=data["Size"][1]
예제 #19
0
	def connectProxies(self):
		cfg = config.load(sys.argv[1])
		self.jdrc = comm.init(cfg, "escenario_combinado")
		self.myCmdvel = self.jdrc.getCMDVelClient("escenario_combinado.myCmdvel")
		if not self.myCmdvel:
			raise Exception("could not create client with name:myCmdvel")
		print("myCmdvel is connected")
		self.myCamera = self.jdrc.getCameraClient("escenario_combinado.myCamera")
		if not self.myCamera:
			raise Exception("could not create client with name:myCamera")
		print("myCamera is connected")
		self.myExtra = self.jdrc.getArDroneExtraClient("escenario_combinado.myExtra")
		if not self.myExtra:
			raise Exception("could not create client with name:myExtra")
		print("myExtra is connected")
예제 #20
0
파일: vacuum.py 프로젝트: pmvera/Jupyter
    def __init__(self):
        cfg = config.load("vacuum_conf.yml")

        #starting comm
        jdrc = comm.init(cfg, 'VacuumSLAM')

        self.motors = jdrc.getMotorsClient("VacuumSLAM.Motors")
        self.pose3d = jdrc.getPose3dClient("VacuumSLAM.Pose3D")
        self.laser = jdrc.getLaserClient("VacuumSLAM.Laser").hasproxy()
        self.bumper = jdrc.getBumperClient("VacuumSLAM.Bumper")

        #algorithm=MyAlgorithm(pose3d, motors,laser,bumper)
        self.algorithm = MyAlgorithm(self.pose3d, self.motors, self.laser,
                                     self.bumper)

        print "Vacuum SLAM Component initialized OK"
예제 #21
0
    def __init__(self, cfg):
        """
        Init method.

        @param cfg:
        """
        jdrc = comm.init(cfg, 'robot')

        # variables

        self.__vel = CMDVel()

        # get clients
        self.__pose3d_client = jdrc.getPose3dClient("robot.Pose3D")
        self.__motors_client = jdrc.getMotorsClient("robot.Motors")
        self.__laser_client = jdrc.getLaserClient("robot.Laser")
예제 #22
0
 def connectProxies(self):
     cfg = config.load(sys.argv[1])
     self.jdrc = comm.init(cfg, "prueba2")
     self.myCMDVel = self.jdrc.getCMDVelClient("prueba2.myCMDVel")
     if not self.myCMDVel:
         raise Exception("could not create client with name:myCMDVel")
     print("myCMDVel is connected")
     self.myPose3d = self.jdrc.getPose3dClient("prueba2.myPose3d")
     if not self.myPose3d:
         raise Exception("could not create client with name:myPose3d")
     print("myPose3d is connected")
     self.myDroneExtra = self.jdrc.getArDroneExtraClient(
         "prueba2.myDroneExtra")
     if not self.myDroneExtra:
         raise Exception("could not create client with name:myDroneExtra")
     print("myDroneExtra is connected")
예제 #23
0
    def __init__(self, cfg):
        """
        Init method.
        @param cfg:
        """
        #starting comm
        jdrc = comm.init(cfg, 'drone')

        self.frontalCamera = False

        #get clients
        self.__pose3d_client = jdrc.getPose3dClient("drone.Pose3D")
        self.__camera_client = jdrc.getCameraClient("drone.Camera1")
        self.__cmdvel_client = jdrc.getCMDVelClient("drone.CMDVel")
        self.__extra_client = jdrc.getArDroneExtraClient("drone.Extra")
        self.__navdata_client = jdrc.getNavdataClient("drone.Navdata")
예제 #24
0
	def __init__(self):
		cfg 		= config.load('/home/abhay/Desktop/autopark.cfg')
		jdrc		= comm.init(cfg, 'Autopark')
		self.motors = jdrc.getMotorsClient ("Autopark.Motors")
		self.pose3d = jdrc.getPose3dClient("Autopark.Pose3D")
		self.laser 	= jdrc.getLaserClient("Autopark.Laser").hasproxy()
		self.goal 	= {}
		self.state 	= {}
		self.epsLen	= 10 # in cm
		self.epsyaw = 5.*np.pi/180.
		self.dt 	= 1
		self.ticks	= 0
		self.tPnlty	= .001
		self.rewardParameter = 200
		self.action_space = np.zeros((2, ))
		self.observation_space = np.zeros((64, ))
		self.maxV	= .4 # in m/s
		self.maxW	= .5 # in rad/s
		self.death	= 'Time'
		self.info	= ''
		self.ERASE_LINE = '\x1b[2K'
예제 #25
0
    def __init__(self, cfgPath):
        ''' Camera class gets images from live video and transform them
        in order to predict the digit in the image.
        '''
        status = 0

        print "in cam"
        print cfgPath
        # Creation of the camera through the comm-ICE proxy.
        try:
            cfg = config.load(cfgPath)
        except IndexError:
            raise SystemExit(
                'Missing YML file. Usage: python2 objectdetector.py objectdetector.yml'
            )

        jdrc = comm.init(cfg, 'ObjectDetector')

        self.lock = threading.Lock()

        try:

            self.cam = jdrc.getCameraClient('ObjectDetector.Camera')

            if self.cam.hasproxy():
                self.im = self.cam.getImage()
                self.im_height = self.im.height
                self.im_width = self.im.width

                print('Image size: {0}x{1} px'.format(self.im_width,
                                                      self.im_height))
            else:
                print("Interface camera not connected")

        except:
            traceback.print_exc()
            exit()
            status = 1
    def __init__(self):
        try:
            cfg = config.load(sys.argv[1])
        except IndexError:
            raise SystemExit(
                'Missing YML file. Usage: python2 objectdetector.py objectdetector.yml'
            )
        self.lock = threading.Lock()
        try:
            jdrc = comm.init(cfg, 'ObjectDetector')
            self.cam = jdrc.getCameraClient('ObjectDetector.Camera')
            if (self.cam.hasproxy()):
                self.im = self.cam.getImage()
                self.im_height = self.im.height
                self.im_width = self.im.width
                print(str(self.im_height) + " " + str(self.im_width))
            else:
                print("No camera interface is connected")
                exit()

        except:
            traceback.print_exc()
            exit()
            status = 1
예제 #27
0
import comm
from gui.threadGUI import ThreadGUI
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication
import config

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc = comm.init(cfg, 'basic_component')

    camera = jdrc.getCameraClient("basic_component.Camera")
    motors = jdrc.getMotorsClient("basic_component.Motors")

    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setMotors(motors)
    frame.setCamera(camera)
    frame.show()

    t2 = ThreadGUI(frame)
    t2.daemon = True
    t2.start()

    sys.exit(app.exec_())
예제 #28
0
    def __init__(self):
        self.lock = threading.Lock()
        self.playButton = False

        try:
            cfg = config.load(sys.argv[1])
            #starting comm
            jdrc = comm.init(cfg, '3DReconstruction')

            ic = jdrc.getIc()
            properties = ic.getProperties()

            proxyStrCL = jdrc.getConfig().getProperty(
                "3DReconstruction.CameraLeft.Proxy")
            basecameraL = ic.stringToProxy(proxyStrCL)
            #ic = EasyIce.initialize(sys.argv)
            #properties = ic.getProperties()
            #basecameraL = ic.propertyToProxy("FollowLine.CameraLeft.Proxy")
            self.cameraProxyL = jderobot.CameraPrx.checkedCast(basecameraL)

            if self.cameraProxyL:
                self.imageLeft = self.cameraProxyL.getImageData("RGB8")
                self.imageLeft_h = self.imageLeft.description.height
                self.imageLeft_w = self.imageLeft.description.width
            else:
                print('Interface for left camera not connected')

            proxyStrCR = jdrc.getConfig().getProperty(
                "3DReconstruction.CameraRight.Proxy")
            basecameraR = ic.stringToProxy(proxyStrCL)
            #basecameraR = ic.propertyToProxy("FollowLine.CameraRight.Proxy")
            self.cameraProxyR = jderobot.CameraPrx.checkedCast(basecameraR)

            if self.cameraProxyR:
                self.imageRight = self.cameraProxyR.getImageData("RGB8")
                self.imageRight_h = self.imageRight.description.height
                self.imageRight_w = self.imageRight.description.width
            else:
                print('Interface for right camera not connected')

            proxyStrM = jdrc.getConfig().getProperty(
                "3DReconstruction.Motors.Proxy")
            motorsBase = ic.stringToProxy(proxyStrM)
            #motorsBase = ic.propertyToProxy("FolowLine.motors.Proxy")
            self.motorsProxy = jderobot.MotorsPrx.checkedCast(motorsBase)
            if self.motorsProxy:
                print('Interface for motors connected')
            else:
                print('Interface for motors not connected')

            self.maxSpeedV = 1
            self.maxSpeedW = 1

            #visualization
            proxyStrV = jdrc.getConfig().getProperty(
                "3DReconstruction.Viewer.Proxy")
            baseViewer = ic.stringToProxy(proxyStrV)
            #baseViewer = ic.propertyToProxy("FollowLine.Viewer.Proxy")
            self.viewerProxy = jderobot.VisualizationPrx.checkedCast(
                baseViewer)
            if self.viewerProxy:
                print('Interface for viewer connected')
            else:
                print('Interface for viewer not connected')

            #draw floor:
            self.MAXWORLD = 30
            colorJDE = jderobot.Color()
            colorJDE.r = 0
            colorJDE.g = 0
            colorJDE.b = 0
            for i in range(0, self.MAXWORLD + 1):
                pointJde1 = jderobot.Point()
                pointJde2 = jderobot.Point()
                pointJde3 = jderobot.Point()
                pointJde4 = jderobot.Point()
                pointJde1.x = -self.MAXWORLD * 10 / 2 + i * 10
                pointJde1.y = -self.MAXWORLD * 10 / 2
                pointJde1.z = 0
                pointJde2.x = -self.MAXWORLD * 10 / 2 + i * 10
                pointJde2.y = self.MAXWORLD * 10 / 2
                pointJde2.z = 0
                pointJde3.x = -self.MAXWORLD * 10 / 2
                pointJde3.y = -self.MAXWORLD * 10 / 2. + i * 10
                pointJde3.z = 0
                pointJde4.x = self.MAXWORLD * 10 / 2
                pointJde4.y = -self.MAXWORLD * 10 / 2. + i * 10
                pointJde4.z = 0
                seg1 = jderobot.Segment()
                seg1.fromPoint = pointJde1
                seg1.toPoint = pointJde2
                seg2 = jderobot.Segment()
                seg2.fromPoint = pointJde3
                seg2.toPoint = pointJde4
                self.viewerProxy.drawSegment(seg1, colorJDE)
                self.viewerProxy.drawSegment(seg2, colorJDE)

        except:
            traceback.print_exc()
            exit()
            status = 1
예제 #29
0
    if len(sys.argv) < 2:
        print(
            'ERROR: python2 globalNavigation.py [MAP CONFIG file] [YAML CONFIG file]'
        )
        sys.exit(-1)

    app = QApplication(sys.argv)
    frame = MainWindow()
    grid = Grid(frame)

    removeMapFromArgs()

    cfg = config.load(sys.argv[1])
    #starting comm
    jdrc = comm.init(cfg, 'TeleTaxi')

    motors = jdrc.getMotorsClient("TeleTaxi.Motors")
    pose = jdrc.getPose3dClient("TeleTaxi.Pose3D")

    vel = Velocity(0, 0, motors.getMaxV(), motors.getMaxW())

    frame.setVelocity(vel)
    sensor = Sensor(grid, pose, True)
    sensor.setGetPathSignal(frame.getPathSig)
    frame.setGrid(grid)
    frame.setSensor(sensor)
    algorithm = MyAlgorithm(grid, sensor, vel)
    frame.setAlgorithm(algorithm)
    frame.show()
예제 #30
0
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication

from gui.cameraSegment import CameraSegment


import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'Follow_face')

    cameraCli = jdrc.getCameraClient("Follow_face.Camera")
    camera = CameraSegment(cameraCli)
    motors = jdrc.getPTMotorsClient("Follow_face.PTMotors")

    algorithm=MyAlgorithm(camera, motors)

    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setMotors(motors)
    frame.setCamera(camera)
    frame.setAlgorithm(algorithm)
    frame.show()

    t2 = ThreadGUI(frame)
예제 #31
0
from parallelIce.cmdvel import CMDVel
from parallelIce.extra import Extra
from parallelIce.pose3dClient import Pose3DClient
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

    cfg = config.load(sys.argv[1])

    # starting comm
    jdrc = comm.init(cfg, 'Introrob')

    cameraCli = jdrc.getCameraClient("Introrob.Camera")
    camera = CameraFilter(cameraCli)
    navdata = jdrc.getNavdataClient("Introrob.Navdata")
    pose = jdrc.getPose3dClient("Introrob.Pose3D")
    cmdvel = jdrc.getCMDVelClient("Introrob.CMDVel")
    extra = jdrc.getArDroneExtraClient("Introrob.Extra")

    algorithm = MyAlgorithm(camera, navdata, pose, cmdvel, extra)

    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setCamera(camera)
    frame.setNavData(navdata)
    frame.setPose3D(pose)
예제 #32
0
#from parallelIce.extra import Extra
#from parallelIce.pose3dClient import Pose3DClient
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication


import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'Introrob')

    cameraCli = jdrc.getCameraClient("Introrob.cameraA")
    camera = CameraFilter(cameraCli) 

    algorithm=MyAlgorithm(camera)


    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setCamera(camera)
    frame.setAlgorithm(algorithm)
    frame.show()

    t2 = ThreadGUI(frame)  
    t2.daemon=True
예제 #33
0
import comm
from gui.threadGUI import ThreadGUI
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication
import config

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'pantilt_teleop')

    camera = jdrc.getCameraClient("pantilt_teleop.Camera")
    motors = jdrc.getPTMotorsClient("pantilt_teleop.PTMotors")

    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setMotors(motors)
    frame.setCamera(camera)
    frame.show()

    t2 = ThreadGUI(frame)
    t2.daemon = True
    t2.start()

    sys.exit(app.exec_())
예제 #34
0
from parallelIce.cmdvel import CMDVel
from parallelIce.extra import Extra
from parallelIce.pose3dClient import Pose3DClient
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

        cfg = config.load(sys.argv[1])

        #starting comm
        jdrc= comm.init(cfg, 'UAVViewer')

        camera = jdrc.getCameraClient("UAVViewer.Camera")
        navdata = jdrc.getNavdataClient("UAVViewer.Navdata")
        pose = jdrc.getPose3dClient("UAVViewer.Pose3D")
        cmdvel = jdrc.getCMDVelClient("UAVViewer.CMDVel")
        extra = jdrc.getArDroneExtraClient("UAVViewer.Extra")

        app = QApplication(sys.argv)
        frame = MainWindow()
        frame.setCamera(camera)
        frame.setNavData(navdata)
        frame.setPose3D(pose)
        frame.setCMDVel(cmdvel)
        frame.setExtra(extra)
        frame.show()
예제 #35
0
        found = False
        xRobot = self.pose3d.getPose3d().x
        yRobot = self.pose3d.getPose3d().y
        xdest = self.dist.destiny[0]
        ydest = self.dist.destiny[1]
        if (abs(xRobot)<(abs(xdest)+5) and abs(xRobot)>(abs(xdest)-5)) and (abs(yRobot)<(abs(ydest)+5) and abs(yRobot)>(abs(ydest)-5)):
            found = True
        return found
        

    def updateG(self):
        self.update()
        
        
        
if __name__ == "__main__":
    
    app = QApplication(sys.argv)
    cfg = config.load(sys.argv[1])
    #starting comm
    jdrc= comm.init(cfg, 'Referee')

    pose3d = jdrc.getPose3dClient("Referee.Pose3D")

    myGUI = MainWindowReferee(pose3d)
    myGUI.show()
    t2 = ThreadGUI(myGUI)
    t2.daemon=True
    t2.start()
    sys.exit(app.exec_())
예제 #36
0
        path = os.getcwd()
        open_path = path[:path.rfind('src')] + 'cfg/'
        filename = sys.argv[1]

    else:
        sys.exit("ERROR: Example:python my_generated_script.py cfgfile.yml")

    # loading the ICE and ROS parameters
    cfg = config.load(open_path + filename)
    stream = open(open_path + filename, "r")
    yml_file = yaml.load(stream)

    for section in yml_file:
        if section == 'drone':
            #starting comm
            jdrc = comm.init(cfg,'drone')

            # creating the object
            robot = Drone(jdrc)

            break
        elif section == 'robot':
            #starting comm
            jdrc = comm.init(cfg,'robot')

            # creating the object
            robot = Robot(jdrc)

            break
    # executing the scratch program
    execute(robot)
예제 #37
0
    rgbsegment = jderobot.RGBSegment()
    rgbsegment.seg = seg
    rgbsegment.c = color
    bufferline.append(rgbsegment)

def getbufferPoint(point, color):
    rgbpoint = jderobot.RGBPoint()
    rgbpoint.x = point.x
    rgbpoint.y = point.y
    rgbpoint.z = point.z
    rgbpoint.r = color.r
    rgbpoint.g = color.g
    rgbpoint.b = color.b
    bufferpoints.append(rgbpoint)

try:
    cfg = config.load(sys.argv[1])
    jdrc= comm.init(cfg, '3DReconstruction')
    endpoint = jdrc.getConfig().getProperty("3DReconstruction.Viewer.Endpoint")
    proxy = jdrc.getConfig().getProperty("3DReconstruction.Viewer.Proxy")
    refresh = jdrc.getConfig().getProperty("3DReconstruction.Viewer.Refresh")
    id = Ice.InitializationData()
    ic = Ice.initialize(None, id)
    adapter = ic.createObjectAdapterWithEndpoints(proxy, endpoint)
    object = PointI()
    adapter.add(object, ic.stringToIdentity("3DViz"))
    adapter.activate()
except KeyboardInterrupt:
	del(ic)
	sys.exit()
예제 #38
0
from gui.threadGUI import ThreadGUI
#from parallelIce.motors import Motors
#from parallelIce.pose3dClient import Pose3DClient
#from parallelIce.cameraClient import CameraClient
#from parallelIce.laserClient import LaserClient
#import easyiceconfig as EasyIce
from MyAlgorithm import MyAlgorithm



if __name__ == "__main__":

    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'Stop')

    cameraC = jdrc.getCameraClient("Stop.CameraC")
    cameraL = jdrc.getCameraClient("Stop.CameraL")
    cameraR = jdrc.getCameraClient("Stop.CameraR")
    motors = jdrc.getMotorsClient ("Stop.Motors")
    pose3d = jdrc.getPose3dClient("Stop.Pose3D")
    
    algorithm=MyAlgorithm(pose3d, cameraC, cameraL, cameraR, motors)

    app = QApplication(sys.argv)
    myGUI = MainWindow()
    myGUI.setMotors(motors)
    myGUI.setCameraC(cameraC)
    myGUI.setCameraL(cameraL)
    myGUI.setCameraR(cameraR)
예제 #39
0
from parallelIce.extra import Extra
from parallelIce.pose3dClient import Pose3DClient
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication

import signal


signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'VisualLander')

    camera = jdrc.getCameraClient("VisualLander.Camera")
    navdata = jdrc.getNavdataClient("VisualLander.Navdata")
    pose = jdrc.getPose3dClient("VisualLander.Pose3D")
    cmdvel = jdrc.getCMDVelClient("VisualLander.CMDVel")
    extra = jdrc.getArDroneExtraClient("VisualLander.Extra")

    algorithm=MyAlgorithm(camera, navdata, pose, cmdvel, extra)


    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setCamera(camera)
    frame.setNavData(navdata)
    frame.setPose3D(pose)
예제 #40
0


import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    cfg = config.load(sys.argv[1])
    try:
        img_path=sys.argv[2]
    except IndexError:
        img_path=None

    #starting comm
    jdrc= comm.init(cfg, 'ColorTuner')

    cameraCli = jdrc.getCameraClient("ColorTuner.Camera")
    camera = CameraFilter(cameraCli)
    
    app = QApplication(sys.argv)
    frame = MainWindow(img_path)
    frame.setCamera(camera)
    frame.show()
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())

    t2 = ThreadGUI(frame)  
    t2.daemon=True
    t2.start()
    
    sys.exit(app.exec_()) 
예제 #41
0
import controller
import comm
import time
import math

def update_servo_pos(conn):
	state = controller.get_state()
	new_pos = int((-1 * math.degrees( math.asin( state['trigger'] ) )) + 90)
	print new_pos
	comm.send(conn,new_pos)

# Main entry
if __name__ == "__main__":
	conn = comm.init(6,115200)
	controller.init()
	while True:
		controller.processEvents()
		update_servo_pos(conn)
	conn.close()

예제 #42
0
파일: mbotSuite.py 프로젝트: fqez/sandbox
import comm
from gui.threadGUI import ThreadGUI
from gui.GUI import MainWindow
from PyQt5.QtWidgets import QApplication
import config

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'mbotSuite_py')


    camera = jdrc.getCameraClient("mbotSuite_py.PiCamera")
    irl = jdrc.getCameraClient("mbotSuite_py.IRLeft")
    irr = jdrc.getCameraClient("mbotSuite_py.IRRight")
    sonar = jdrc.getSonarClient("mbotSuite_py.Sonar")
    motors = jdrc.getMotorsClient("mbotSuite_py.Motors")

    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.setMotors(motors)
    frame.setCamera(camera, irl, irr)
    frame.setSonar(sonar)
    frame.show()
예제 #43
0
#!/usr/bin/env python3
import config
import comm
import sys
import time
import signal

from jderobotTypes import CMDVel




if __name__ == '__main__':

    cfg = config.load(sys.argv[1])
    jdrc= comm.init(cfg, "Test")

    vel = CMDVel()
    vel.vx = 1
    vel.az = 0.1

    client = jdrc.getMotorsClient("Test.Motors")
    for i in range (10):
        client.sendVelocities(vel)
        time.sleep(1)

    jdrc.destroy()
예제 #44
0
    def __init__(self):
        self.lock = threading.Lock()
        self.playButton=False

        try:
            cfg = config.load(sys.argv[1])
            #starting comm
            jdrc= comm.init(cfg, '3DReconstruction')

            ic = jdrc.getIc()
            properties = ic.getProperties()

            proxyStrCL = jdrc.getConfig().getProperty("3DReconstruction.CameraLeft.Proxy")
            basecameraL = ic.stringToProxy(proxyStrCL)
            #ic = EasyIce.initialize(sys.argv)
            #properties = ic.getProperties()
            #basecameraL = ic.propertyToProxy("FollowLine.CameraLeft.Proxy")
            self.cameraProxyL = jderobot.CameraPrx.checkedCast(basecameraL)

            if self.cameraProxyL:
                self.imageLeft = self.cameraProxyL.getImageData("RGB8")
                self.imageLeft_h= self.imageLeft.description.height
                self.imageLeft_w = self.imageLeft.description.width
            else:
                print ('Interface for left camera not connected')

            proxyStrCR = jdrc.getConfig().getProperty("3DReconstruction.CameraRight.Proxy")
            basecameraR = ic.stringToProxy(proxyStrCR)
            #basecameraR = ic.propertyToProxy("FollowLine.CameraRight.Proxy")
            self.cameraProxyR = jderobot.CameraPrx.checkedCast(basecameraR)

            if self.cameraProxyR:
                self.imageRight = self.cameraProxyR.getImageData("RGB8")
                self.imageRight_h= self.imageRight.description.height
                self.imageRight_w = self.imageRight.description.width
            else:
                print ('Interface for right camera not connected')


            proxyStrM = jdrc.getConfig().getProperty("3DReconstruction.Motors.Proxy")
            motorsBase = ic.stringToProxy(proxyStrM)
            #motorsBase = ic.propertyToProxy("FolowLine.motors.Proxy")
            self.motorsProxy = jderobot.MotorsPrx.checkedCast(motorsBase)
            if self.motorsProxy:
                print ('Interface for motors connected')
            else:
                print ('Interface for motors not connected')


            self.maxSpeedV=1
            self.maxSpeedW=1


            #visualization
        #    proxyStrV = jdrc.getConfig().getProperty("3DReconstruction.Viewer.Proxy")
        #    baseViewer = ic.stringToProxy(proxyStrV)
            #baseViewer = ic.propertyToProxy("FollowLine.Viewer.Proxy")
        #    self.viewerProxy = jderobot.VisualizationPrx.checkedCast(baseViewer)
            #if self.viewerProxy:
        #        print ('Interface for viewer connected')
        #    else:
        #        print ('Interface for viewer not connected')

            #draw floor:
            self.MAXWORLD=30
            colorJDE= jderobot.Color()
            colorJDE.r=0
            colorJDE.g=0
            colorJDE.b=0
            for i in range(0,self.MAXWORLD+1):
                pointJde1= jderobot.Point()
                pointJde2= jderobot.Point()
                pointJde3= jderobot.Point()
                pointJde4= jderobot.Point()
                pointJde1.x=-self.MAXWORLD * 10 / 2 + i * 10
                pointJde1.y= -self.MAXWORLD * 10 / 2
                pointJde1.z=0
                pointJde2.x=-self.MAXWORLD * 10 / 2 + i * 10
                pointJde2.y= self.MAXWORLD * 10 / 2
                pointJde2.z=0
                pointJde3.x=-self.MAXWORLD * 10 / 2
                pointJde3.y=-self.MAXWORLD * 10 / 2. + i * 10
                pointJde3.z=0
                pointJde4.x=self.MAXWORLD * 10 / 2
                pointJde4.y=-self.MAXWORLD * 10 / 2. + i * 10
                pointJde4.z=0
                seg1= jderobot.Segment()
                seg1.fromPoint=pointJde1
                seg1.toPoint=pointJde2
                seg2= jderobot.Segment()
                seg2.fromPoint=pointJde3
                seg2.toPoint=pointJde4
                pointBuffer.getbufferSegment(seg1, colorJDE, True)
                #self.viewerProxy.drawSegment(seg1,colorJDE)
                pointBuffer.getbufferSegment(seg2, colorJDE, True)
                #self.viewerProxy.drawSegment(seg2,colorJDE)




        except:
            traceback.print_exc()
            exit()
            status = 1
예제 #45
0
from PyQt5.QtWidgets import QApplication
from gui.GUI import MainWindow
from gui.threadGUI import ThreadGUI
#from parallelIce.motors import Motors
#from parallelIce.pose3dClient import Pose3DClient
#from parallelIce.cameraClient import CameraClient
#from parallelIce.laserClient import LaserClient
#import easyiceconfig as EasyIce
from MyAlgorithm import MyAlgorithm

if __name__ == "__main__":

    cfg = config.load(sys.argv[1])

    # starting comm
    jdrc = comm.init(cfg, 'Stop')

    cameraC = jdrc.getCameraClient("Stop.CameraC")
    cameraL = jdrc.getCameraClient("Stop.CameraL")
    cameraR = jdrc.getCameraClient("Stop.CameraR")
    motors = jdrc.getMotorsClient("Stop.Motors")
    pose3d = jdrc.getPose3dClient("Stop.Pose3D")

    algorithm = MyAlgorithm(pose3d, cameraC, cameraL, cameraR, motors)

    app = QApplication(sys.argv)
    myGUI = MainWindow()
    myGUI.setMotors(motors)
    myGUI.setCameraC(cameraC)
    myGUI.setCameraL(cameraL)
    myGUI.setCameraR(cameraR)
예제 #46
0
import comm
import config
from PyQt5.QtWidgets import QApplication
from gui.GUI import MainWindow
from gui.threadGUI import ThreadGUI
from MyAlgorithm import MyAlgorithm




if __name__ == "__main__":

    cfg = config.load(sys.argv[1])

    #starting comm
    jdrc= comm.init(cfg, 'Autopark')

    motors = jdrc.getMotorsClient ("Autopark.Motors")
    pose3d = jdrc.getPose3dClient("Autopark.Pose3D")
    laser1 = jdrc.getLaserClient("Autopark.Laser1").hasproxy()
    laser2 = jdrc.getLaserClient("Autopark.Laser2").hasproxy()
    laser3 = jdrc.getLaserClient("Autopark.Laser3").hasproxy()

    algorithm=MyAlgorithm(pose3d, laser1, laser2, laser3, motors)

    app = QApplication(sys.argv)
    myGUI = MainWindow()
    myGUI.setMotors(motors)
    myGUI.setPose3D(pose3d)
    myGUI.setLaser1(laser1)
    myGUI.setLaser2(laser2)
예제 #47
0
        path = os.getcwd()
        open_path = path[:path.rfind('src')] + 'cfg/'
        filename = sys.argv[1]

    else:
        sys.exit("ERROR: Example:python my_generated_script.py cfgfile.yml")

    # loading the ICE and ROS parameters
    cfg = config.load(open_path + filename)
    stream = open(open_path + filename, "r")
    yml_file = yaml.load(stream)

    for section in yml_file:
        if section == 'drone':
            #starting comm
            jdrc = comm.init(cfg,'drone')

            # creating the object
            robot = Drone(jdrc)

            break
        elif section == 'robot':
            #starting comm
            jdrc = comm.init(cfg,'robot')

            # creating the object
            robot = Robot(jdrc)

            break
    # executing the scratch program
    execute(robot)
예제 #48
0
#!/usr/bin/env python3
import config
import comm
import sys
import time
import signal





if __name__ == '__main__':

    cfg = config.load(sys.argv[1])
    jdrc= comm.init(cfg, "Test")


    client = jdrc.getArDroneExtraClient("Test.Extra")
    client.takeoff()
    time.sleep(4)
    client.land()

    jdrc.destroy()