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

Orbbec driver doesn't respect external namespace #23

Open
bmegli opened this issue Jan 16, 2024 · 3 comments
Open

Orbbec driver doesn't respect external namespace #23

bmegli opened this issue Jan 16, 2024 · 3 comments

Comments

@bmegli
Copy link

bmegli commented Jan 16, 2024

Launching driver under external namespace

# below is equivalent to using group with ns in extra launchfile
ROS_NAMESPACE="some_namespace" roslaunch orbbec_camera femto_bolt.launch

One ends up with a mix of namespaced and non-namespaced topics

rostopic list
/camera/color/camera_info
/camera/color/image_raw
/camera/depth/camera_info
/camera/depth/image_raw
/camera/ir/camera_info
/camera/ir/image_raw
/rosout
/rosout_agg
/some_namespace/camera/depth/points
/some_namespace/camera/gyro_accel/sample
/tf
/tf_static
@bmegli
Copy link
Author

bmegli commented Jan 16, 2024

The reason why above problem happens is using absolute paths when advertising ROS topics

std::string topic_name = "/" + camera_name_ + "/" + name + "/image_raw";
ros::SubscriberStatusCallback image_subscribed_cb =
boost::bind(&OBCameraNode::imageSubscribedCallback, this, stream_index);
ros::SubscriberStatusCallback image_unsubscribed_cb =
boost::bind(&OBCameraNode::imageUnsubscribedCallback, this, stream_index);
image_publishers_[stream_index] = nh_.advertise<sensor_msgs::Image>(
topic_name, 1, image_subscribed_cb, image_unsubscribed_cb);
topic_name = "/" + camera_name_ + "/" + name + "/camera_info";
camera_info_publishers_[stream_index] = nh_.advertise<sensor_msgs::CameraInfo>(
topic_name, 1, image_subscribed_cb, image_unsubscribed_cb);

Precisely /, at the beginning of topic_name should be removed to support relative namespaces correctly

bmegli added a commit to Extend-Robotics/OrbbecSDK_ROS1 that referenced this issue Jan 16, 2024
- currently majority of topics is advertised under absolute paths
- and some under relative

Corretly use relative paths when advertizing topics

Related to:
- orbbec#23
@bmegli
Copy link
Author

bmegli commented Jan 16, 2024

Ok, this is bit more messed up than I thought

  • using relative paths brings back ROS namespace mechanisms to work.
  • but since Orbbec driver glues paths manually one ends up with double namespace
    • and sometimes without as implementation is inconsistent here
rostopic list
/camera/camera/color/camera_info
/camera/camera/color/image_raw
/camera/camera/depth/camera_info
/camera/camera/depth/image_raw
/camera/camera/ir/camera_info
/camera/camera/ir/image_raw
/camera/depth/points
/camera/gyro_accel/sample
/rosout
/rosout_agg
/tf
/tf_static

First camera above would be coming from roslaunch group ns automatically added by ROS
Second one is glued in code from camera_name

@bmegli
Copy link
Author

bmegli commented Jan 16, 2024

The same absolute path problem emerges for services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant