Skip to content
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

gracefully handle invalid ROS 1 publishers #266

Merged
merged 1 commit into from
May 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/ros1_bridge/factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ class Factory : public FactoryInterface
}
}

void * ptr = ros1_pub;
if (ptr == 0) {
RCLCPP_WARN_ONCE(
logger,
"Message from ROS 2 %s failed to be passed to ROS 1 %s because the "
"ROS 1 publisher is invalid (showing msg only once per type)",
ros2_type_name.c_str(), ros1_type_name.c_str());
return;
}

ROS1_T ros1_msg;
convert_2_to_1(*ros2_msg, ros1_msg);
RCLCPP_INFO_ONCE(
Expand Down