Skip to content

Commit 35728d3

Browse files
author
Aaron Roller
authored
Merge pull request #155 from AutoModality/AM-799/deactivate
syntax bool import AM-799/deactivate
2 parents 8851676 + 0ea05d9 commit 35728d3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/am_super/am_super.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <sensor_msgs/Joy.h>
88
#include <sensor_msgs/PointCloud2.h>
99
#include <std_msgs/Int16.h>
10+
#include <std_msgs/Bool.h>
1011

1112
#include <am_super/baby_sitter.h>
1213
#include <am_super/super_state.h>
@@ -68,6 +69,8 @@ class AMSuper : AMLifeCycle
6869
ros::Publisher system_state_pub_;
6970
ros::Publisher super_status_pub_;
7071
ros::Publisher led_pub_;
72+
/** stops the flight plan when SHUTDOWN state */
73+
ros::Publisher flight_plan_deactivation_pub_;
7174
ros::Subscriber node_state_sub_;
7275
ros::Subscriber operator_command_sub_;
7376
ros::Subscriber controller_state_sub;
@@ -199,6 +202,8 @@ class AMSuper : AMLifeCycle
199202
*/
200203
super_status_pub_ = nh_.advertise<brain_box_msgs::Super2Status>(am_super_topics::SUPER_STATUS, 1000);
201204

205+
flight_plan_deactivation_pub_ = nh_.advertise<std_msgs::Bool>(am_topics::CTRL_FLIGHTPLAN_ACTIVITY_CONTROL, 1000);
206+
202207
supervisor_.system_state = SuperState::BOOTING;
203208
supervisor_.flt_ctrl_state = SuperNodeMediator::SuperFltCtrlState::INIT;
204209

@@ -330,6 +335,7 @@ class AMSuper : AMLifeCycle
330335
{
331336
supervisor_.status_error = true;
332337
ROS_ERROR_STREAM("Manifested node " << nr.name << " changed status to ERROR. Shutting down nodes... [JHRE]");
338+
stopFlightPlan();
333339
}
334340
}
335341
if (nr.pid != pid)
@@ -554,6 +560,16 @@ class AMSuper : AMLifeCycle
554560
return success;
555561
}
556562

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+
557573
/**
558574
* check for state transition based upon current state and values of member fields.
559575
* Will call to modify the system state if transition is necessary. Will also call

0 commit comments

Comments
 (0)