ros-perception / ros-perception/image_common
Can't remap topic name and set hint at the same time;
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 153
- Forks
- 253
- Avg merge
- 5m
- Merged PRs (30d)
- 1
Description
OS: Ubuntu 20.04
ROS: Galactic
Verions: 2.3.0-3 installed from Debian
I am trying to create a generic ROS2 node that subscribes to an image topic of a user's choice (through remapping of a topic name) and a user can in addition set the transport hint. Pretty straight forward, this is how image_saver from the image_view package used to work on ROS1
node->declare_parameter("transport", "raw");
std::string transport = node->get_parameter("transport").get_value<std::string>();
image_sub_ = image_transport::create_subscription(
&(*node), "image", std::bind(&MyClass::imageCallback, this, std::placeholders::_1), transport);
I run my node with ros2 run my_package my_node --ros-args -r image:=/my_image_topic/image_raw -p transport:=compressed but the output of ros2 node info my_node shows:
/my_node
Subscribers:
/image/compressed: sensor_msgs/msg/CompressedImage
If I don't set the parameter from the command line the remapping of the topic name works and I get:
/my_node
Subscribers:
/my_image_topic/image_raw: sensor_msgs/msg/Image
I have also tried doing this using TransportHints and creating the subscriber with it_.subscribe("image", 10, &MyClass::imageCallback, this, &hints); , and the overwriting the image_transport parameter; The first problem here is that this parameter from TransportHints is never declared, so I had to declare it from my node in order to overwrite it; But then the behavior is still the same; We can either remap the topic name or change the hint but not both at the same time;
I also tried this out with the image_saver node from image_view package on ROS2 and could not get that one to run either;
I suspect that this might be a bug somewhere in the code when resolving names of topics and parameters; My current workaround is to set both the topic name and the hint from parameters;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported command-line case with image_transport and compare it with image_saver and the TransportHints approach. Start by tracing how the remapped image name and transport parameter are resolved, then verify that both the requested topic and transport hint are applied together. Done means a node can use -r image:=/my_image_topic/image_raw and -p transport:=compressed in the same invocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- robotics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100