AP_RangeFinder: ensure that too low and too far states are propagated in DroneCAN#31155
Conversation
peterbarker
left a comment
There was a problem hiding this comment.
Could you refactor this for early-return, please?
I think it may also be amenable to a switch but only 30% sure
|
It's an existing issue so not a blocker but I think it would be good to put comments in the AP_RangeFinder_DroneCAN.h file beside the internal variables (e.g. _status) to clarify that these are the values received from the sensor. maybe it's just me but I find it quite confusing to have set_status(_status). |
|
I think that @peterbarker also suggested that we change the logic in the update() method to have early returns and/or a switch statement. I think the logic could be:
Re the status:
|
2cc4afc to
1383b1c
Compare
Fixed
Yes, but in this case the distance we have received is "TooLow" the only thing we can then usefully set it to is 0
Fixed these
This was already happening |
1383b1c to
d194631
Compare
peterbarker
left a comment
There was a problem hiding this comment.
This is a really good fix.
Let's make sure we get this in for 4.7....
4273794 to
03c380e
Compare
peterbarker
left a comment
There was a problem hiding this comment.
One this change is made my only question will be, "has it been tested in its current form?"
|
@andyp1per should set new_data on all types of new data from device |
03c380e to
2063989
Compare
2063989 to
1968a9d
Compare
…d correctly in DroneCAN
1968a9d to
4a9e0e5
Compare
peterbarker
left a comment
There was a problem hiding this comment.
LGTM. Can be merged after testing
|
@andyp1per looks good to me, thanks for the changes! just needs testing |
|
The current code means that you will always get "No Data" (which is fatal) rather than too low (which happens when you are sitting on the ground).