Example #1
0
    def AddIcarousInstance(self, ic, delay=0, time_limit=1000,
                           transmitter="GroundTruth", receiver="GroundTruth"):
        """
        Add an Icarous instance to the simulation environment
        :param ic: An Icarous instance
        :param delay: Time to delay before starting mission (s)
        :param time_limit: Time limit to fly before shutting vehicle down (s)
        :param transmitter: A Transmitter to send V2V position data,
        ex: "ADS-B" or "GroundTruth", or None for no transmitter
        :param receiver: A Receiver to get V2V position data,
        ex: "ADS-B" or "GroundTruth", or None for no receiver
        """
        self.icInstances.append(ic)
        self.icStartDelay.append(delay)
        self.icTimeLimit.append(time_limit)

        # Create a transmitter and receiver for V2V communications
        ic.transmitter = get_transmitter(transmitter, ic.vehicleID, self.comm_channel)
        ic.receiver = get_receiver(receiver, ic.vehicleID, self.comm_channel)

        # Set simulation home position
        if self.home_gps == [0, 0, 0]:
            self.home_gps = ic.home_pos

        if self.verbose > 0:
            print(ic.callsign)
            print("\ttransmitter:", ic.transmitter.description)
            print("\treceiver:", ic.receiver.description)
Example #2
0
    def AddGroundSystem(self, gs, transmitter="GroundTruth", receiver="GroundTruth"):
        """
        Add a GroundSystem instance to the simulation environment
        (A ground-based system that interacts with vehicles by transmitting/receiving messages)
        :param gs: A GroundSystem instance
        :param transmitter: A Transmitter to send V2V position data,
        ex: "ADS-B" or "GroundTruth", or None for no transmitter
        :param receiver: A Receiver to get V2V position data,
        ex: "ADS-B" or "GroundTruth", or None for no receiver
        """
        self.gsInstances.append(gs)

        # Create a transmitter and receiver for V2V communications
        gs.transmitter = get_transmitter(transmitter, gs.id, self.comm_channel)
        gs.receiver = get_receiver(receiver, gs.id, self.comm_channel)