Ejemplo n.º 1
0
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details. """


import sys
import zmq
from gps_data_pb2 import GpsData
from gpxdata import TrackPoint, TrackSegment, Track, Document
from zmq_ipc import generate_map


socket = generate_map('gpx_logger')['gps']
gps_data = GpsData()
segment = TrackSegment()
try:
   while True:
      str = socket.recv()
      gps_data.ParseFromString(str)
      print gps_data
      point = TrackPoint(gps_data.lat, gps_data.lon, gps_data.alt)
      segment.appendPoint(point)
except:
   pass

track = Track(name = "Copter Track", description = "Track recorded using the copter's onboard GPS module")
track.appendSegment(segment)
doc = Document([track], name = "Copter GPX Document")
Ejemplo n.º 2
0
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details. """

import sys
import zmq
from gps_data_pb2 import GpsData
from gpxdata import TrackPoint, TrackSegment, Track, Document
from zmq_ipc import generate_map

socket = generate_map('gpx_logger')['gps']
gps_data = GpsData()
segment = TrackSegment()
try:
    while True:
        str = socket.recv()
        gps_data.ParseFromString(str)
        print gps_data
        point = TrackPoint(gps_data.lat, gps_data.lon, gps_data.alt)
        segment.appendPoint(point)
except:
    pass

track = Track(
    name="Copter Track",
    description="Track recorded using the copter's onboard GPS module")
Ejemplo n.º 3
0
      yield ('takeoff',)
      start_time = time.time()
      while True:
         if time.time() - start_time > self.run_time:
            print 'time limit exceeded, stopping experiment'
            yield 'moverel', 0, 0
            time.sleep(5.0)
            yield 'land',
            break
         i, pos = self.ferry.hop_selector.get_next_hop()
         print 'moving to terminal', i, 'at pos', pos
         yield 'moverel', pos[0], pos[1]
         print 'arrived at terminal', i
         print 'exchanging messages with terminal %d' % i
         self.ferry.transfer_messages(i)
      # write stats:
      delays_file = open('delays.txt', 'w')
      for delay in self.ferry.delays:
         delays_file.write('%d %d %.2f\n' % delay)
      delays_file.close()
      buf_sizes_file = open('buf_sizes.txt', 'w')
      for buf_size in self.ferry.buf_sizes:
         buf_sizes_file.write('%d %d\n' % buf_size)
      buf_sizes_file.close()



executor = MissionExecutor(generate_map('ferry_ctrl'))
executor.execute(FerryMission().generator())

Ejemplo n.º 4
0
      self.socket = socket
      self.event = Event()

   def run(self):
      while True:
         data = GpsData()
         data.ParseFromString(self.socket.recv())
         self.data = data
         self.event.set()

   def pos(self):
      self.event.wait()
      return self.data.lon, self.data.lat


gps_reader = GPSReader(generate_map('dlr_logger')['gps'])
gps_reader.start()


def dlr_mission():
   gs_pos = 50.0, 10.0
   print 'taking off'
   yield 'takeoff', 4.5
   own_pos = gps_reader.pos()
   bearing = calc_bearing(gs_pos, own_pos)
   print 'rotating to', bearing
   yield 'rotate', bearing



executor = MissionExecutor(generate_map('ferry_ctrl'))