diff --git a/conf/airframes/TUDelft/silverlit_lisas.xml b/conf/airframes/TUDelft/silverlit_lisas.xml index 53d821595b..df002cedc5 100644 --- a/conf/airframes/TUDelft/silverlit_lisas.xml +++ b/conf/airframes/TUDelft/silverlit_lisas.xml @@ -1,6 +1,6 @@ - diff --git a/sw/ground_segment/python/dashboard/radiowatchframe.py b/sw/ground_segment/python/dashboard/radiowatchframe.py index 0a2a35ee2a..d2f0e5c8bc 100644 --- a/sw/ground_segment/python/dashboard/radiowatchframe.py +++ b/sw/ground_segment/python/dashboard/radiowatchframe.py @@ -45,7 +45,7 @@ class RadioWatchFrame(wx.Frame): self.aircrafts = {} self.rc_statusText = wx.StaticText(self, -1, "UNKWN") - + pygame.mixer.init() self.alertSound = pygame.mixer.Sound("crossing.wav") self.alertChannel = pygame.mixer.Channel(False) diff --git a/sw/ground_segment/python/joystick/arduino_dangerboard.py b/sw/ground_segment/python/joystick/arduino_dangerboard.py index fc9d8d373a..f29e777b14 100755 --- a/sw/ground_segment/python/joystick/arduino_dangerboard.py +++ b/sw/ground_segment/python/joystick/arduino_dangerboard.py @@ -22,7 +22,7 @@ import serial # sudo apt-get install python-serial class arduino_dangerboard(): def __init__(self, port='/dev/ttyUSB0'): - self.port = serial.Serial(port, 115200) + self.port = serial.Serial(port, 115200) self.SLIDER_COUNT = 3 self.sliders = [0] * self.SLIDER_COUNT self.POT_MIN = 0.0 @@ -31,14 +31,14 @@ class arduino_dangerboard(): def HandleEvent(self): pass - + def poll(self): while( True): - + self.port.write('G'); foo = self.port.inWaiting() - + if foo == 6: a = ord( self.port.read()) b = ord( self.port.read()) @@ -46,20 +46,20 @@ class arduino_dangerboard(): d = ord( self.port.read()) e = ord( self.port.read()) f = ord( self.port.read()) - + self.sliders[0] = (a << 8) | b; self.sliders[1] = (c << 8) | d; self.sliders[2] = (e << 8) | f; self.HandleEvent() - + else: # flush queue while foo: foo -= 1 data = self.port.read() - + time.sleep(0.25); - + def main(): diff --git a/sw/ground_segment/python/redundant_link/README b/sw/ground_segment/python/redundant_link/README index 10bc0178a7..0180415bd3 100644 --- a/sw/ground_segment/python/redundant_link/README +++ b/sw/ground_segment/python/redundant_link/README @@ -9,7 +9,7 @@ This software enables multiple downlinks in order to provide redundancy in the p TO USE: -1. First, implement the hardware to have multiple independant streams of data sent to the ground station computer. +1. First, implement the hardware to have multiple independant streams of data sent to the ground station computer. 2. In Paparazzi Center, run an instance of the Link agent for each stream of data. Configure each Link agent according to it's stream. Also, use the -id flag to give each link a unique id (an integer number) and the -redlink flag to tell the link it should be a redundant link. 3. Run the Link Combiner agent. @@ -19,10 +19,10 @@ sw/ground_segment/tmtc/server sw/ground_segment/cockpit/gcs sw/ground_segment/tmtc/link -d /dev/ttyUSB0 -id 1 -redlink sw/ground_segment/tmtc/link -d /dev/ttyUSB1 -id 2 -redlink -sw/ground_segment/python/redundant_link/link_combiner.py +sw/ground_segment/python/redundant_link/link_combiner.py HOW IT WORKS: -When the link agent is run with the -redlink flag set, instead of transmitting the data it receives over the ivy bus like normal, it encapsulates it in a TELEMETRY_MESSAGE message which also contains the link id. The Link Combiner listens to these messages from each link and sends data over the ivy bus to the other agents as if it was a link. The Link Combiner also sends the LINK_STATUS message so that the GCS can display the status of each link. +When the link agent is run with the -redlink flag set, instead of transmitting the data it receives over the ivy bus like normal, it encapsulates it in a TELEMETRY_MESSAGE message which also contains the link id. The Link Combiner listens to these messages from each link and sends data over the ivy bus to the other agents as if it was a link. The Link Combiner also sends the LINK_STATUS message so that the GCS can display the status of each link. The Link Combiner uses an algorithm to filter out duplicate messages. In other words, if a message is sent by the autopilot over both links and it is received by both links, then it's the same message and should only be handled once by other agents such as the GCS. The Link Combiner's algorithm therefore ignores a message received over any link if it's identical to a message received by another link. This is achieved by keeping a buffer of the last N messages for each link. Once a message has been received by all links, it's removed from the buffer. Also, the buffer is circular, so even if a message isn't received by all links, it will be overwritten after N more messages are received. This algorithm isn't guaranteed to be perfect, but in typical operation, it seems to work very well. And for the application of displaying aircraft data, some missing or duplicate data is acceptable. diff --git a/sw/ground_segment/python/redundant_link/link_combiner.py b/sw/ground_segment/python/redundant_link/link_combiner.py index a3927edf72..4256d4fec2 100755 --- a/sw/ground_segment/python/redundant_link/link_combiner.py +++ b/sw/ground_segment/python/redundant_link/link_combiner.py @@ -17,9 +17,9 @@ # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -"""This program listens to ivy messages from the link agent (see link.ml) +"""This program listens to ivy messages from the link agent (see link.ml) when the link's -name arguement is set. It combines messages received from -any number of link agents and sends ivy messages to the Server and other +any number of link agents and sends ivy messages to the Server and other agents.""" from __future__ import print_function @@ -161,13 +161,13 @@ class Link: def sendLinkStatusMessage(self): for ac_id in self.acs: - values = ( self.name, - self.timeSinceLastMessage(), - self.run_time, - self.rx_bytes, - self.rx_msgs, - self.rx_err, - self.rx_bytes_rate, + values = ( self.name, + self.timeSinceLastMessage(), + self.run_time, + self.rx_bytes, + self.rx_msgs, + self.rx_err, + self.rx_bytes_rate, self.rx_msgs_rate, self.ping_time) @@ -249,7 +249,7 @@ class Link_Combiner: #If the message is already in this link's buffer, then taking it as not a duplicate. So returning False. But also, removing it from all buffers. So that when they receive it, they don't do the same. #If the message is not in this link's buffer, then checking all other buffers and only if it's not in any of them, counting the message as not a duplicate. - match = self.links[message.linkName()].checkBuffer(message) + match = self.links[message.linkName()].checkBuffer(message) if match: #Removing the message from all buffers for link_name in self.links: self.links[link_name].removeFromBuffer(message) @@ -291,7 +291,7 @@ def main(): global BUFFER_SIZE global LINK_STATUS_PERIOD - BUFFER_SIZE = int(args.buffer_size) #The number of elements messages to be stored in the circular buffer for each link. + BUFFER_SIZE = int(args.buffer_size) #The number of elements messages to be stored in the circular buffer for each link. LINK_STATUS_PERIOD = float(args.link_status_period)/1000 #The number of seconds in between LINK_STATUS messages being sent to the GCS. @@ -299,4 +299,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/sw/ground_segment/python/udp_link/proxy_udp_multicast_to_link.py b/sw/ground_segment/python/udp_link/proxy_udp_multicast_to_link.py index d90c84cb68..c685c15e49 100755 --- a/sw/ground_segment/python/udp_link/proxy_udp_multicast_to_link.py +++ b/sw/ground_segment/python/udp_link/proxy_udp_multicast_to_link.py @@ -30,7 +30,7 @@ while( 1 ): data = None try: data, addr = msock.recvfrom(1024) - + format = 'B' * (len(data)) strdata = struct.unpack( format, data ) diff --git a/sw/ground_segment/python/udp_link/udp_link.py b/sw/ground_segment/python/udp_link/udp_link.py index f87529ed8f..dfb08b969d 100755 --- a/sw/ground_segment/python/udp_link/udp_link.py +++ b/sw/ground_segment/python/udp_link/udp_link.py @@ -98,7 +98,7 @@ class IvyUdpLink(): (ck_a, ck_b) = self.calculate_checksum(msg) msg = msg + struct.pack('=BB', ck_a, ck_b) return msg - + def OnSettingMsg(self, agent, *larg): list = larg[0].split(' ') sender = list[0] @@ -118,7 +118,7 @@ class IvyUdpLink(): address = (self.ac_downlink_status[int(ac_id)].address[0], DATALINK_PORT) self.server.sendto(msgbuf, address) value.last_ping_time = time.clock() - + self.ping_timer = threading.Timer(STATUS_PERIOD, self.sendPing) self.ping_timer.start() @@ -147,7 +147,7 @@ class IvyUdpLink(): self.ac_downlink_status[ac_id].rx_msgs += 1 self.ac_downlink_status[ac_id].rx_bytes += length if isPong: - self.ac_downlink_status[ac_id].last_pong_time = time.clock() - self.ac_downlink_status[ac_id].last_ping_time + self.ac_downlink_status[ac_id].last_pong_time = time.clock() - self.ac_downlink_status[ac_id].last_ping_time def ProcessPacket(self, msg, address): if len(msg) < 4: @@ -176,7 +176,7 @@ class IvyUdpLink(): msg_id = ord(msg[msg_offset]) msg_offset = msg_offset + 1 - + msg_name = messages_xml_map.message_dictionary_id_name["telemetry"][msg_id] msg_fields = messages_xml_map.message_dictionary_types["telemetry"][msg_id]