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

Fix resolving sub-namespaces incorrectly #188

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion image_transport/src/camera_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ CameraPublisher::CameraPublisher(
{
// Explicitly resolve name here so we compute the correct CameraInfo topic when the
// image topic is remapped (#4539).

// FIXME: once https://github.com/ros2/rclcpp/issues/1656 is resolved, see #187
std::string effective_namespace = node->get_effective_namespace();
if (effective_namespace.length() > 1 && effective_namespace.back() == '/')
effective_namespace.pop_back();

std::string image_topic = rclcpp::expand_topic_or_service_name(base_topic,
node->get_name(), node->get_namespace());
node->get_name(), effective_namespace);
std::string info_topic = getCameraInfoTopic(image_topic);

auto qos = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(custom_qos), custom_qos);
Expand Down
8 changes: 7 additions & 1 deletion image_transport/src/camera_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@ CameraSubscriber::CameraSubscriber(
{
// Must explicitly remap the image topic since we then do some string manipulation on it
// to figure out the sibling camera_info topic.

// FIXME: once https://github.com/ros2/rclcpp/issues/1656 is resolved, see #187
std::string effective_namespace = node->get_effective_namespace();
if (effective_namespace.length() > 1 && effective_namespace.back() == '/')
effective_namespace.pop_back();

std::string image_topic = rclcpp::expand_topic_or_service_name(base_topic,
node->get_name(), node->get_namespace());
node->get_name(), effective_namespace);
std::string info_topic = getCameraInfoTopic(image_topic);

impl_->image_sub_.subscribe(node, image_topic, transport, custom_qos);
Expand Down
8 changes: 7 additions & 1 deletion image_transport/src/publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,14 @@ Publisher::Publisher(
{
// Resolve the name explicitly because otherwise the compressed topics don't remap
// properly (#3652).

// FIXME: once https://github.com/ros2/rclcpp/issues/1656 is resolved, see #187
std::string effective_namespace = node->get_effective_namespace();
if (effective_namespace.length() > 1 && effective_namespace.back() == '/')
effective_namespace.pop_back();

std::string image_topic = rclcpp::expand_topic_or_service_name(base_topic,
node->get_name(), node->get_namespace());
node->get_name(), effective_namespace);
impl_->base_topic_ = image_topic;
impl_->loader_ = loader;

Expand Down