Open prostraintechnologies opened 2 years ago
I had same issue
try edit here https://github.com/mdrwiega/qr_detector/blob/master/src/qr_detector_nodelet.cpp#L50
void QrDetectorNodelet::imageCallback(const sensor_msgs::ImageConstPtr &image)
{
cv_bridge::CvImageConstPtr cv_image;
std_msgs::String qr_msg;
try {
cv_image = cv_bridge::toCvShare(image, sensor_msgs::image_encodings::BGR8);
}
catch (cv_bridge::Exception& e) {
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
auto tags = detector_.detect(cv_image->image, 10);
for (auto& tag : tags)
{
qr_msg.data = tag.message;
tags_publisher_.publish(qr_msg);
}
}
it works for me
hi,
I tried to catkin_make but it gave me these errors:
[ 86%] Built target hmi_node_generate_messages In file included from /opt/ros/melodic/include/ros/serialization.h:37:0, from /opt/ros/melodic/include/ros/publisher.h:34, from /opt/ros/melodic/include/ros/node_handle.h:32, from /opt/ros/melodic/include/ros/ros.h:45, from /home/prostrain/catkin_ws/src/qr_detector/include/qr_detector/qr_detector_nodelet.h:3, from /home/prostrain/catkin_ws/src/qr_detector/src/qr_detector_nodelet.cpp:1: /opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char ros::message_traits::MD5Sum::value(const M&) [with M = std::__cxx11::basic_string]’:
/opt/ros/melodic/include/ros/message_traits.h:254:102: required from ‘const char ros::message_traits::md5sum(const M&) [with M = std::cxx11::basic_string]’
/opt/ros/melodic/include/ros/publisher.h:116:38: required from ‘void ros::Publisher::publish(const M&) const [with M = std::cxx11::basic_string]’
/home/prostrain/catkin_ws/src/qr_detector/src/qr_detector_nodelet.cpp:64:40: required from here
/opt/ros/melodic/include/ros/message_traits.h:125:14: error: ‘const class std:: cxx11::basic_string’ has no member named ‘ getMD5Sum’
return m.getMD5Sum().c_str();
::value(const M&) [with M = std::__cxx11::basic_string]’:
/opt/ros/melodic/include/ros/message_traits.h:263:104: required from ‘const char ros::message_traits::datatype(const M&) [with M = std::cxx11::basic_string]’
/opt/ros/melodic/include/ros/publisher.h:118:11: required from ‘void ros::Publisher::publish(const M&) const [with M = std::cxx11::basic_string]’
/home/prostrain/catkin_ws/src/qr_detector/src/qr_detector_nodelet.cpp:64:40: required from here
/opt/ros/melodic/include/ros/message_traits.h:142:14: error: ‘const class std:: cxx11::basic_string’ has no member named ‘getDataType’
return m.getDataType().c_str();
::value(const M&) [with M = std::cxx11::basic_string]’:
/opt/ros/melodic/include/ros/message_traits.h:254:102: required from ‘const char* ros::message_traits::md5sum(const M&) [with M = std::__cxx11::basic_string]’
/opt/ros/melodic/include/ros/publisher.h:116:38: required from ‘void ros::Publisher::publish(const M&) const [with M = std:: cxx11::basic_string]’
/home/prostrain/catkin_ws/src/qr_detector/src/qr_detector_nodelet.cpp:64:40: required from here
/opt/ros/melodic/include/ros/message_traits.h:125:14: error: ‘const class std::cxx11::basic_string’ has no member named ‘getMD5Sum’
return m.getMD5Sum().c_str();
::value(const M&) [with M = std:: cxx11::basic_string]’:
/opt/ros/melodic/include/ros/message_traits.h:263:104: required from ‘const char ros::message_traits::datatype(const M&) [with M = std::cxx11::basic_string]’
/opt/ros/melodic/include/ros/publisher.h:118:11: required from ‘void ros::Publisher::publish(const M&) const [with M = std::cxx11::basic_string]’
/home/prostrain/catkin_ws/src/qr_detector/src/qr_detector_nodelet.cpp:64:40: required from here
/opt/ros/melodic/include/ros/message_traits.h:142:14: error: ‘const class std:: cxx11::basic_string’ has no member named ‘ getDataType’
return m.__getDataType().c_str();
[qr_detector/CMakeFiles/qr_detector_nodelet.dir/src/qr_detector_nodelet.cpp.o] Error 1
CMakeFiles/Makefile2:1477: recipe for target 'qr_detector/CMakeFiles/qr_detector_nodelet.dir/all' failed
make[1]: [qr_detector/CMakeFiles/qr_detector_nodelet.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: [all] Error 2
Invoking "make -j4 -l4" failed
^~~~~ /opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char ros::message_traits::DataType^~~qr_detector/CMakeFiles/qr_detector_nodelet.dir/build.make:62: recipe for target 'qr_detector/CMakeFiles/qr_detector_nodelet.dir/src/qr_detector_nodelet.cpp.o' failed make[2]: [qr_detector/CMakeFiles/qr_detector_nodelet.dir/src/qr_detector_nodelet.cpp.o] Error 1 CMakeFiles/Makefile2:1477: recipe for target 'qr_detector/CMakeFiles/qr_detector_nodelet.dir/all' failed make[1]: [qr_detector/CMakeFiles/qr_detector_nodelet.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: [all] Error 2 Invoking "make -j4 -l4" failed [ 86%] Built target hmi_node_generate_messages In file included from /opt/ros/melodic/include/ros/serialization.h:37:0, from /opt/ros/melodic/include/ros/publisher.h:34, from /opt/ros/melodic/include/ros/node_handle.h:32, from /opt/ros/melodic/include/ros/ros.h:45, from /home/prostrain/catkin_ws/src/qr_detector/include/qr_detector/qr_detector_nodelet.h:3, from /home/prostrain/catkin_ws/src/qr_detector/src/qr_detector_nodelet.cpp:1: /opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char ros::message_traits::MD5Sum^~~~~ /opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType^~~qr_detector/CMakeFiles/qr_detector_nodelet.dir/build.make:62: recipe for target 'qr_detector/CMakeFiles/qr_detector_nodelet.dir/src/qr_detector_nodelet.cpp.o' failed make[2]:Do you have any ideas about it? I am a newbie on this ros application. Thank you in advance.