24 LogicStateMachineT &logic_state_machine)
26 system_status_pub_(nh.advertise<std_msgs::String>(
"system_status", 1)),
27 robot_system_(robot_system), logic_state_machine_(logic_state_machine) {
42 std::string current_state_name =
pstate(logic_state_machine_);
43 std::string no_transition_event_name =
44 logic_state_machine_.get_no_transition_event_index().name();
45 std::type_index last_transition_event_index =
46 logic_state_machine_.lastProcessedEventIndex();
48 division_writer.
addHeader(
"Robot System Status");
49 division_writer.
addText(robot_system_status);
51 division_writer.
addHeader(
"UAV Controller Status", 4);
54 division_writer.
addHeader(
"Arm Controller Status", 4);
58 logic_state_machine_table.
beginRow();
59 logic_state_machine_table.
addHeader(
"Logic State Machine Status",
61 logic_state_machine_table.
beginRow();
62 logic_state_machine_table.
addCell(
"Current state: ");
63 logic_state_machine_table.
addCell(current_state_name);
64 logic_state_machine_table.
beginRow();
65 logic_state_machine_table.
addCell(
"Last Event without transition: ");
66 logic_state_machine_table.
addCell(no_transition_event_name);
67 logic_state_machine_table.
beginRow();
68 logic_state_machine_table.
addCell(
"Last Event: ");
69 if (last_transition_event_index ==
typeid(be::Abort)) {
70 logic_state_machine_table.
addCell(last_transition_event_index.name(),
"",
72 }
else if (last_transition_event_index ==
typeid(
Completed)) {
73 logic_state_machine_table.
addCell(last_transition_event_index.name(),
"",
76 logic_state_machine_table.
addCell(last_transition_event_index.name());
80 std_msgs::String status;
82 system_status_pub_.publish(status);
87 ros::Publisher system_status_pub_;
90 const LogicStateMachineT
91 &logic_state_machine_;
Responsible for publishing system status message.
Definition: system_status_publisher.h:14
virtual std::string getSystemStatus() const =0
Provide the current state of robot system.
static constexpr const char * green
Green color hex code.
Definition: html_utils.h:18
std::string getTableString()
Get the html table in string format.
Definition: html_utils.h:170
void addText(std::string text)
Add text to the division.
Definition: html_utils.h:71
Completed Event for transition from for example Landing to Landed etc.
Definition: completed_event.h:6
Add a division to html.
Definition: html_utils.h:44
Status of the controller.
Definition: controller_status.h:10
SystemStatusPublisher(ros::NodeHandle &nh, const BaseRobotSystem &robot_system, LogicStateMachineT &logic_state_machine)
Constructor.
Definition: system_status_publisher.h:22
void publishSystemStatus()
Publish system status and state machine status.
Definition: system_status_publisher.h:35
Provides functions to switch between active controllers and get goals.
Definition: base_robot_system.h:16
static constexpr const char * blue
Blue color hex code.
Definition: html_utils.h:22
void addCell(const DataT &data, std::string header="", std::string bg_color=Colors::white, int colspan=1)
Add a cell to the table. Should be called after beginning a row. Otherwise will throw an exception...
Definition: html_utils.h:116
void addHeader(std::string header, int level=1)
Add a header inside division.
Definition: html_utils.h:60
const char * pstate(PickPlaceStateMachine const &p)
Get current state name.
Definition: pick_place_state_machine.h:211
void beginRow()
Begin a new row in the table.
Definition: html_utils.h:135
std::string getDivisionText()
Create a divsion html in string format.
Definition: html_utils.h:80
void addHeader(std::string header, std::string text_color=Colors::black, int colspan=1)
Add a table header. Should be called after beginning a row.
Definition: html_utils.h:152
Helper class to write html tables to text format.
Definition: html_utils.h:91
ControllerStatus getActiveControllerStatus(HardwareType hardware_type) const
Get the status of the active controller.
Definition: base_robot_system.h:110
static constexpr const char * red
Red color hex code.
Definition: html_utils.h:14
std::string getHtmlStatusString()
Get a Html text describing the controller status.
Definition: controller_status.cpp:12