targets.h
Go to the documentation of this file.
1 #ifndef TARGETS_H
2 #define TARGETS_H
3 
4 #include <unordered_map>
5 #include <tf2/utils.h>
6 #include <geometry_msgs/Pose.h>
7 #include <geometry_msgs/Transform.h>
8 #include <swarmros/String.h>
9 #include <cpswarm_msgs/TargetTracking.h>
10 #include "target.h"
11 
15 class targets
16 {
17 public:
21  targets ();
22 
27  void publish (unsigned int id);
28 
32  void simulate ();
33 
38  void update (geometry_msgs::Pose pose);
39 
46  void update (cpswarm_msgs::TargetPositionEvent msg, target_state_t state);
47 
48 private:
55  geometry_msgs::Transform transform (geometry_msgs::Pose p1, geometry_msgs::Pose p2) const;
56 
61  void uuid_callback (const swarmros::String::ConstPtr& msg);
62 
66  NodeHandle nh;
67 
71  Publisher tracking_pub;
72 
76  unordered_map<unsigned int, shared_ptr<target>> target_map;
77 
81  unordered_map<unsigned int, shared_ptr<target>> simulated_targets;
82 
86  string cps;
87 
91  double fov;
92 };
93 
94 #endif // TARGETS_H
targets()
Constructor that initializes the private member variables.
Definition: targets.cpp:3
unordered_map< unsigned int, shared_ptr< target > > target_map
A map holding ID and target object of all known targets.
Definition: targets.h:76
double fov
Range of the target tracking camera in meter. It is used to simulate target detection. Targets within this distance are detected by the CPS.
Definition: targets.h:91
void uuid_callback(const swarmros::String::ConstPtr &msg)
Callback function to receive the UUID from the communication library.
Definition: targets.cpp:133
void publish(unsigned int id)
Publish a target position event for the given target.
geometry_msgs::Transform transform(geometry_msgs::Pose p1, geometry_msgs::Pose p2) const
Compute the transformation between two poses.
Definition: targets.cpp:103
unordered_map< unsigned int, shared_ptr< target > > simulated_targets
A map holding ID and target object of simulated targets, including the ones not yet found...
Definition: targets.h:81
void simulate()
Read simulated targets from parameter file.
Definition: targets.cpp:34
string cps
The UUID of the CPS that owns this class instance.
Definition: targets.h:86
void update(geometry_msgs::Pose pose)
Update the state of all targets. If no update has been received for a target within a fixed period...
Definition: targets.cpp:57
NodeHandle nh
A node handle for the main ROS node.
Definition: targets.h:66
A collection of target objects that are searched, tracked, and rescued by the CPSs.
Definition: targets.h:15
Publisher tracking_pub
Publisher for transmitting target tracking information.
Definition: targets.h:71
target_state_t
An enumeration for the state of a target.
Definition: target.h:14
geometry_msgs::Pose pose
Current position of the CPS.


target_monitor
Author(s): Micha Sende
autogenerated on Thu Oct 31 2019 15:47:40