|
7 | 7 | #include <sensor_msgs/Joy.h> |
8 | 8 | #include <sensor_msgs/PointCloud2.h> |
9 | 9 | #include <std_msgs/Int16.h> |
| 10 | +#include <std_msgs/Bool.h> |
10 | 11 |
|
11 | 12 | #include <am_super/baby_sitter.h> |
12 | 13 | #include <am_super/super_state.h> |
@@ -68,6 +69,8 @@ class AMSuper : AMLifeCycle |
68 | 69 | ros::Publisher system_state_pub_; |
69 | 70 | ros::Publisher super_status_pub_; |
70 | 71 | ros::Publisher led_pub_; |
| 72 | + /** stops the flight plan when SHUTDOWN state */ |
| 73 | + ros::Publisher flight_plan_deactivation_pub_; |
71 | 74 | ros::Subscriber node_state_sub_; |
72 | 75 | ros::Subscriber operator_command_sub_; |
73 | 76 | ros::Subscriber controller_state_sub; |
@@ -199,6 +202,8 @@ class AMSuper : AMLifeCycle |
199 | 202 | */ |
200 | 203 | super_status_pub_ = nh_.advertise<brain_box_msgs::Super2Status>(am_super_topics::SUPER_STATUS, 1000); |
201 | 204 |
|
| 205 | + flight_plan_deactivation_pub_ = nh_.advertise<std_msgs::Bool>(am_topics::CTRL_FLIGHTPLAN_ACTIVITY_CONTROL, 1000); |
| 206 | + |
202 | 207 | supervisor_.system_state = SuperState::BOOTING; |
203 | 208 | supervisor_.flt_ctrl_state = SuperNodeMediator::SuperFltCtrlState::INIT; |
204 | 209 |
|
@@ -330,6 +335,7 @@ class AMSuper : AMLifeCycle |
330 | 335 | { |
331 | 336 | supervisor_.status_error = true; |
332 | 337 | ROS_ERROR_STREAM("Manifested node " << nr.name << " changed status to ERROR. Shutting down nodes... [JHRE]"); |
| 338 | + stopFlightPlan(); |
333 | 339 | } |
334 | 340 | } |
335 | 341 | if (nr.pid != pid) |
@@ -554,6 +560,16 @@ class AMSuper : AMLifeCycle |
554 | 560 | return success; |
555 | 561 | } |
556 | 562 |
|
| 563 | + |
| 564 | + /** Send signal to flight controller that flight is over. */ |
| 565 | + void stopFlightPlan() |
| 566 | + { |
| 567 | + std_msgs::Bool msg; |
| 568 | + msg.data = false; //false means deactivate |
| 569 | + flight_plan_deactivation_pub_.publish(msg); |
| 570 | + ROS_ERROR_STREAM("Sending flight plan kill command."); |
| 571 | + } |
| 572 | + |
557 | 573 | /** |
558 | 574 | * check for state transition based upon current state and values of member fields. |
559 | 575 | * Will call to modify the system state if transition is necessary. Will also call |
|
0 commit comments