paparazzi / pprzlink

Message and communication library for the Paparazzi UAV system
Other
24 stars 55 forks source link

Refactored pprzlink python Ivy link interface to improve error reporting #117

Closed MJafarMashhadi closed 4 years ago

MJafarMashhadi commented 4 years ago

xref #116

Changes:


This changes the class's interface (send and send_raw_datalink methods' to be more specific) and could become backwards-incompatible. I cross-checked usages of IvyMessagesInterface with the main repository, including the submoduled projects. Most of them were only subscribing to certain messages and weren't using these methods. The ones which sent messages were not sending telemetry messages that can in an special case raise ValueError. To best of my knowledge, this is safe to merge, but it never hurts to have a second pair of more experienced eyes review it.

gautierhattenberger commented 4 years ago

I think this is a good option to raise exceptions. however, I think there are a few other places where it should be catch properly, not only in ivy.py. serial.py, udp.py and message.py are also using messages_xml_map. What do you think ?

MJafarMashhadi commented 4 years ago

Hi, thanks for you comment!

Here I handled the exception because the source of the error is outside the program, it happens when receives an unknown message and just ignores it which is robust and fine. There is a piece of code in pprz_transport that does the same thing and I missed. I'll fix that in a few hours.

In other parts, the messages_xml_map usages were either safe (e.g. calling parse_messageswhich doesn't raise any exceptions) or with valid parameters (e.g. constants in tests or values that are already checked).

The last case is in the PprzMessaage constructor which gets the inputs as parameters from the user. If the parameters are invalid it's the user's responsibility to handle the error, so I didn't add any error handling there.

MJafarMashhadi commented 4 years ago

There is a piece of code in pprz_transport that does the same thing and I missed. I'll fix that in a few hours.

I'm done now. Please review the new changes. Thanks!

MJafarMashhadi commented 4 years ago

As long as they are not sending telemetry messages (which I couldn't find any) they should be fine, but if there were any bug reports just mention me I'd be more than happy to fix 😅

-- send_raw_datalink is used in:

send is used in:

That's all

gautierhattenberger commented 4 years ago

thanks for the detailed review!

MJafarMashhadi commented 4 years ago

Thank you!