Closed Luca-Pozzi closed 9 months ago
Hi @Luca-Pozzi, thanks for your contribution!
In general, the idea of checking the message format and set a parameter to represent it is perfectly fine. However, why waiting a message for (maximum) 10 seconds when we will receive it and read it anyway later in the callback? I think the best option is to check in the callback whether the parameter has been set or not and setting it in the latter case.
Thank you for the feedback @LorenzoFerriniCodes!
The answer to your question, is that I have not thought about it 😅 Definitely a smarter implementation than mine.
I hope to implement the changes later this afternoon
Done, the check for depth encoding is now moved to the callback(s).
Thank you for the advice!
This PR implements the changes described in #5 to add support for depth data encoded as 32bit floats.
The code checks for the encoding on the depth topic (if
use_depth
is true) by waiting 10s for a depth message. If the 10s timeout is reached, the encoding defaults to the original16UC1
. I am not a huge fan ofrospy.wait_for_message
but I find more reasonable to add a little overhead than re-reading the (same) encoding from each and every Image msg.