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"
Could you show the rqt_graph in the moment you run the bag?
Yes, I put it
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
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
@Davide_970 have a look at image_proc
Thanks! I’ll try
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
try adding
<node ns="usb_cam" name="image_proc" pkg="image_proc" type="image_proc"/>
in your camera launch file