5 #ifndef ICRA_FIREFLY_ROBORTS_WAIT_FOR_ENEMY_SUPPLY_AREA_H_
6 #define ICRA_FIREFLY_ROBORTS_WAIT_FOR_ENEMY_SUPPLY_AREA_H_
8 #include "../blackboard/blackboard.h"
9 #include "../blackboard/my_robot.h"
10 #include "../behavior/robot_behaviors.h"
18 std::shared_ptr<Blackboard> p_blackboard,
26 if (this->p_my_robot1->GetRobotType() > 10) {
41 ROS_ERROR(
"The Zone is not active!");
45 auto current_behavior =
p_my_robot1->GetCurrentBehavior();
46 if (current_behavior !=
GOAL) {
50 current_behavior =
p_my_robot2->GetCurrentBehavior();
51 if (current_behavior !=
GOAL) {
66 ROS_ERROR(
"The Zone is not active!");
70 auto current_behavior =
p_my_robot1->GetCurrentBehavior();
71 if (current_behavior !=
GOAL) {
75 current_behavior =
p_my_robot2->GetCurrentBehavior();
76 if (current_behavior !=
GOAL) {
98 const std::shared_ptr<RobotBehaviors> &robotBehaviors) {
99 auto current_behavior = myRobot->GetCurrentBehavior();
100 if (current_behavior ==
ESCAPE) {
101 robotBehaviors->GetEscapeBehavior()->Cancel();
102 }
else if (current_behavior ==
SUPPLY) {
103 robotBehaviors->GetSupplyBehavior()->Cancel();
104 }
else if (current_behavior ==
GOAL) {
105 robotBehaviors->GetGoalBehavior()->Cancel();
120 std::pair<geometry_msgs::PoseStamped, geometry_msgs::PoseStamped>
122 geometry_msgs::PoseStamped zone_pose_1;
123 geometry_msgs::PoseStamped zone_pose_2;
127 zone_pose_1.pose.position.x =
128 this->p_blackboard_->GetBuffZoneStatus().at(1).second.max_x_ + 1;
129 zone_pose_1.pose.position.y =
130 this->p_blackboard_->GetBuffZoneStatus().at(1).second.zone_y_;
131 zone_pose_1.pose.orientation.z = 1;
133 zone_pose_2.pose.position.x =
134 this->p_blackboard_->GetBuffZoneStatus().at(1).second.zone_x_;
135 zone_pose_2.pose.position.y =
136 this->p_blackboard_->GetBuffZoneStatus().at(1).second.min_y_ - 1;
137 zone_pose_2.pose.orientation.z = 0.707;
138 zone_pose_2.pose.orientation.w = 0.707;
143 zone_pose_1.pose.position.x =
144 this->p_blackboard_->GetBuffZoneStatus().at(2).second.min_x_ - 1;
145 zone_pose_1.pose.position.y =
146 this->p_blackboard_->GetBuffZoneStatus().at(2).second.zone_y_;
147 zone_pose_1.pose.orientation.w = 1;
149 zone_pose_2.pose.position.x =
150 this->p_blackboard_->GetBuffZoneStatus().at(2).second.max_x_ + 1;
151 zone_pose_2.pose.position.y =
152 this->p_blackboard_->GetBuffZoneStatus().at(2).second.zone_y_;
153 zone_pose_2.pose.orientation.z = 1;
158 zone_pose_1.pose.position.x =
159 this->p_blackboard_->GetBuffZoneStatus().at(6).second.min_x_ - 1;
160 zone_pose_1.pose.position.y =
161 this->p_blackboard_->GetBuffZoneStatus().at(6).second.zone_y_;
162 zone_pose_1.pose.orientation.w = 1;
164 zone_pose_2.pose.position.x =
165 this->p_blackboard_->GetBuffZoneStatus().at(6).second.max_x_ + 1;
166 zone_pose_2.pose.position.y =
167 this->p_blackboard_->GetBuffZoneStatus().at(6).second.zone_y_;
168 zone_pose_2.pose.orientation.z = 1;
173 zone_pose_1.pose.position.x =
174 this->p_blackboard_->GetBuffZoneStatus().at(3).second.min_x_ - 1;
175 zone_pose_1.pose.position.y =
176 this->p_blackboard_->GetBuffZoneStatus().at(3).second.zone_y_;
177 zone_pose_1.pose.orientation.w = 1;
179 zone_pose_2.pose.position.x =
180 this->p_blackboard_->GetBuffZoneStatus().at(3).second.max_x_ + 1;
181 zone_pose_2.pose.position.y =
182 this->p_blackboard_->GetBuffZoneStatus().at(3).second.zone_y_;
183 zone_pose_2.pose.orientation.z = 1;
188 zone_pose_1.pose.position.x =
189 this->p_blackboard_->GetBuffZoneStatus().at(5).second.min_x_ - 1;
190 zone_pose_1.pose.position.y =
191 this->p_blackboard_->GetBuffZoneStatus().at(5).second.zone_y_;
192 zone_pose_1.pose.orientation.w = 1;
194 zone_pose_2.pose.position.x =
195 this->p_blackboard_->GetBuffZoneStatus().at(5).second.max_x_ + 1;
196 zone_pose_2.pose.position.y =
197 this->p_blackboard_->GetBuffZoneStatus().at(5).second.zone_y_;
198 zone_pose_2.pose.orientation.z = 1;
203 zone_pose_1.pose.position.x =
204 this->p_blackboard_->GetBuffZoneStatus().at(4).second.min_x_ - 1;
205 zone_pose_1.pose.position.y =
206 this->p_blackboard_->GetBuffZoneStatus().at(4).second.zone_y_;
207 zone_pose_1.pose.orientation.w = 1;
209 zone_pose_2.pose.position.x =
210 this->p_blackboard_->GetBuffZoneStatus().at(4).second.zone_x_;
211 zone_pose_2.pose.position.y =
212 this->p_blackboard_->GetBuffZoneStatus().at(4).second.max_y_ + 1;
213 zone_pose_2.pose.orientation.z = -0.707;
214 zone_pose_2.pose.orientation.w = 0.707;
219 ROS_ERROR(
"Error Zone id !");
226 return std::pair<geometry_msgs::PoseStamped, geometry_msgs::PoseStamped>(
227 zone_pose_1, zone_pose_2);
232 #endif // ICRA_FIREFLY_ROBORTS_WAIT_FOR_ENEMY_SUPPLY_AREA_H_