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