Repository navigation
#610: Wrap iterable call in try..except to deal with unrecognised vehicle codes - #611
Conversation
|
excellent contribution, would you have time to add integration tests? |
|
@mrpollo - Hi, I'm brand new to git development so haven't got a clue I'm afraid. But I'd like to learn and give it a go, if you could point me in the right direction? Even just an existing example I can look at? |
|
sure thing @fnoop take a look at the tests we have here https://github.com/dronekit/dronekit-python/tree/master/dronekit/test/sitl |
|
Note: The problem isn't that the mode code isn't in the mode mappings, it's that the mode mappings aren't created for all vehicle types, so _mode_mapping_bynumber() returns None for certain or unrecognised vehicle types (eg GCS). Thus _is_mode_available() then fails doing a lookup against a None where it's expecting a Dict. |
|
@mrpollo added a test that triggers the bug and fails in the current master, but passes after this PR is applied |
|
thanks for the clarification @fnoop I'm going to go ahead and merge, great work |
Mode code isn't always in the mode mappings - for example mode 0 that GCS seem to use. Handle the exception and return a false which seems to be logically correct return in this case.