target.h
Go to the documentation of this file.
1 #ifndef TARGET_H
2 #define TARGET_H
3 
4 #include <ros/ros.h>
5 #include <geometry_msgs/Pose.h>
6 #include <cpswarm_msgs/TargetPositionEvent.h>
7 
8 using namespace std;
9 using namespace ros;
10 
14 typedef enum {
15  TARGET_UNKNOWN = 0, // unknown target
16  TARGET_KNOWN, // target found by another CPS
17  TARGET_TRACKED, // target found by this CPS
18  TARGET_ASSIGNED, // target assigned to any CPS
19  TARGET_LOST, // target lost by any CPS
20  TARGET_DONE // target completed by any CPS
22 
26 class target
27 {
28 public:
32  target ();
33 
37  target (const target& t);
38 
44  target (unsigned int id, target_state_t state);
45 
52  target (unsigned int id, target_state_t state, geometry_msgs::Pose pose);
53 
61  target (unsigned int id, target_state_t state, geometry_msgs::Pose pose, Time stamp);
62 
66  ~target ();
67 
72  geometry_msgs::Pose get_pose ();
73 
77  void lost ();
78 
83  void operator= (const target& t);
84 
91  void update (target_state_t state, geometry_msgs::Pose pose, Time stamp);
92 
93 private:
97  NodeHandle nh;
98 
102  int id;
103 
108 
112  geometry_msgs::Pose pose;
113 
117  geometry_msgs::Pose last_pose;
118 
122  Time stamp;
123 
127  Duration timeout;
128 
132  Rate* rate;
133 
138 
142  Publisher target_found_pub;
143 
147  Publisher target_update_pub;
148 
152  Publisher target_lost_pub;
153 
157  Publisher target_done_pub;
158 };
159 
160 #endif // TARGET_H
int id
The ID of this target. Negative IDs are invalid.
Definition: target.h:102
Time stamp
Time stamp of latest update of the target.
Definition: target.h:122
Publisher target_update_pub
Publisher for transmitting updated information about targets to other CPSs.
Definition: target.h:147
double target_tolerance
Minimum distance between two consecutive target positions such that a target update event is publishe...
Definition: target.h:137
Duration timeout
The time in seconds after which a target transitions into the state TARGET_LOST when no target update...
Definition: target.h:127
Publisher target_lost_pub
Publisher for transmitting information about lost targets to other CPSs.
Definition: target.h:152
Publisher target_done_pub
Publisher for transmitting information about completed targets to other CPSs.
Definition: target.h:157
target_state_t state
State of the target.
Definition: target.h:107
geometry_msgs::Pose last_pose
The position of the target the last time it was published as target position event.
Definition: target.h:117
geometry_msgs::Pose pose
Position of the target.
Definition: target.h:112
A target that is monitored by the CPSs.
Definition: target.h:26
Rate * rate
The loop rate object for running the behavior control loops at a specific frequency.
Definition: target.h:132
target_state_t
An enumeration for the state of a target.
Definition: target.h:14
NodeHandle nh
A node handle for the main ROS node.
Definition: target.h:97
geometry_msgs::Pose pose
Current position of the CPS.
Publisher target_found_pub
Publisher for transmitting information about found targets to other CPSs.
Definition: target.h:142


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