def _communicate_tracking_info(self):
        """ Runs as a daemon thread, communicating tracking info to remote socket.

            Uses observer and satellite objects set by trackobject().

            Will exit if altitude is less than zero (below the horizon).
        """
        if self._debugmode:
            print(('alive:', self._stay_alive))
        else:
            sock = trackersocket.trackersocket()
            sock.connect(self._IP, self._PORT)  # change to correct address

        # track satellite
        while self._stay_alive:
            if self._debugmode:
                #print type(self.observer_dict), self.observer_dict
                #print type(self.satellite_dict), self.satellite_dict
                print(('Tracking', self.satellite_dict['tle0'], 'from', self.observer_dict['elev']))
            else:
                p = orbital.pinpoint(self.observer_dict, self.satellite_dict)
                if p['ok']:
                    if p['alt'] < 0:
                        # break
                        self._stay_alive = False
                    else:
                        s = 'P ' + str((p['az'].conjugate())) + ' ' + str(p['alt'].conjugate())
                        #print s + str('\n')
                        sock.send(s + str('\n'))
                        time.sleep(self.SLEEP_TIME)
            # exiting
        if self._debugmode:
            print('Tracking thread exited.')
        else:
            sock.disconnect()
Example #2
0
def point_antenna(azimuth, altitude):
    """Points antenna to provided azimuth altitude pair."""
    sock = trackersocket.trackersocket(TCP_IP, TCP_PORT)
    s = 'P ' + str(azimuth) + ' ' + str(altitude)
    print((s + str('\n')))
    sock.send(s + str('\n'))
    sock.disconnect()
Example #3
0
def point_antenna(azimuth, altitude):
    """Points antenna to provided azimuth altitude pair."""
    sock = trackersocket.trackersocket(TCP_IP, TCP_PORT)
    s = 'P ' + str(azimuth) + ' ' + str(altitude)
    print((s + str('\n')))
    sock.send(s + str('\n'))
    sock.disconnect()
def track_and_send(tr):
    ''' Tracks given satellite and sends positioning commands to antenna.
    '''
    ### daemon command on beagle:
    ### rotctld -m 202 -v -r /dev/ttyACM0
    #import os

    # create and open socket
    sock = trackersocket.trackersocket()
    sock.connect('10.2.110.108', 4533)  # change to correct address
    # track satellite
    for i in range(0, 10000):
        p = tr.pinpoint('hsgr', '0 SEDSAT 1')
        if p['ok']:
            s = 'P ' + str((p['az'].conjugate())) + ' ' + str(p['alt'].conjugate())
            #print s + os.linesep
            print s + str('\n')
            sock.send(s + str('\n'))
            time.sleep(SLEEP_TIME)
    sock.disconnect()
Example #5
0
def track_and_send(tr):
    ''' Tracks given satellite and sends positioning commands to antenna.
    '''
    ### daemon command on beagle:
    ### rotctld -m 202 -v -r /dev/ttyACM0
    #import os

    # create and open socket
    sock = trackersocket.trackersocket()
    sock.connect('10.2.110.108', 4533)  # change to correct address
    # track satellite
    for i in range(0, 10000):
        p = tr.pinpoint('hsgr', '0 SEDSAT 1')
        if p['ok']:
            s = 'P ' + str(
                (p['az'].conjugate())) + ' ' + str(p['alt'].conjugate())
            #print s + os.linesep
            print s + str('\n')
            sock.send(s + str('\n'))
            time.sleep(SLEEP_TIME)
    sock.disconnect()
    def _communicate_tracking_info(self):
        """ Runs as a daemon thread, communicating tracking info to remote socket.

            Uses observer and satellite objects set by trackobject().

            Will exit if altitude is less than zero (below the horizon).
        """
        if self._debugmode:
            print(('alive:', self._stay_alive))
        else:
            sock = trackersocket.trackersocket()
            sock.connect(self._IP, self._PORT)  # change to correct address

        # track satellite
        while self._stay_alive:
            if self._debugmode:
                #print type(self.observer_dict), self.observer_dict
                #print type(self.satellite_dict), self.satellite_dict
                print(('Tracking', self.satellite_dict['tle0'], 'from',
                       self.observer_dict['elev']))
            else:
                p = orbital.pinpoint(self.observer_dict, self.satellite_dict)
                if p['ok']:
                    if p['alt'] < 0:
                        # break
                        self._stay_alive = False
                    else:
                        s = 'P ' + str((p['az'].conjugate())) + ' ' + str(
                            p['alt'].conjugate())
                        #print s + str('\n')
                        sock.send(s + str('\n'))
                        time.sleep(self.SLEEP_TIME)
            # exiting
        if self._debugmode:
            print('Tracking thread exited.')
        else:
            sock.disconnect()