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);
64 std::pair<double, double> range;
67 void add_data_type(std::pair<std::string, YAxisConfig>& data_type);
70 Wt::WComboBox* vehicle_combo_;
71 Wt::WComboBox* data_combo_;
72 Wt::WStackedWidget* vehicle_stack_;
73 Wt::WStackedWidget* data_stack_;
74 Wt::WGroupBox* chart_box;
78 std::map<goby::time::MicroTime, double> data_points;
79 std::string chart_type;
80 YAxisConfig y_axis_config;
83 std::vector<ChartData> chart_data_;
84 std::shared_ptr<Wt::WAbstractItemModel> chart_model_;
85 Wt::Chart::WCartesianChart* chart_ =
nullptr;
89 const std::vector<std::pair<std::string, YAxisConfig>> data_types_ = {
90 {
"Pressure", {
"Pressure (kPa)", {0, 100}}},
91 {
"Salinity", {
"Salinity (ppt)", {0, 50}}},
92 {
"Temperature", {
"Temperature (°C)", {10, 20}}},
97 VehicleData(Wt::WStackedWidget*,
const protobuf::JaiabotConfig&);
98 VehicleData(
const VehicleData&) =
delete;
99 VehicleData& operator=(
const VehicleData&) =
delete;
101 std::unique_ptr<Wt::WContainerWidget> vehicle_div;
105 Controls(Wt::WContainerWidget* vehicle_div,
const protobuf::JaiabotConfig& cfg);
127 std::cout <<
"slider moved: " << text << std::endl;
129 text->setText(timeout_text_from_value(value));
134 text->setText(dive_text_from_value(value));
141 text->setText(motor_text_from_value(value));
145 Wt::WSlider* stbd_elevator, Wt::WSlider* rudder)
147 text->setText(fins_text_from_value(value, stbd_elevator->value(), rudder->value()));
151 Wt::WSlider* port_elevator, Wt::WSlider* rudder)
153 text->setText(fins_text_from_value(port_elevator->value(), value, rudder->value()));
156 Wt::WSlider* stbd_elevator)
159 fins_text_from_value(port_elevator->value(), stbd_elevator->value(), value));
205 Controls low_level_control;
207 int index_in_stack{0};
209 static std::string timeout_text_from_value(
int value)
211 return "Timeout (X-/V+): " + std::to_string(value);
214 static std::string dive_text_from_value(
int value)
216 return "Dive (Y-/U+): " + std::to_string(value);
219 static std::string motor_text_from_value(
int value)
221 return "Motor (W-/R+): " + std::to_string(value);
223 static std::string fins_text_from_value(
int port_elevator_value,
int stbd_elevator_value,
226 return "Port Elevator (A-/Q+ or D-/E+ for both): " +
227 std::to_string(port_elevator_value) +
228 "<br/>Starboard Elevator (G-/T+ or D-/E+ for both): " +
229 std::to_string(stbd_elevator_value) +
230 "<br/>Rudder (S-/F+): " + std::to_string(rudder_value);
235 std::map<int, std::unique_ptr<VehicleData>> vehicle_data_;
238 Wt::WText* bot_node_status_text_;
239 Wt::WText* bot_tpv_text_;
240 Wt::WText* bot_pt_text_;
241 Wt::WText* bot_salinity_text_;
242 Wt::WText* bot_imu_text_;
243 Wt::WText* bot_low_control_text_;
246 int current_vehicle_{-1};
249 std::string current_data_type_{
""};
251 bool motor_go_{
false};
252 static bool dive_start_;
253 static std::chrono::system_clock::time_point dive_expire_;
257 const protobuf::JaiabotConfig& cfg_;