Ejemplo n.º 1
0
 def TransmitPosition(self, current_time):
     """ Transmit current position """
     if self.transmitter is None:
         return
     gps_position = self.GetOutputPositionLLA()
     velocity = self.GetOutputVelocityNED()
     msg_data = {
         "callsign": "tf" + str(self.vehicleID),
         "pos": gps_position,
         "vel": velocity,
     }
     msg = V2Vdata("INTRUDER", msg_data)
     self.transmitter.transmit(current_time, gps_position, msg)
Ejemplo n.º 2
0
 def ReceiveV2VData(self):
     # Receive messages from distributed sim instances
     if self.network is not None:
         rcvmsgs = self.network.Receive()
         for msg in rcvmsgs:
             msg["data"] = V2Vdata(**msg["data"])
             self.comm_channel.messages.append(cm.Message(**msg))
     # Receive all V2V data
     for ic in self.icInstances:
         ic.ReceiveV2VData()
     for gs in self.gsInstances:
         gs.ReceiveV2VData()
     # Clear all the messages in the channel for the new cycle
     self.comm_channel.flush()
Ejemplo n.º 3
0
 def TransmitPosition(self):
     """ Transmit current position """
     # Do not broadcast if running SBN
     if "SBN" in self.apps:
         return
     if self.transmitter is None:
         return
     if not self.missionStarted or self.missionComplete:
         return
     msg_data = {
         "callsign": self.callsign,
         "pos": self.position,
         "vel": self.velocity,
     }
     msg = V2Vdata("INTRUDER", msg_data)
     self.transmitter.transmit(self.currTime, self.position, msg)
Ejemplo n.º 4
0
    def TransmitMergingData(self):
        """ Transmit data to coordinate merges """
        # Do not broadcast if running SBN
        if self.transmitter is None:
            return
        if not self.missionStarted or self.missionComplete:
            return

        out, arrdata = self.core.GetArrivalTimes()
        if out:
            if self.intersectionID != arrdata['intersectionID']:
                self.mergeLogs = {}
            self.mergeLogs[arrdata['aircraftID']] = arrdata
            self.intersectionID = arrdata['intersectionID']
        if self.intersectionID > 0:
            msg = V2Vdata('MERGER', arrdata)
            self.transmitter.transmit(self.currTime, self.position, msg)
Ejemplo n.º 5
0
    def TransmitPosition(self, current_time):
        """ Transmit recorded traffic positions """
        if self.transmitter is None:
            return

        if self.current_time is None:
            self.position_updates.index += current_time
            self.current_time = current_time

        # Transmit all traffic messages up to current time
        traffic_messages = self.position_updates[self.current_time:current_time]
        for i, traffic_msg in traffic_messages.iterrows():
            posLLA = [traffic_msg.lat, traffic_msg.lon, traffic_msg.alt]
            velNED = [traffic_msg.vn, traffic_msg.ve, traffic_msg.vd]
            msg_data = {
                "callsign": "replay_" + traffic_msg.vehicleID,
                "pos": posLLA,
                "vel": velNED,
            }
            msg = V2Vdata("INTRUDER", msg_data)
            self.transmitter.transmit(current_time, posLLA, msg)

        self.current_time = current_time