-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix discovery silently stops after unknown msg type is found. #848
Conversation
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@Barry-Xu-2018 would you mind taking time for review since this comes from us. I'll do the same. |
Yeah. I will check this PR. |
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
I have no comments on the latest updating. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, as long as it passes CI
Before I approve this PR - I am wondering if there is a simpler way to implement this. Does the existing behavior throw an exception when it tries to create a subscription to an unknown type, thus cancelling the discovery behavior? Can we simply catch this exception and print a warning message - instead of implementing complex filtering logic? |
Yes, when create a subscription with an unknown type, will throw a exception and lead to the discovery process stuck.
The simple way is try to skip create_subscription with unknown type and print warning like this: ...
std::shared_ptr<rclcpp::GenericSubscription>
Recorder::create_subscription(
const std::string & topic_name, const std::string & topic_type, const rclcpp::QoS & qos)
{
// << catch the exception below >>
auto subscription = this->create_generic_subscription(
topic_name,
topic_type,
qos,
[this, topic_name](std::shared_ptr<rclcpp::SerializedMessage> message) {
auto bag_message = std::make_shared<rosbag2_storage::SerializedBagMessage>();
... but this will print warning in a loop if someone continue sending the unknown type messages, this may flush the log.
so I tried to filter out the unknown type messages, and keep the unknown types to make it only print warning once, I think this may good for performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Oh - good call. I didn't realize that because of |
* Discovery silently stops after unknown msg type is found. Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
* Discovery silently stops after unknown msg type is found. Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com> Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
* Discovery silently stops after unknown msg type is found. Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com> Signed-off-by: Wojciech Jaworski <wojciech.jaworski@robotec.ai>
Signed-off-by: Lei Liu Lei.Liu.AP@sony.com
This PR fixed (#829)