Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lasergui.cpp
1 
2 /***************************************************************************
3  * lasergui.cpp - minimalistic laser visualization
4  *
5  * Created: Thu Oct 09 12:51:52 2008
6  * Copyright 2008-2011 Tim Niemueller [www.niemueller.de]
7  * 2009 Masrur Doostdar <doostdar@kbsg.rwth-aachen.de>
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #include "laser_drawing_area.h"
25 
26 #include <netcomm/fawkes/client.h>
27 #include <blackboard/remote.h>
28 #include <interfaces/Laser360Interface.h>
29 #include <interfaces/Laser720Interface.h>
30 
31 #include <interfaces/ObjectPositionInterface.h>
32 #include <interfaces/Position2DTrackInterface.h>
33 #include <interfaces/SwitchInterface.h>
34 #include <interfaces/VisualDisplay2DInterface.h>
35 
36 
37 #include <gui_utils/service_chooser_dialog.h>
38 #include <gui_utils/multi_interface_chooser_dialog.h>
39 #include <gui_utils/interface_dispatcher.h>
40 #include <gui_utils/connection_dispatcher.h>
41 #include <gui_utils/robot/allemaniacs_athome.h>
42 
43 #include <gtkmm/main.h>
44 #include <list>
45 #include <memory>
46 #include <set>
47 #include <map>
48 #include <utils/misc/string_conversions.h>
49 
50 
51 #define MAX_OBJECTPOSITIONINTERFACES_PERSONS 10
52 #define MAX_OBJECTPOSITIONINTERFACES_LEGS 15
53 #define MAX_OBJECTPOSITIONINTERFACES_MISC 20
54 #define MAX_TRACKINTERFACES 10
55 
56 using namespace fawkes;
57 
58 /** @class LaserGuiGtkWindow "lasergui.cpp"
59  * Laser GUI window for Gtkmm.
60  * @author Tim Niemueller
61  */
62 class LaserGuiGtkWindow : public Gtk::Window
63 {
64  public:
65  /** Typedef of fawkes::Interface to override Glib::Interface. */
67  /** Shorthand for pair of interface type and ID. */
69  /** Shorthand for set of pairs of interface type and ID. */
71  /** For each interface, an interface dispatcher is opened that listens for
72  * data changes. */
73  typedef std::pair<Interface*, InterfaceDispatcher*> InterfaceDispatcherPair;
74  /** A list of interfaces and their respective dispatchers.
75  * Note that this is a list and not a map from interface to dispatcher only
76  * to keep the ordering specified by the user in the GUI. */
77  typedef std::list<InterfaceDispatcherPair> InterfaceDispatcherPairList;
78 
79  /** Constructor for Gtk::Builder.
80  * @param cobject C base object
81  * @param builder Gtk Builder
82  */
83  LaserGuiGtkWindow(BaseObjectType* cobject,
84  const Glib::RefPtr<Gtk::Builder> &builder)
85  : Gtk::Window(cobject), __athome_drawer(true)
86  {
87  __laser_if_names.push_back(std::make_pair("Laser360Interface", "Laser"));
88 
89  builder->get_widget_derived("da_laser", __area);
90  builder->get_widget("tb_connection", __tb_connection);
91  builder->get_widget("tb_select", __tb_select);
92  builder->get_widget("tb_lines", __tb_lines);
93  builder->get_widget("tb_points", __tb_points);
94  builder->get_widget("tb_hull", __tb_hull);
95  builder->get_widget("tb_trimvals", __tb_trimvals);
96  builder->get_widget("tb_rotation", __tb_rotation);
97  builder->get_widget("tb_legtracker", __tb_legtracker);
98  builder->get_widget("tb_stop", __tb_stop);
99  builder->get_widget("tb_zoom_in", __tb_zoom_in);
100  builder->get_widget("tb_zoom_out", __tb_zoom_out);
101  builder->get_widget("tb_exit", __tb_exit);
102  builder->get_widget("dlg_ltopen", __dlg_ltopen);
103  builder->get_widget("pgb_ltopen", __pgb_ltopen);
104 
105  __area->set_robot_drawer(&__athome_drawer);
106 
107  __tb_select->set_sensitive(false);
108  __tb_lines->set_sensitive(false);
109  __tb_points->set_sensitive(false);
110  __tb_hull->set_sensitive(false);
111  __tb_trimvals->set_sensitive(false);
112  __tb_rotation->set_sensitive(false);
113  __tb_legtracker->set_sensitive(false);
114  __tb_stop->set_sensitive(false);
115  __tb_zoom_in->set_sensitive(false);
116  __tb_zoom_out->set_sensitive(false);
117 
118  __tb_connection->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_connection_clicked));
119  __tb_select->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_select_clicked));
120  __tb_lines->signal_toggled().connect(sigc::bind(sigc::mem_fun(*__area, &LaserDrawingArea::set_draw_mode), LaserDrawingArea::MODE_LINES));
121  __tb_points->signal_toggled().connect(sigc::bind(sigc::mem_fun(*__area, &LaserDrawingArea::set_draw_mode), LaserDrawingArea::MODE_POINTS));
122  __tb_hull->signal_toggled().connect(sigc::bind(sigc::mem_fun(*__area, &LaserDrawingArea::set_draw_mode), LaserDrawingArea::MODE_HULL));
123  __tb_zoom_in->signal_clicked().connect(sigc::mem_fun(*__area, &LaserDrawingArea::zoom_in));
124  __tb_zoom_out->signal_clicked().connect(sigc::mem_fun(*__area, &LaserDrawingArea::zoom_out));
125 
126  __tb_legtracker->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_legtracker_toggled));
127  __tb_trimvals->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_trimvals_toggled));
128  __tb_rotation->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_rotation_toggled));
129  __tb_stop->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_stop_toggled));
130  __tb_exit->signal_clicked().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_exit_clicked));
131 
132  __connection_dispatcher.signal_connected().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_connect));
133  __connection_dispatcher.signal_disconnected().connect(sigc::mem_fun(*this, &LaserGuiGtkWindow::on_disconnect));
134  }
135 
136 
137  protected:
138  /** Event handler for connection button. */
139  virtual void on_connection_clicked()
140  {
141  if ( ! __connection_dispatcher.get_client()->connected() ) {
142  ServiceChooserDialog ssd(*this, __connection_dispatcher.get_client());
143  ssd.run_and_connect();
144  } else {
145  __connection_dispatcher.get_client()->disconnect();
146  }
147 
148  }
149 
150  /** Event handler for connection button. */
151  virtual void on_select_clicked()
152  {
153  if ( ! __connection_dispatcher.get_client()->connected() ) {
154  Gtk::MessageDialog md(*this,
155  "Cannot get list of interfaces if not connected.",
156  /* markup */ false,
157  Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
158  /* modal */ true);
159  md.set_title("Interface Selection Failed");
160  md.run();
161  } else {
162  std::auto_ptr<MultiInterfaceChooserDialog> ifcd(
164  __bb,
165  "Laser*Interface",
166  "*",
167  __laser_if_names));
168  if (ifcd->run()) {
169  const TypeIdPairList interfaces = ifcd->get_selected_interfaces();
170  open_interfaces(interfaces);
171  }
172  }
173  }
174 
175  /** Open interfaces.
176  * Tries to open the interfaces.
177  * Even if it fails, the old interfaces are closed.
178  * @param types_and_ids types and ids of interfaces to open
179  */
180  void
181  open_interfaces(const TypeIdPairList& types_and_ids)
182  {
183  __area->reset_laser_ifs();
184  for (InterfaceDispatcherPairList::const_iterator it = __laser_ifs.begin();
185  it != __laser_ifs.end(); ++it) {
186  __bb->unregister_listener(it->second);
187  delete it->second;
188  __bb->close(it->first);
189  }
190  __laser_ifs.clear();
191  __laser_if_names = types_and_ids;
192 
193  // Open interfaces.
194  for (TypeIdPairList::const_iterator it = types_and_ids.begin();
195  it != types_and_ids.end(); ++it)
196  {
197  const Glib::ustring& type = it->first;
198  const Glib::ustring& id = it->second;
199  Interface* itf = NULL;
200  try {
201  if (type == "Laser720Interface") {
202  itf = __bb->open_for_reading<Laser720Interface>(id.c_str());
203  } else if (type == "Laser360Interface") {
204  itf = __bb->open_for_reading<Laser360Interface>(id.c_str());
205  } else {
206  throw Exception("Invalid interface type %s", type.c_str());
207  }
208  } catch (const Exception& e) {
209  std::string msg = std::string("Failed to open interface: ") + e.what();
210  Gtk::MessageDialog md(*this, msg, /* markup */ false,
211  Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
212  /* modal */ true);
213  md.set_title("Opening Interface Failed");
214  md.run();
215  continue;
216  }
217  InterfaceDispatcher* itfd = new InterfaceDispatcher("LaserInterfaceDispatcher", itf);
218  itfd->signal_data_changed().connect(
219  sigc::hide(sigc::mem_fun(*__area, &LaserDrawingArea::queue_draw)));
220  try {
221  __bb->register_listener(itfd, BlackBoard::BBIL_FLAG_DATA);
222  } catch (const Exception& e) {
223  std::string msg = std::string("Failed to register interface dispatcher: ") + e.what();
224  Gtk::MessageDialog md(*this, msg, /* markup */ false,
225  Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
226  /* modal */ true);
227  md.set_title("Registrating Interface Dispatcher Failed");
228  md.run();
229  delete itfd;
230  __bb->close(itf);
231  continue;
232  }
233  const InterfaceDispatcherPair p = std::make_pair(itf, itfd);
234  __laser_ifs.push_back(p);
235  }
236 
237  // Inform the drawing area.
238  std::list<Interface*> keys;
239  for (InterfaceDispatcherPairList::const_iterator it = __laser_ifs.begin();
240  it != __laser_ifs.end(); ++it)
241  {
242  keys.push_back(it->first);
243  }
244  __area->set_laser_ifs(keys);
245  }
246 
247  /** Event handler for connected event. */
248  virtual void on_connect()
249  {
250  try {
251  __bb = new RemoteBlackBoard(__connection_dispatcher.get_client());
252  __laser_ifs.clear();
253  __l_objpos_if_persons = NULL;
254  __l_objpos_if_legs = NULL;
255  __l_objpos_if_misc = NULL;
256  __l_track_if = NULL;
257  __laser_segmentation_if = NULL;
258  __switch_if = NULL;
259  __target_if = NULL;
260  __line_if = NULL;
261  __visdis_if = NULL;
262 
263  //__laser_if = __bb->open_for_reading<Laser360Interface>("LegtrackerAveragedLaser");
264 
265  __area->set_connected(true);
266  open_interfaces(__laser_if_names);
267 
268  __line_if = __bb->open_for_reading<ObjectPositionInterface>("LaserLine");
269  __area->set_line_if(__line_if);
270  try {
271  __visdis_if = __bb->open_for_writing<VisualDisplay2DInterface>("LaserGUI");
272  __area->set_visdisp_if(__visdis_if);
273  } catch (Exception &e) {
274  __visdis_if = NULL;
275  // visdisplay is optional, probably some other lasergui has it
276  // open atm
277  }
278 
279  on_legtracker_toggled();
280 
281  __area->queue_draw();
282 
283  __tb_connection->set_stock_id(Gtk::Stock::DISCONNECT);
284  __tb_select->set_sensitive(true);
285  __tb_lines->set_sensitive(true);
286  __tb_points->set_sensitive(true);
287  __tb_hull->set_sensitive(true);
288  __tb_trimvals->set_sensitive(true);
289  __tb_rotation->set_sensitive(true);
290  __tb_legtracker->set_sensitive(true);
291  __tb_stop->set_sensitive(true);
292  __tb_zoom_in->set_sensitive(true);
293  __tb_zoom_out->set_sensitive(true);
294  } catch (Exception &e) {
295  __area->reset_laser_ifs();
296  __area->set_line_if(NULL);
297  __area->set_visdisp_if(NULL);
298  __area->queue_draw();
299  __area->set_connected(false);
300  if ( __bb ) {
301  __area->reset_laser_ifs();
302  for (InterfaceDispatcherPairList::const_iterator it = __laser_ifs.begin();
303  it != __laser_ifs.end(); ++it) {
304  __bb->unregister_listener(it->second);
305  delete it->second;
306  __bb->close(it->first);
307  }
308  __bb->close(__line_if);
309  __bb->close(__visdis_if);
310  delete __bb;
311  __laser_ifs.clear();
312  __bb = NULL;
313  __line_if = NULL;
314  __visdis_if = NULL;
315  }
316  }
317  }
318 
319  /** Event handler for disconnected event. */
320  virtual void on_disconnect()
321  {
322  __area->set_connected(false);
323  __area->reset_laser_ifs();
324  __area->set_line_if(NULL);
325  __area->set_visdisp_if(NULL);
326  __area->queue_draw();
327  for (InterfaceDispatcherPairList::const_iterator it = __laser_ifs.begin();
328  it != __laser_ifs.end(); ++it) {
329  __bb->unregister_listener(it->second);
330  delete it->second;
331  __bb->close(it->first);
332  }
333  __laser_ifs.clear();
334  if(__laser_segmentation_if)
335  __bb->close(__laser_segmentation_if);
336  if(__switch_if)
337  __bb->close(__switch_if);
338  if(__target_if)
339  __bb->close(__target_if);
340  __bb->close(__line_if);
341  __bb->close(__visdis_if);
342 
343  std::list<ObjectPositionInterface*>::iterator objpos_if_itt;
344  std::list<Position2DTrackInterface*>::iterator track_if_itt;
345  if(__l_objpos_if_persons){
346  for( objpos_if_itt = __l_objpos_if_persons->begin(); objpos_if_itt != __l_objpos_if_persons->end(); objpos_if_itt++ ) {
347  __bb->close(*objpos_if_itt);
348  }
349  __l_objpos_if_persons->clear();
350  }
351  if(__l_objpos_if_legs){
352  for( objpos_if_itt = __l_objpos_if_legs->begin(); objpos_if_itt != __l_objpos_if_legs->end(); objpos_if_itt++ ) {
353  __bb->close(*objpos_if_itt);
354  }
355  __l_objpos_if_legs->clear();
356  }
357  if(__l_objpos_if_misc){
358  for( objpos_if_itt = __l_objpos_if_misc->begin(); objpos_if_itt != __l_objpos_if_misc->end(); objpos_if_itt++ ) {
359  __bb->close(*objpos_if_itt);
360  }
361  __l_objpos_if_misc->clear();
362  }
363  if(__l_track_if){
364  for( track_if_itt = __l_track_if->begin(); track_if_itt != __l_track_if->end(); track_if_itt++ ) {
365  __bb->close(*track_if_itt);
366  }
367  __l_track_if->clear();
368  }
369 
370 
371 
372  delete __bb;
373  __bb = NULL;
374  __laser_ifs.clear();
375  __l_objpos_if_persons = NULL;
376  __l_objpos_if_legs = NULL;
377  __l_objpos_if_misc = NULL;
378  __l_track_if = NULL;
379  __laser_segmentation_if = NULL;
380  __switch_if = NULL;
381  __target_if = NULL;
382  __visdis_if = NULL;
383  __line_if = NULL;
384 
385  __tb_connection->set_stock_id(Gtk::Stock::CONNECT);
386  __tb_select->set_sensitive(false);
387  __tb_lines->set_sensitive(false);
388  __tb_points->set_sensitive(false);
389  __tb_hull->set_sensitive(false);
390  __tb_trimvals->set_sensitive(false);
391  __tb_rotation->set_sensitive(false);
392  __tb_legtracker->set_sensitive(false);
393  __tb_stop->set_sensitive(false);
394  __tb_zoom_in->set_sensitive(false);
395  __tb_zoom_out->set_sensitive(false);
396  }
397 
398 
399  /** Event handler for rotation button. */
401  {
402  if ( __tb_rotation->get_active() ) {
403  __area->set_rotation(M_PI / 2);
404  } else {
405  __area->set_rotation(0);
406  }
407  }
408 
409 
410  /** Event handler for stop button */
412  {
413  __area->toggle_break_drawing();
414  }
415 
416  /** Event handler for legtracker button */
418  {
419  if (! __bb) return;
420 
421  if (!__tb_legtracker->get_active()) {
422  __bb->close(__laser_segmentation_if);
423  __bb->close(__switch_if);
424  __bb->close(__target_if);
425 
426  std::list<ObjectPositionInterface*>::iterator objpos_if_itt;
427  std::list<Position2DTrackInterface*>::iterator track_if_itt;
428  if (__l_objpos_if_persons) {
429  for( objpos_if_itt = __l_objpos_if_persons->begin(); objpos_if_itt != __l_objpos_if_persons->end(); objpos_if_itt++ ) {
430  __bb->close(*objpos_if_itt);
431  }
432  __l_objpos_if_persons->clear();
433  }
434  if (__l_objpos_if_legs) {
435  for( objpos_if_itt = __l_objpos_if_legs->begin(); objpos_if_itt != __l_objpos_if_legs->end(); objpos_if_itt++ ) {
436  __bb->close(*objpos_if_itt);
437  }
438  __l_objpos_if_legs->clear();
439  }
440  if (__l_objpos_if_misc) {
441  for( objpos_if_itt = __l_objpos_if_misc->begin(); objpos_if_itt != __l_objpos_if_misc->end(); objpos_if_itt++ ) {
442  __bb->close(*objpos_if_itt);
443  }
444  __l_objpos_if_misc->clear();
445  }
446 
447  if (__l_track_if) {
448  for( track_if_itt = __l_track_if->begin(); track_if_itt != __l_track_if->end(); track_if_itt++ ) {
449  __bb->close(*track_if_itt);
450  }
451  __l_track_if->clear();
452  }
453 
454  __laser_segmentation_if = NULL;
455  __switch_if = NULL;
456  __target_if = NULL;
457  __l_objpos_if_persons = NULL;
458  __l_objpos_if_legs = NULL;
459  __l_objpos_if_misc = NULL;
460  __l_track_if = NULL;
461 
462  __area->set_objpos_if(__l_objpos_if_persons,__l_objpos_if_legs,__l_objpos_if_misc,__laser_segmentation_if, __l_track_if, __target_if,__switch_if);
463 
464  } else {
465  unsigned int num_opens = 3
466  + MAX_OBJECTPOSITIONINTERFACES_PERSONS
467  + MAX_OBJECTPOSITIONINTERFACES_LEGS
468  + MAX_OBJECTPOSITIONINTERFACES_MISC
469  + MAX_TRACKINTERFACES;
470 
471  float step_fraction = 1.0 / num_opens;
472  unsigned int opened = 0;
473  __pgb_ltopen->set_fraction(0);
474  __dlg_ltopen->show();
475  __area->queue_draw();
476 
477  __laser_segmentation_if = __bb->open_for_reading<Laser720Interface>("SegmentsLaser");
478  __pgb_ltopen->set_fraction(++opened * step_fraction);
479  while (Gtk::Main::events_pending()) Gtk::Main::iteration();
480 
481  __target_if = __bb->open_for_reading<ObjectPositionInterface>("legtracker Target");
482 
483  ObjectPositionInterface* new_objpos_if;
484  __l_objpos_if_persons = new std::list<ObjectPositionInterface*>();
485  __l_objpos_if_legs = new std::list<ObjectPositionInterface*>();
486  __l_objpos_if_misc = new std::list<ObjectPositionInterface*>();
487  __l_track_if = new std::list<Position2DTrackInterface*>();
488  for (int i=1; i <= MAX_OBJECTPOSITIONINTERFACES_PERSONS; ++i){
489  new_objpos_if= __bb->open_for_reading<ObjectPositionInterface>((std::string("legtracker CurrentLegsTracked") + StringConversions::to_string(i)).c_str());
490  __l_objpos_if_persons->push_back(new_objpos_if);
491  __pgb_ltopen->set_fraction(++opened * step_fraction);
492  while (Gtk::Main::events_pending()) Gtk::Main::iteration();
493  }
494  for (int i=1; i <= MAX_OBJECTPOSITIONINTERFACES_LEGS; ++i){
495  new_objpos_if= __bb->open_for_reading<ObjectPositionInterface>((std::string("legtracker Leg") + StringConversions::to_string(i)).c_str());
496  __l_objpos_if_legs->push_back(new_objpos_if);
497  __pgb_ltopen->set_fraction(++opened * step_fraction);
498  while (Gtk::Main::events_pending()) Gtk::Main::iteration();
499  }
500  for (int i=1; i <= MAX_OBJECTPOSITIONINTERFACES_MISC; ++i){
501  new_objpos_if= __bb->open_for_reading<ObjectPositionInterface>((std::string("legtracker Misc") + StringConversions::to_string(i)).c_str());
502  __l_objpos_if_misc->push_back(new_objpos_if);
503  __pgb_ltopen->set_fraction(++opened * step_fraction);
504  while (Gtk::Main::events_pending()) Gtk::Main::iteration();
505  }
506  Position2DTrackInterface* new_track_if;
507  for (int i=1; i <= MAX_TRACKINTERFACES; ++i){
508  new_track_if = __bb->open_for_reading<Position2DTrackInterface>((std::string("legtracker Track") + StringConversions::to_string(i)).c_str());
509  __l_track_if->push_back( new_track_if );
510  __pgb_ltopen->set_fraction(++opened * step_fraction);
511  while (Gtk::Main::events_pending()) Gtk::Main::iteration();
512  }
513 
514  __switch_if = __bb->open_for_reading<SwitchInterface>("legtracker write!");
515  __pgb_ltopen->set_fraction(++opened * step_fraction);
516  while (Gtk::Main::events_pending()) Gtk::Main::iteration();
517  __dlg_ltopen->hide();
518  __area->set_objpos_if(__l_objpos_if_persons, __l_objpos_if_legs,
519  __l_objpos_if_misc,__laser_segmentation_if,
520  __l_track_if, __target_if,__switch_if);
521  __area->queue_draw();
522  }
523  }
524 
525 
526  /** Event handler for trim button. */
528  {
529  if ( __tb_trimvals->get_active() ) {
530  __area->set_resolution(3);
531  } else {
532  __area->set_resolution(1);
533  }
534  }
535 
536  /** Event handler for exit button. */
538  {
539  Gtk::Main::quit();
540  }
541 
542  private:
543  BlackBoard *__bb;
544  InterfaceDispatcherPairList __laser_ifs;
545  Laser720Interface *__laser_segmentation_if;
546  SwitchInterface *__switch_if;
547  ObjectPositionInterface *__target_if;
548 
549  std::list<ObjectPositionInterface*>* __l_objpos_if_persons;
550  std::list<ObjectPositionInterface*>* __l_objpos_if_legs;
551  std::list<ObjectPositionInterface*>* __l_objpos_if_misc;
552  std::list<Position2DTrackInterface*>* __l_track_if;
553 
554  ObjectPositionInterface *__line_if;
555  VisualDisplay2DInterface *__visdis_if;
556 
557  LaserDrawingArea *__area;
558  AllemaniACsAtHomeCairoRobotDrawer __athome_drawer;
559  ConnectionDispatcher __connection_dispatcher;
560 
561  Gtk::ToolButton *__tb_connection;
562  Gtk::RadioToolButton *__tb_lines;
563  Gtk::RadioToolButton *__tb_points;
564  Gtk::RadioToolButton *__tb_hull;
565  Gtk::ToggleToolButton *__tb_trimvals;
566  Gtk::ToggleToolButton *__tb_rotation;
567  Gtk::ToggleToolButton *__tb_legtracker;
568  Gtk::ToggleToolButton *__tb_stop;
569  Gtk::ToolButton *__tb_zoom_in;
570  Gtk::ToolButton *__tb_zoom_out;
571  Gtk::ToolButton *__tb_exit;
572  Gtk::ToolButton *__tb_select;
573 
574  Gtk::Dialog *__dlg_ltopen;
575  Gtk::ProgressBar *__pgb_ltopen;
576 
577  TypeIdPairList __laser_if_names;
578 };
579 
580 int
581 main(int argc, char** argv)
582 {
583  Gtk::Main kit(argc, argv);
584 
585  Glib::RefPtr<Gtk::Builder> builder;
586  builder = Gtk::Builder::create_from_file(RESDIR"/guis/lasergui/lasergui.ui");
587 
588  LaserGuiGtkWindow *window = NULL;
589  builder->get_widget_derived("wnd_lasergui", window);
590 
591  Gtk::Main::run(*window);
592 
593  return 0;
594 }
Laser360Interface Fawkes BlackBoard Interface.
consider data events
Definition: blackboard.h:83
virtual void on_select_clicked()
Event handler for connection button.
Definition: lasergui.cpp:151
Only draw beam end points.
Laser drawing area.
ObjectPositionInterface Fawkes BlackBoard Interface.
std::list< TypeIdPair > TypeIdPairList
List of type and ID of an interface.
virtual void on_disconnect()
Event handler for disconnected event.
Definition: lasergui.cpp:320
void open_interfaces(const TypeIdPairList &types_and_ids)
Open interfaces.
Definition: lasergui.cpp:181
void on_legtracker_toggled()
Event handler for legtracker button.
Definition: lasergui.cpp:417
virtual void on_connection_clicked()
Event handler for connection button.
Definition: lasergui.cpp:139
void zoom_in()
Zoom in.
MultiInterfaceChooserDialog::TypeIdPair TypeIdPair
Shorthand for pair of interface type and ID.
Definition: lasergui.cpp:68
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Laser GUI window for Gtkmm.
Definition: lasergui.cpp:62
void on_stop_toggled()
Event handler for stop button.
Definition: lasergui.cpp:411
void set_draw_mode(draw_mode_t mode)
Set the drawing mode.
SwitchInterface Fawkes BlackBoard Interface.
virtual const char * what() const
Get primary string.
Definition: exception.cpp:661
Base class for exceptions in Fawkes.
Definition: exception.h:36
void run_and_connect()
Run dialog and try to connect.
std::pair< Glib::ustring, Glib::ustring > TypeIdPair
Pair of type and IDs of interfaces.
std::list< InterfaceDispatcherPair > InterfaceDispatcherPairList
A list of interfaces and their respective dispatchers.
Definition: lasergui.cpp:77
void on_trimvals_toggled()
Event handler for trim button.
Definition: lasergui.cpp:527
virtual void on_connect()
Event handler for connected event.
Definition: lasergui.cpp:248
fawkes::Interface Interface
Typedef of fawkes::Interface to override Glib::Interface.
Definition: lasergui.cpp:66
void zoom_out()
Zoom out.
TypeIdPairList get_selected_interfaces() const
Get selected interface types and their respective IDs.
Remote BlackBoard.
Definition: remote.h:49
LaserGuiGtkWindow(BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &builder)
Constructor for Gtk::Builder.
Definition: lasergui.cpp:83
static MultiInterfaceChooserDialog * create(Gtk::Window &parent, BlackBoard *blackboard, const char *type_pattern, const char *id_pattern, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title=DEFAULT_TITLE)
Factory method.
The BlackBoard abstract class.
Definition: blackboard.h:49
std::pair< Interface *, InterfaceDispatcher * > InterfaceDispatcherPair
For each interface, an interface dispatcher is opened that listens for data changes.
Definition: lasergui.cpp:73
MultiInterfaceChooserDialog::TypeIdPairList TypeIdPairList
Shorthand for set of pairs of interface type and ID.
Definition: lasergui.cpp:70
Watches network client events and dispatches them as signals.
void on_rotation_toggled()
Event handler for rotation button.
Definition: lasergui.cpp:400
VisualDisplay2DInterface Fawkes BlackBoard Interface.
Draw AllemaniACs AtHome robot.
static std::string to_string(unsigned int i)
Convert unsigned int value to a string.
Interface listener with dispatcher.
Laser720Interface Fawkes BlackBoard Interface.
void on_exit_clicked()
Event handler for exit button.
Definition: lasergui.cpp:537
Position2DTrackInterface Fawkes BlackBoard Interface.
sigc::signal< void, Interface * > signal_data_changed()
Get &quot;data changed&quot; signal.