gatech.lon =  str(gps_lon) #'-122.41755' #datetimeloc[3] #'-84.39733'

    gatech.elevation = gps_alt
    gatech.temp = 23.0 #float(datetimeloc[5])

    sol_obj = ephem.Sun(gatech)
    sol=[sol_obj.alt, sol_obj.az]

    icarus_desired=[0.5*target[0]+0.5*sol[0],0.5*target[1]+0.5*sol[1]]
    #print('%s %s %s %f %f' % (time, sol_obj.alt, sol_obj.az,icarus_desired[0],icarus_desired[1]))
    
    sol_alt=sol[0]*rad2deg
    sol_az=sol[1]*rad2deg
    
    icarus_alt=icarus_desired[0]*rad2deg
    icarus_az=icarus_desired[1]*rad2deg
    

    print('%s %s %s %i %i' % (time, sol_obj.alt, sol_obj.az,hf.alt_to_pos2(sol_alt),hf.az_to_pos1(sol_az)))

    # if(hf.az_to_pos1(sol_az) >= 1 and hf.az_to_pos1(sol_az) <= 1023):
    #     if(hf.alt_to_pos2(sol_alt) >= 205 and hf.alt_to_pos2(sol_alt) <= 819): 
    #         hf.movedyn(hf.az_to_pos1(sol_az),hf.alt_to_pos2(sol_alt))
    #         t.sleep(5)
    
    if(hf.az_to_pos1(icarus_az) >= 1 and hf.az_to_pos1(icarus_az) <= 1023):
        if(hf.alt_to_pos2(icarus_alt) >= 205 and hf.alt_to_pos2(icarus_alt) <= 819): 
            hf.movedyn(hf.az_to_pos1(icarus_az),hf.alt_to_pos2(icarus_alt))
            t.sleep(0.2)
	    
Example #2
0
for i in xrange(60):
    hour=str(i).zfill(2)
    time="20:"+hour+":00"


    gatech = ephem.Observer()
    gatech.date = gps_datetime.strftime("%Y/%m/%d %H:%M:%S") #'2015/09/12'+' '+time #gps_datetime.strftime("%Y/%m/%d %H:%M:%S") #datetimeloc[0]+' '+time #'1984/5/30 16:22:56'
    gatech.lat =  str(gps_lat) #'37.77648' #datetimeloc[2]  #'33.775867'
    gatech.lon =  str(gps_lon) #'-122.41755' #datetimeloc[3] #'-84.39733'

    gatech.elevation = gps_alt
    gatech.temp = 23.0 #float(datetimeloc[5])

    sol_obj = ephem.Sun(gatech)
    sol=[sol_obj.alt, sol_obj.az]

    #icarus_desired=[0.5*target[0]+0.5*sol[0],0.5*target[1]+0.5*sol[1]]
    #print('%s %s %s %f %f' % (time, sol_obj.alt, sol_obj.az,icarus_desired[0],icarus_desired[1]))
    
    sol_alt=sol[0]*rad2deg
    sol_az=sol[1]*rad2deg

    print('%s %s %s %i %i' % (time, sol_obj.alt, sol_obj.az,hf.alt_to_pos2(sol_alt),hf.az_to_pos1(sol_az)))

    if(hf.az_to_pos1(sol_az) >= 1 and hf.az_to_pos1(sol_az) <= 1023):
        if(hf.alt_to_pos2(sol_alt) >= 205 and hf.alt_to_pos2(sol_alt) <= 819): 
            hf.movedyn(hf.az_to_pos1(sol_az),hf.alt_to_pos2(sol_alt))
            t.sleep(5)