Can't get zbar_ros to recognize QR code
Hello,
Beginner here -- I am trying to use zbarros to read a qr code using my laptop's webcam. It doesn't seem to be able to subscribe to the /image topic and /barcodereader isn't subscribed to anything. I am using Ubuntu 14.04 and ROS indigo. Any thoughts on what I am missing?
My launch file:
<?xml version="1.0"?>
<node pkg="nodelet" type="nodelet" name="zbar_manager" args="manager"/>
<!-- Example camera launch -->
<node pkg="nodelet" type="nodelet" name="uvc_camera" args="load uvc_camera/CameraNodelet zbar_manager">
<remap from="image_raw" to="image"/>
<param name="device" type="string" value="/dev/video0"/>
</node>
<!--<node pkg="nodelet" type="nodelet" name="barcode_reader" args="load zbar_ros/barcode_reader_nodelet zbar_manager">-->
<!--<param name="throttle_repeated_barcodes" type="double" value="2.0"/>-->
<!--</node>-->
<node pkg="zbar_ros" type="barcode_reader_node" name="barcode_reader">
<param name="throttle_repeated_barcodes" type="double" value="2.0"/>
</node>
$roslaunch zbar_ros customlaunch.launch
SUMMARY
========
PARAMETERS
* /barcode_reader/throttle_repeated_barcodes: 2.0
* /rosdistro: indigo
* /rosversion: 1.11.20
* /uvc_camera/device: /dev/video0
NODES
/
barcode_reader (zbar_ros/barcode_reader_node)
uvc_camera (nodelet/nodelet)
zbar_manager (nodelet/nodelet)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
process[zbar_manager-1]: started with pid [6111]
process[uvc_camera-2]: started with pid [6112]
process[barcode_reader-3]: started with pid [6113]
$ rosnode info /barcode_reader
Node [/barcode_reader]
Publications:
* /rosout [rosgraph_msgs/Log]
* /barcode [std_msgs/String]
Subscriptions: None
Services:
* /barcode_reader/get_loggers
* /barcode_reader/set_logger_level
* /barcode_reader/load_nodelet
* /barcode_reader/unload_nodelet
* /barcode_reader/list
contacting node http://192.168.40.120:37988/ ...
Pid: 6113
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS
Asked by lmm1910 on 2017-03-12 19:35:04 UTC
Answers
What is good to know about zbar_ros is that it only subscribes to the image topic when you start listening on its output topic (relevant function in zbar_ros source). As soon as you run rostopic echo /barcode
, you will see a notification that zbar_ros subscribes to the image topic.
As a sidenote: in my setup I did the remap on the zbar_ros side, instead of the camera side. Not sure if that is relevant.
Asked by Cees on 2017-03-13 04:33:32 UTC
Comments
Thanks! I think the issue may be with camera calibration since I can read bar codes at a certain length, but not QR codes.
Asked by lmm1910 on 2017-03-18 14:41:12 UTC
If you are able to read some barcodes, you should see the connection between zbar_ros and your image topic in rqt_graph. As for your problem: Are you sure your QR code is not mirrored? Zbar cannot handle that.
Asked by Cees on 2017-03-19 05:04:06 UTC
Comments