Esempio n. 1
0
 def __init__(self, map, req):
    Thread.__init__(self)
    #system('svctrl --start wifi_sensor > /dev/null')
    self.gps_reader = _GPS_Reader(map['gps'])
    self.measure_reader = _MeasureReader(map['net'])
    self.combined_publisher = _CombinedPublisher(map['pub_server'], self.gps_reader, self.measure_reader)
    self.map = map
    self.req = req
    self.factory = ICARUS_MissionFactory()
    self.client = ICARUS_SynClient(map['ctrl'], map['state'])
Esempio n. 2
0
class LocMission(Thread):

   """
   - manages a measurement publisher
   - executes a configurable zigzag mission
   """

   def __init__(self, map, req):
      Thread.__init__(self)
      #system('svctrl --start wifi_sensor > /dev/null')
      self.gps_reader = _GPS_Reader(map['gps'])
      self.measure_reader = _MeasureReader(map['net'])
      self.combined_publisher = _CombinedPublisher(map['pub_server'], self.gps_reader, self.measure_reader)
      self.map = map
      self.req = req
      self.factory = ICARUS_MissionFactory()
      self.client = ICARUS_SynClient(map['ctrl'], map['state'])

   def run(self):
      self.gps_reader.start()
      self.measure_reader.start()
      self.combined_publisher.start()
      for x, y in self._zigzag_gen(0.0, 0.0, 0.1, 0.1, 10):
         self.client.execute(self.factory.move_xy(x, y))
      self.combined_publisher.term()
      self.measure_reader.term()
      self.gps_reader.term()
      self.req.status = MissionMessage.DONE
      self.map['pub_server'].send(self.req.SerializeToString())


   def _zigzag_gen(self, x, y, width, height, breaks):
      for i in range(breaks):
         yield x + width / 2.0, y
         y += (height / breaks) / 2.0
         yield x - width / 2.0, y
         y += (height / breaks) / 2.0
      yield width / 2.0, height
Esempio n. 3
0
   def run(self):
      while True:
         data = GpsData()
         data.ParseFromString(self.socket.recv())
         self.data = data



sm = generate_map('aircomm_swarm')
gps_reader = GPS_Reader(sm['gps'])
gps_reader.start()


_client = ICARUS_Client(sm['ctrl'])
i = ICARUS_MissionFactory()


def request(item):
   try:
      _client.execute(item)
   except Exception, e:
      print e

#ctrl = array([0.0, 0.0])
inf = Interface(1, '/dev/ttyACM0')
while True:
   sleep(0.1)
   msg = inf.receive()
   if msg:
      if 1:#msg.type == POS:
Esempio n. 4
0
import readline
import rlcompleter

from scl import generate_map
from icarus_interface import ICARUS_Client, ICARUS_MissionFactory
from misc import user_data_dir


# set-up command history:
_path = user_data_dir + os.sep + 'ICARUS_shell.history'
_history = os.path.expanduser(_path)
def _save_history(historyPath = _history):
   readline.write_history_file(_history)
if os.path.exists(_history):
   readline.read_history_file(_history)
readline.parse_and_bind("tab: complete")
atexit.register(_save_history)


# define
_socket = generate_map('icarus_shell')['ctrl']
_client = ICARUS_Client(_socket)
i = ICARUS_MissionFactory()

def request(item):
   try:
      _client.execute(item)
   except Exception, e:
      print e

Esempio n. 5
0
         data = SensorData()
         data.ParseFromString(self.socket.recv())
         self.data = data
         print data
         self.event.set()



sm = generate_map('girlscamp')
print sm
mon_reader = MonReader(sm['core_data'])
imms_reader = IMMS_Reader(sm['imms_data'])
mon_reader.start()
imms_reader.start()
_client = ICARUS_Client(sm['ctrl'])
i = ICARUS_MissionFactory()


def request(item):
   try:
      _client.execute(item)
   except Exception, e:
      print e


class Ctrl:

   def __init__(self):
      self.pos = [(0,0), (10, 0), (10, 10), (0, 10), (0,0)]
      self.i = -1