Apriltag_ros 'no image received'
Hello everyone, I have a bag file where I recorded some tags in a building. When I play the bag file and start the launch file of apriltag, in rviz there isn't any feedback of the 'tagdetectionsimage' topic, it says 'no image received'. Any suggestion? Thanks
I'm using ubuntu 18.04 with ros melodic
rqt_graph:
Asked by Davide_970 on 2020-08-13 04:31:13 UTC
Answers
EDIT:
apriltag_ros
requires the /camera_info
topic to be published. You need a bagfile with that topic in it.
================
The error in your question occurs when no image is published to the subscribed topic. According to the wiki of the apriltag_ros
package, the subscribed topic is image_rect
, which is the rectified camera image. Normally you would use the package image_proc to automatically publish the rectified image according to your camera calibration file.
Since you don't have the rectified image, you can simply remap your image topic, see below:
Here is a launchfile for apriltag I've found:
<launch>
<arg name="launch_prefix" default="" /> <!-- set to value="gdbserver localhost:10000" for remote debugging -->
<arg name="node_namespace" default="apriltag_ros_continuous_node" />
<arg name="camera_name" default="/camera_rect" />
<arg name="camera_frame" default="camera" />
<arg name="image_topic" default="image_rect" />
<!-- Set parameters -->
<rosparam command="load" file="$(find apriltag_ros)/config/settings.yaml" ns="$(arg node_namespace)" />
<rosparam command="load" file="$(find apriltag_ros)/config/tags.yaml" ns="$(arg node_namespace)" />
<node pkg="apriltag_ros" type="apriltag_ros_continuous_node" name="$(arg node_namespace)" clear_params="true" output="screen" launch-prefix="$(arg launch_prefix)" >
<!-- Remap topics from those used in code to those on the ROS network -->
<remap from="image_rect" to="$(arg camera_name)/$(arg image_topic)" />
<remap from="camera_info" to="$(arg camera_name)/camera_info" />
<param name="camera_frame" type="str" value="$(arg camera_frame)" />
<param name="publish_tag_detections_image" type="bool" value="true" /> <!-- default: false -->
</node>
</launch>
In your case, you publish /usb_cam/image_raw
in your bagfile, but apriltag with the above launchfile wants /camera_rect/image_rect
: you can see this from line <remap from="image_rect" to="$(arg camera_name)/$(arg image_topic)" />
.
This line uses the remap function where you can remap a topic to a different name.
So you just have to change the args camera_name
to "/usb_cam" and image_topic
to "image_raw"-
Alternatively you could pass these arguments during launching in the command line, something like:
roslaunch apriltag_ros launchfile.launch camera_name:="/usb_cam" image_topic:="image_raw"
Asked by rfn123 on 2020-08-17 12:22:21 UTC
Comments
It didn't work again (rviz tag_detection_image is still in "no image"), but launching the launch file with the new parameters, now rqt_graph is changed: screen
Asked by Davide_970 on 2020-08-17 13:02:31 UTC
when you do rostopic echo /usb_cam/image_raw
, is it empty while playing the rosbag?
Asked by rfn123 on 2020-08-17 13:06:32 UTC
When looking at the ROS wiki for apriltag_ros, I see that the camera_info
topic is required. You probably have to record the bagfile again, this time_with_ the camera_info topic
Asked by rfn123 on 2020-08-17 13:10:00 UTC
Mmm if it’s true that I have to record again I have to write to my professor that I record for me that bag file Big trouble :/
Asked by Davide_970 on 2020-08-17 13:35:23 UTC
Comments
Could you show the rqt_graph in the moment you run the bag?
Asked by Teo Cardoso on 2020-08-16 11:44:22 UTC
Yes, I put it
Asked by Davide_970 on 2020-08-16 12:40:31 UTC
which image topic are you publishing to? Is this consistent with the topic the april tag node is subscribing to? Are there images published on this topic? --- These would be generally questions to verify when such errors occur
Asked by rfn123 on 2020-08-17 05:33:28 UTC
The bag file sends the following topics:
clock
odom
scan
usb_cam/image_raw
While apriltag node take as input "image_rect" msg.
I tried to find a solution on internet such as convertion from image_raw to image_rect but I didn't find anything
Asked by Davide_970 on 2020-08-17 06:41:34 UTC
@Davide_970 have a look at image_proc
Asked by rfn123 on 2020-08-17 08:44:07 UTC
Thanks! I’ll try
Asked by Davide_970 on 2020-08-17 08:48:06 UTC
Image_proc asks me a manager.
In the wiki manager is "The name of the target nodelet manager. It will need to be globally qualified (e.g. /my_manager), unless the manager is already in the camera namespace."
But I don't understand what I have to do
Asked by Davide_970 on 2020-08-17 09:42:54 UTC
try adding
<node ns="usb_cam" name="image_proc" pkg="image_proc" type="image_proc"/>
in your camera launch fileAsked by rfn123 on 2020-08-17 10:07:21 UTC
But I don't have a camera launch file because it's a bag file previusly recorded, so I only send a "rosbag play" command
Asked by Davide_970 on 2020-08-17 10:09:14 UTC
Then you can try to put it in a separate launchfile which you will launch when the rosbag plays
Asked by rfn123 on 2020-08-17 10:37:21 UTC
Now the new launch file search "usb_cam/camera_info" topic and not "usb_cam/image_raw" topic. I try to rewrite the launch file adding "/image_raw" but it didn't work..
In fact it says "[ WARN] [1597680572.009258847]: The input topic '/usb_cam/camera_info' is not yet advertised"
Asked by Davide_970 on 2020-08-17 11:02:48 UTC
Ok, then we make it the other way round: we want to change the topic name where april tag node subscribes to. Which launch file do you use? Is there an option to change the image topic?
Asked by rfn123 on 2020-08-17 12:06:43 UTC