-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrategy.h
55 lines (48 loc) · 2.63 KB
/
strategy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef STRATEGY_H
#define STRATEGY_H
#include <iostream>
#include <time.h>
#include <math.h>
#include <utility>
#include <set>
#include "ros/ros.h"
using namespace std;
typedef struct {
int x;
int y;
}point;
class strategy{
public:
void find_herd_bots(); // finds the bot to be herded in the first 20 secs
void herd_bots(int no1, int no2); // herds the bots for the first 20 secs
void ComputeDistance(double y, int BotID); // computes distance from green line
void FindBotsInsideCircle(); // finds bot inside the circle
//void FindBotsInsideView(); // finds bot inside the field of view
void FirstOperation(int centerBotID); // decides the operation to be performed on the target bot
float angle(float ang); // to make sure the angle is within the range
float distwhitel(); // calculates the least dist from the white line
void action(int bot_no); // action to be performed on the bots inside the circle
void t_plan(); // formulates the plan for the bot inside the circle
void GetEulerAngles(double* yaw, double* pitch, double* roll);
void posecallback(nav_msgs::Odometry::ConstPtr& msg);
void centercallback(nav_msgs::Odometry::ConstPtr& msg);
void quadposecallback(nav_msgs::Odometry::ConstPtr& msg);
void toQuaternion(double pitch, double roll, double yaw);
int IsOutsideWhite(); //check is the center bot is outside green line
ros::NodeHandle n;
ros::Publisher pub;
ros::Suscriber sub;
private:
int counter = 0;
typedef Pair <double, int> p;
set<p> ClosestBot; // set containing bot id and dist from green line
set<p> ClosestBot2; // bot closest to the target bot in the given field of view.
vector<int> BotsInsideCircle; // vector containing id of bots inside the circle
double centerX, centerY; // x and y coordinates of the center/target bot
double quadX, quadY; // x and y coordinates of the quad
double posX, posY; // x and y coordinates of the the other bots inside the circle
double x, y, z, w; // needed for qauternian angle to euler angle
vector <float>distance_bots;
int no1,no2;
};
#endif