orbbec / OrbbecSDK_ROS1

OrbbecSDK ROS wrapper
Apache License 2.0
56 stars 36 forks source link

Orbbec driver doesn't respect external namespace #23

Open bmegli opened 10 months ago

bmegli commented 10 months ago

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 commented 10 months ago

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

https://github.com/orbbec/OrbbecSDK_ROS1/blob/54ca6bcb54ccc731879d4ea155dd9836de8c62f6/src/ros_setup.cpp#L259-L268

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

bmegli commented 10 months ago

Ok, this is bit more messed up than I thought

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 commented 10 months ago

The same absolute path problem emerges for services