RAPP Platform  v0.6.0
RAPP Platform is a collection of ROS nodes and back-end processes that aim to deliver ready-to-use generic services to robots
 All Classes Namespaces Files Functions Variables Macros
qr_detection.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 Copyright 2015 RAPP
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 
16 ******************************************************************************/
17 
19 
24 {
25  if(!nh_.getParam("/rapp_qr_detection_detect_qrs_topic", qrDetectionTopic_))
26  {
27  ROS_ERROR("Qr detection topic param does not exist");
28  }
29  // Creating the service server concerning the face detection functionality
30  qrDetectionService_ = nh_.advertiseService(qrDetectionTopic_,
32 }
33 
41  rapp_platform_ros_communications::QrDetectionRosSrv::Request& req,
42  rapp_platform_ros_communications::QrDetectionRosSrv::Response& res)
43 {
44  std::vector<QrCode> qrs;
45  qrs = qr_detector_.findQrs(req.imageFilename);
46 
47  for(unsigned int i = 0 ; i < qrs.size() ; i++)
48  {
49  geometry_msgs::PointStamped qr_center;
50 
51  qr_center.point.x = qrs[i].center.x;
52  qr_center.point.y = qrs[i].center.y;
53 
54  res.qr_messages.push_back(qrs[i].message);
55  res.qr_centers.push_back(qr_center);
56  }
57 
58  return true;
59 }
std::string qrDetectionTopic_
Definition: qr_detection.h:59
ros::ServiceServer qrDetectionService_
Definition: qr_detection.h:56
QrDetector qr_detector_
Definition: qr_detection.h:62
ros::NodeHandle nh_
Definition: qr_detection.h:53
QrDetection(void)
Default constructor.
bool qrDetectionCallback(rapp_platform_ros_communications::QrDetectionRosSrv::Request &req, rapp_platform_ros_communications::QrDetectionRosSrv::Response &res)
The qr detection ROS service callback.
std::vector< QrCode > findQrs(std::string file_name)
Detects QRs in an image file.