perception.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Fetch Robotics Inc.
3  * Author: Michael Ferguson, Sriramvarun Nidamarthy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef FETCH_AUTO_DOCK_PERCEPTION_H
20 #define FETCH_AUTO_DOCK_PERCEPTION_H
21 
22 #include <dock_candidate.h>
23 #include <laser_processor.h>
24 #include <linear_pose_filter_2d.h>
25 
26 #include <string>
27 #include <boost/thread.hpp>
28 
29 #include <ros/ros.h>
30 #include <geometry_msgs/PoseStamped.h>
31 #include <sensor_msgs/LaserScan.h>
32 #include <tf/transform_listener.h>
33 
34 #include <vector>
35 #include <deque>
36 
37 
39 {
40 public:
41  explicit DockPerception(ros::NodeHandle& nh);
42 
47  bool start(const geometry_msgs::PoseStamped& pose);
48 
50  bool stop();
51 
53  bool getPose(geometry_msgs::PoseStamped& pose, std::string frame = "");
54 
55 private:
57  void callback(const sensor_msgs::LaserScanConstPtr& scan);
58 
65 
72  double fit(const DockCandidatePtr& candidate, geometry_msgs::Pose& pose);
73 
79  static bool isValid(const tf::Quaternion& q);
80 
83 
84  bool running_; // Should we be trying to find the dock
85  bool debug_; // Should we output debugging info
86 
88 
89  // TF frame to track dock within
90  std::string tracking_frame_;
91  // Best estimate of where the dock is
92  geometry_msgs::PoseStamped dock_;
93  // Mutex on dock_
94  boost::mutex dock_mutex_;
95  // If true, then dock_ is based on actual sensor data
97  // Last time that dock pose was updated
99  // Maximum allowable error between scan and "ideal" scan
101 
102  // Publish visualization of which points are detected as dock
104 
105  // The ideal cloud, located at origin of dock frame
106  std::vector<geometry_msgs::Point> ideal_cloud_;
107  // The ideal cloud (when only front is visible)
108  std::vector<geometry_msgs::Point> front_cloud_;
109 };
110 
111 #endif // FETCH_AUTO_DOCK_PERCEPTION_H
DockPerception(ros::NodeHandle &nh)
Definition: perception.cpp:40
DockCandidatePtr extract(laser_processor::SampleSet *cluster)
Extract a DockCandidate from a cluster, filling in the lengths and slopes of each line found using ra...
Definition: perception.cpp:369
geometry_msgs::PoseStamped dock_
Definition: perception.h:92
bool getPose(geometry_msgs::PoseStamped &pose, std::string frame="")
Get the pose of the dock.
Definition: perception.cpp:120
ros::Publisher debug_points_
Definition: perception.h:103
boost::mutex dock_mutex_
Definition: perception.h:94
std::vector< geometry_msgs::Point > ideal_cloud_
Definition: perception.h:106
std::vector< geometry_msgs::Point > front_cloud_
Definition: perception.h:108
double max_alignment_error_
Definition: perception.h:100
An ordered set of Samples.
pose
ros::Subscriber scan_sub_
Definition: perception.h:81
std::string tracking_frame_
Low pass filter object for filtering dock poses.
Definition: perception.h:90
void callback(const sensor_msgs::LaserScanConstPtr &scan)
Callback to process laser scans.
Definition: perception.cpp:174
bool found_dock_
Definition: perception.h:96
static bool isValid(const tf::Quaternion &q)
Method to check if the quaternion is valid.
Definition: perception.cpp:553
bool start(const geometry_msgs::PoseStamped &pose)
Start dock detection.
Definition: perception.cpp:105
double fit(const DockCandidatePtr &candidate, geometry_msgs::Pose &pose)
Try to fit a dock to candidate.
Definition: perception.cpp:417
LinearPoseFilter2DPtr dock_pose_filter_
Definition: perception.h:87
bool stop()
Stop tracking the dock.
Definition: perception.cpp:114
ros::Time dock_stamp_
Definition: perception.h:98
tf::TransformListener listener_
Definition: perception.h:82


caster_app
Author(s): Ye Tian
autogenerated on Wed Dec 18 2019 03:34:44