Exemple #1
0
    def postImage(self,
                  typ='standard',
                  lat=38.145215,
                  lon=-76.427942,
                  ori='n',
                  shp='square',
                  bgc='green',
                  letter='A',
                  color='white',
                  image_path='~/image.png'):

        target = interop.Odlc(type=typ,
                              latitude=lat,
                              longitude=lon,
                              orientation=ori,
                              shape=shp,
                              background_color=bgc,
                              alphanumeric=letter,
                              alphanumeric_color=color)

        target = self.client.post_odlc(target)

        #with open(image_path, 'rb') as f:
        #    image_data = f.read()
        #    self.client.put_odlc_image(target.id, image_data)

        image_data = urllib.urlopen(image_path).read()
        self.client.put_odlc_image(target.id, image_data)
Exemple #2
0
def submit_form():
    result = request.form
    letter_colour = request.form['letter_colour']
    alphanumericval = request.form['alphanumeric']
    bg_colour = request.form['bg_colour']
    shapeval = request.form['shape']
    orientationval = request.form['orientation']

    send_image = im.image_src(im.imageArray, im.imageIndex)

    #print("image source",send_image)

    odlc = interop.Odlc(type='standard',
                        latitude=38.145215,
                        longitude=-76.427942,
                        orientation=orientationval,
                        shape=shapeval,
                        background_color=bg_colour,
                        alphanumeric=alphanumericval,
                        alphanumeric_color=letter_colour)

    odlc = client.post_odlc(odlc)

    with open(send_image, 'rb') as f:
        image_data = f.read()
        client.put_odlc_image(odlc.id, image_data)

    im.moveimg(im.imageArray, im.imageIndex)
    #print("AT SUBMIT")

    return redirect("/")
    def upload2Interop(self):
        s1=s2=s3=s4=s5=s6=s7=s8=s9=None
        s1=self.text1.get()
        s2=self.entry2.get()
        s3=self.entry3.get()
        s4=self.text4.get()
        s5=self.text5.get()
        s6=self.text6.get()
        s7=self.entry7.get()
        s8=self.text8.get()
        s9=self.entry9.get()
        if s9=="":
            s9=None
    

        s2=eval(s2)
        s3=eval(s3)
        target_response=OrderedDict([("id", 1),("user", 1,),("type", s1),("latitude", s2),("longitude", s3),("orientation", s4),("shape",s5),("background_color",s6),("alphanumeric", s7),("alphanumeric_color", s8),("description", s9),("autonomous", False)])

        # print target_response
        json_str=json.dumps(target_response)
        print (json_str)

        
        x=self.gps()
        print ("Latitude and Longitude : ")
        with open(str(self.index2)+".json",'w') as outfile:
            json.dump(target_response,outfile)
        a=str(self.index2)+".json"
        b="cp "+a+" mydata/"+a 
        os.system(b)
       

        client = interop.Client(url='http://10.10.130.10:80',
                        username='******',
                        password='******')

        target=interop.Odlc(id=None,
		        user='******',
		        type=s1,
		        latitude=s2,
		        longitude=s3,
		        orientation=s4,
		        shape=s5,
		        background_color=s6,
		        alphanumeric=s7,
		        alphanumeric_color=s8,
		        description=None,
		        autonomous=False)
        target = client.post_odlc(target)

        print (str(self.index2)+".jpg")

        with open(str(self.index2)+".jpg", 'rb') as f:
            image_data = f.read()
            client.put_odlc_image(target.id, image_data)
        self.index2+=1
Exemple #4
0
    def upload_object_and_image(self, path, typ, latitude, longitude,
                                orientation, shape, background_color,
                                alphanumeric, alphanumeric_color):
        try:
            odlc = interop.Odlc(type=typ,
                                latitude=latitude,
                                longitude=longitude,
                                orientation=orientation,
                                shape=shape,
                                background_color=background_color,
                                alphanumeric=alphanumeric,
                                alphanumeric_color=alphanumeric_color)
            odlc = self.client.post_odlc(odlc)

            with open(path, 'rb') as f:
                image_data = f.read()
                self.client.put_odlc_image(odlc.id, image_data)

            return True

        except:
            return False
Exemple #5
0
    def postTarget(self,
                   pId,
                   pUser,
                   pType,
                   pLat,
                   pLon,
                   pOrient,
                   pShape,
                   pBgColor,
                   pAlphanumeric,
                   pAlphanumericColor,
                   pDescription,
                   pActionableOverride=False,
                   pAutonomous=False,
                   pTeamId="CNU_IMPRINT",
                   pImagePath=None):

        mTarget = interop.Odlc(id=pId,
                               user=pUser,
                               type=pType,
                               latitude=pLat,
                               longitude=pLon,
                               orientation=pOrient,
                               shape=pShape,
                               background_color=pBgColor,
                               alphanumeric=pAlphanumeric,
                               alphanumeric_color=pAlphanumericColor,
                               description=pDescription,
                               actionable_override=pActionableOverride,
                               autonomous=pAutonomous,
                               team_id=pTeamId)

        target = self.client.post_odlc(mTarget)

        if not pImagePath == None:
            with open(pImagePath, 'rb') as f:
                image_data = f.read()
                self.client.put_odlc_image(target.id, image_data)
missions = client.get_missions()
print(missions)

stationary_obstacles, moving_obstacles = client.get_obstacles()
print(stationary_obstacles, moving_obstacles)

#The following shows how to upload UAS telemetry.

telemetry = interop.Telemetry(latitude=38.145215,
                              longitude=-76.427942,
                              altitude_msl=50,
                              uas_heading=90)
client.post_telemetry(telemetry)

# The following shows how to upload a object and it's image.

odlc = interop.Odlc(type='standard',
                    latitude=38.145215,
                    longitude=-76.427942,
                    orientation='n',
                    shape='square',
                    background_color='green',
                    alphanumeric='A',
                    alphanumeric_color='white')
odlc = client.post_odlc(odlc)

with open('testimg.jpg', 'rb') as f:
    image_data = f.read()
    client.put_odlc_image(odlc.id, image_data)