34class LiaisonJaiabot :
public goby::zeromq::LiaisonContainerWithComms<LiaisonJaiabot, CommsThread>
38 Wt::WContainerWidget* parent = 0);
41 void post_node_status(
const goby::middleware::frontseat::protobuf::NodeStatus& node_status);
42 void post_tpv(
const goby::middleware::protobuf::gpsd::TimePositionVelocity& tpv);
50 void focus()
override { timer_.start(); }
51 void unfocus()
override { timer_.stop(); }
53 void vehicle_select(Wt::WString msg);
54 void data_select(Wt::WString msg);
55 void check_add_vehicle(
int node_id);
56 void add_data_point(
const std::string data_type,
double data_point);
57 void key_press(Wt::WKeyEvent key);
58 void key_release(Wt::WKeyEvent key);
59 Wt::WDateTime get_date_time(goby::time::MicroTime mp);
63 std::pair<double, double> range;
66 void add_data_type(std::pair<std::string, YAxisConfig>& data_type);
69 Wt::WComboBox* vehicle_combo_;
70 Wt::WComboBox* data_combo_;
71 Wt::WStackedWidget* vehicle_stack_;
72 Wt::WStackedWidget* data_stack_;
73 Wt::WGroupBox* chart_box;
76 std::map<goby::time::MicroTime, double> data_points;
77 std::string chart_type;
78 YAxisConfig y_axis_config;
81 std::vector<ChartData> chart_data_;
82 std::shared_ptr<Wt::WAbstractItemModel> chart_model_;
83 Wt::Chart::WCartesianChart* chart_ =
nullptr;
87 const std::vector<std::pair<std::string, YAxisConfig>> data_types_ = {
88 {
"Pressure", {
"Pressure (kPa)", {0, 100}}},
89 {
"Salinity", {
"Salinity (ppt)", {0, 50}}},
90 {
"Temperature", {
"Temperature (°C)", {10, 20}}},
95 VehicleData(Wt::WStackedWidget*,
const protobuf::JaiabotConfig&);
96 VehicleData(
const VehicleData&) =
delete;
97 VehicleData& operator=(
const VehicleData&) =
delete;
99 std::unique_ptr<Wt::WContainerWidget> vehicle_div;
103 Controls(Wt::WContainerWidget* vehicle_div,
const protobuf::JaiabotConfig& cfg);
125 std::cout <<
"slider moved: " << text << std::endl;
127 text->setText(timeout_text_from_value(value));
132 text->setText(dive_text_from_value(value));
139 text->setText(motor_text_from_value(value));
143 Wt::WSlider* stbd_elevator, Wt::WSlider* rudder)
145 text->setText(fins_text_from_value(value, stbd_elevator->value(), rudder->value()));
149 Wt::WSlider* port_elevator, Wt::WSlider* rudder)
151 text->setText(fins_text_from_value(port_elevator->value(), value, rudder->value()));
154 Wt::WSlider* stbd_elevator)
157 fins_text_from_value(port_elevator->value(), stbd_elevator->value(), value));
203 Controls low_level_control;
205 int index_in_stack{0};
207 static std::string timeout_text_from_value(
int value)
209 return "Timeout (X-/V+): " + std::to_string(value);
212 static std::string dive_text_from_value(
int value)
214 return "Dive (Y-/U+): " + std::to_string(value);
217 static std::string motor_text_from_value(
int value)
219 return "Motor (W-/R+): " + std::to_string(value);
221 static std::string fins_text_from_value(
int port_elevator_value,
int stbd_elevator_value,
224 return "Port Elevator (A-/Q+ or D-/E+ for both): " +
225 std::to_string(port_elevator_value) +
226 "<br/>Starboard Elevator (G-/T+ or D-/E+ for both): " +
227 std::to_string(stbd_elevator_value) +
228 "<br/>Rudder (S-/F+): " + std::to_string(rudder_value);
233 std::map<int, std::unique_ptr<VehicleData>> vehicle_data_;
236 Wt::WText* bot_node_status_text_;
237 Wt::WText* bot_tpv_text_;
238 Wt::WText* bot_pt_text_;
239 Wt::WText* bot_salinity_text_;
240 Wt::WText* bot_imu_text_;
241 Wt::WText* bot_low_control_text_;
244 int current_vehicle_{-1};
247 std::string current_data_type_{
""};
250 bool motor_go_{
false};
251 static bool dive_start_;
252 static std::chrono::system_clock::time_point dive_expire_;
256 const protobuf::JaiabotConfig& cfg_;