lib/uav_simple_tracking.cpp
Go to the documentation of this file.
2 
3 uav_simple_tracking::uav_simple_tracking(cpswarm_msgs::TargetPositionEvent target, double altitude) : target(target), pos(altitude)
4 {
5 }
6 
7 behavior_state_t uav_simple_tracking::step (cpswarm_msgs::TargetPositionEvent target)
8 {
9  // update target information
10  this->target = target;
11 
12  // check if target pose has been received
13  if (target.header.stamp > Time(0)) {
14  // target left the area
15  if (pos.out_of_bounds(target.pose.pose)) {
16  return STATE_SUCCEEDED;
17  }
18 
19  // target is still inside area
20  else {
21  // move to target position
22  if (pos.move(target.pose.pose) == false)
23  return STATE_ABORTED;
24  }
25  }
26  else {
27  ROS_WARN_ONCE("No pose received for target %d, holding position!", target.id);
28  }
29 
30  // return state to action server
31  return STATE_ACTIVE;
32 }
33 
35 {
36  pos.stop();
37 }
bool move(geometry_msgs::Pose pose)
cpswarm_msgs::TargetPositionEvent target
The target being tracked by this UAV.
position pos
A helper object for position related tasks.
behavior_state_t step(cpswarm_msgs::TargetPositionEvent target)
Execute one cycle of the tracking algorithm.
#define ROS_WARN_ONCE(...)
cpswarm_msgs::TargetPositionEvent target
The target being tracked.
bool out_of_bounds(geometry_msgs::Pose pose)
void stop()
uav_simple_tracking(cpswarm_msgs::TargetPositionEvent target, double altitude)
Constructor that initializes the private member variables.
behavior_state_t
An enumeration for the state of the behavior algorithm.


uav_simple_tracking
Author(s): Micha Sende
autogenerated on Sat Feb 6 2021 03:11:44