tracker.hh
Go to the documentation of this file.
1 #ifndef VISP_TRACKER_TRACKER_HH
2 # define VISP_TRACKER_TRACKER_HH
3 # include <boost/filesystem/path.hpp>
4 # include <boost/thread/recursive_mutex.hpp>
5 
6 # include <dynamic_reconfigure/server.h>
7 
9 
11 
12 # include <geometry_msgs/TwistStamped.h>
13 
14 # include <sensor_msgs/Image.h>
15 # include <sensor_msgs/CameraInfo.h>
16 
18 # include <tf/transform_listener.h>
19 
20 # include <visp_tracker/Init.h>
21 # include <visp_tracker/ModelBasedSettingsConfig.h>
22 # include <visp_tracker/ModelBasedSettingsKltConfig.h>
23 # include <visp_tracker/ModelBasedSettingsEdgeConfig.h>
24 # include <visp_tracker/MovingEdgeSites.h>
25 # include <visp_tracker/KltPoints.h>
26 
27 # include <visp3/core/vpCameraParameters.h>
28 # include <visp3/core/vpHomogeneousMatrix.h>
29 # include <visp3/core/vpImage.h>
30 # include <visp3/mbt/vpMbGenericTracker.h>
31 # include <visp3/me/vpMe.h>
32 
33 # include <string>
34 
35 namespace visp_tracker
36 {
37  class Tracker
38  {
39  public:
40  typedef vpImage<unsigned char> image_t;
41 
42  typedef boost::function<bool (visp_tracker::Init::Request&,
43  visp_tracker::Init::Response& res)>
45 
46  template<class ConfigType>
48  typedef dynamic_reconfigure::Server<ConfigType> reconfigureSrv_t;
49  };
50 
51  enum State
52  {
56  };
57 
58 
60  ros::NodeHandle& privateNh,
61  volatile bool& exiting,
62  unsigned queueSize = 5u);
63 
64  ~Tracker();
65 
66  void spin();
67  protected:
68  bool initCallback(visp_tracker::Init::Request& req,
69  visp_tracker::Init::Response& res);
70 
71  void updateMovingEdgeSites(visp_tracker::MovingEdgeSitesPtr sites);
72  void updateKltPoints(visp_tracker::KltPointsPtr klt);
73 
74  void checkInputs();
75  void waitForImage();
76 
78  (const geometry_msgs::TransformStampedConstPtr&);
79  private:
80  bool exiting ()
81  {
82  return exiting_ || !ros::ok();
83  }
84 
85  void spinOnce ()
86  {
87  //callbackQueue_.callAvailable(ros::WallDuration(0));
88  ros::spinOnce ();
89  }
90 
91  volatile bool& exiting_;
92 
93  unsigned queueSize_;
94 
98 
100  std::string trackerType_;
101 
102  image_t image_;
103 
104  std::string cameraPrefix_;
105  std::string rectifiedImageTopic_;
106  std::string cameraInfoTopic_;
107 
108  boost::filesystem::path modelPath_;
109 
111 
112  boost::recursive_mutex mutex_;
113 
117 
123 
125  std_msgs::Header header_;
126  sensor_msgs::CameraInfoConstPtr info_;
127 
128  vpKltOpencv kltTracker_;
130  vpCameraParameters cameraParameters_;
131  vpMbGenericTracker tracker_;
132 
134 
137 
138  vpHomogeneousMatrix cMo_;
139 
141  std::string worldFrameId_;
143 
145  std::string childFrameId_;
146 
148  geometry_msgs::TransformStamped objectPositionHint_;
149  };
150 } // end of namespace visp_tracker.
151 
152 #endif
std::string rectifiedImageTopic_
Definition: tracker.hh:105
tf::TransformBroadcaster tfBroadcaster_
Definition: tracker.hh:120
reconfigureSrvStruct< visp_tracker::ModelBasedSettingsEdgeConfig >::reconfigureSrv_t * reconfigureEdgeSrv_
Definition: tracker.hh:116
void updateKltPoints(visp_tracker::KltPointsPtr klt)
void objectPositionHintCallback(const geometry_msgs::TransformStampedConstPtr &)
image_proc::AdvertisementChecker checkInputs_
Helper used to check that subscribed topics exist.
Definition: tracker.hh:136
std_msgs::Header header_
Definition: tracker.hh:125
std::string cameraInfoTopic_
Definition: tracker.hh:106
std::string worldFrameId_
Definition: tracker.hh:141
ros::Publisher resultPublisher_
Definition: tracker.hh:118
vpMbGenericTracker tracker_
Definition: tracker.hh:131
ros::Publisher movingEdgeSitesPublisher_
Definition: tracker.hh:121
std::string childFrameId_
Definition: tracker.hh:145
vpKltOpencv kltTracker_
Definition: tracker.hh:128
Tracker(ros::NodeHandle &nh, ros::NodeHandle &privateNh, volatile bool &exiting, unsigned queueSize=5u)
boost::recursive_mutex mutex_
Definition: tracker.hh:112
image_transport::ImageTransport imageTransport_
Definition: tracker.hh:97
ros::Subscriber objectPositionHintSubscriber_
Definition: tracker.hh:147
boost::filesystem::path modelPath_
Definition: tracker.hh:108
ros::NodeHandle & nodeHandle_
Definition: tracker.hh:95
bool initCallback(visp_tracker::Init::Request &req, visp_tracker::Init::Response &res)
reconfigureSrvStruct< visp_tracker::ModelBasedSettingsKltConfig >::reconfigureSrv_t * reconfigureKltSrv_
Definition: tracker.hh:115
unsigned queueSize_
Definition: tracker.hh:93
geometry_msgs::TransformStamped objectPositionHint_
Definition: tracker.hh:148
std::string cameraPrefix_
Definition: tracker.hh:104
ROSCPP_DECL bool ok()
image_transport::CameraSubscriber cameraSubscriber_
Definition: tracker.hh:110
tf::TransformListener listener_
Definition: tracker.hh:140
sensor_msgs::CameraInfoConstPtr info_
Definition: tracker.hh:126
unsigned lastTrackedImage_
Definition: tracker.hh:133
void updateMovingEdgeSites(visp_tracker::MovingEdgeSitesPtr sites)
reconfigureSrvStruct< visp_tracker::ModelBasedSettingsConfig >::reconfigureSrv_t * reconfigureSrv_
Definition: tracker.hh:114
tf::TransformBroadcaster transformBroadcaster_
Definition: tracker.hh:144
boost::function< bool(visp_tracker::Init::Request &, visp_tracker::Init::Response &res)> initCallback_t
Definition: tracker.hh:44
ros::ServiceServer initService_
Definition: tracker.hh:124
dynamic_reconfigure::Server< ConfigType > reconfigureSrv_t
Definition: tracker.hh:48
vpCameraParameters cameraParameters_
Definition: tracker.hh:130
volatile bool & exiting_
Definition: tracker.hh:91
ROSCPP_DECL void spinOnce()
ros::NodeHandle & nodeHandlePrivate_
Definition: tracker.hh:96
vpImage< unsigned char > image_t
Definition: tracker.hh:40
std::string trackerType_
Definition: tracker.hh:100
ros::Publisher kltPointsPublisher_
Definition: tracker.hh:122
vpHomogeneousMatrix cMo_
Definition: tracker.hh:138
ros::Publisher transformationPublisher_
Definition: tracker.hh:119


visp_tracker
Author(s): Thomas Moulard
autogenerated on Sat Mar 13 2021 03:20:06