stdr_robot_creator_connector.h
Go to the documentation of this file.
1 /******************************************************************************
2  STDR Simulator - Simple Two DImensional Robot Simulator
3  Copyright (C) 2013 STDR Simulator
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 3 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 
16  Authors :
17  * Manos Tsardoulias, etsardou@gmail.com
18  * Aris Thallas, aris.thallas@gmail.com
19  * Chris Zalidis, zalidis@gmail.com
20 ******************************************************************************/
21 
22 #ifndef STDR_ROBOT_CREATOR_CONNECTOR
23 #define STDR_ROBOT_CREATOR_CONNECTOR
24 
26 
31 namespace stdr_gui
32 {
38  public QObject
39  {
40  Q_OBJECT
41  //------------------------------------------------------------------------//
42  private:
44  int argc_;
46  char** argv_;
47 
49  float climax_;
50 
53 
55  stdr_msgs::RobotMsg new_robot_msg_;
56 
58  unsigned int laser_hightlight_id_;
60  unsigned int sonar_hightlight_id_;
67 
69  QTreeWidgetItem* current_laser_;
71  QTreeWidgetItem* current_sonar_;
73  QTreeWidgetItem* current_rfid_;
74  QTreeWidgetItem* current_co2_sensor_;
75  QTreeWidgetItem* current_thermal_sensor_;
76  QTreeWidgetItem* current_sound_sensor_;
78  QTreeWidgetItem* current_footprint_point_;
79 
85  void showMessage(QString msg);
86 
87  //------------------------------------------------------------------------//
88  public:
89 
91  static int laser_number;
93  static int sonar_number;
95  static int rfid_number;
96  static int co2_sensors_number;
99 
106  CRobotCreatorConnector(int argc, char **argv);
107 
113 
118  void initialise(void);
119 
125  void deleteTreeNode(QTreeWidgetItem *item);
126 
131  void editRobot(void);
132 
137  void addLaser(void);
138 
144  void addLaser(stdr_msgs::LaserSensorMsg lmsg);
145 
151  void eraseLaser(QTreeWidgetItem *item);
152 
158  void editLaser(QTreeWidgetItem *item);
159 
165  int searchLaser(QString frameId);
166 
172  void saveLaser(QTreeWidgetItem *item);
173 
179  void loadLaser(QTreeWidgetItem *item);
180 
187  void updateLaserTree(QTreeWidgetItem *item,stdr_msgs::LaserSensorMsg l);
188 
193  void addFootprintPoint(void);
194 
199  void addFootprintPoint(geometry_msgs::Point pt);
200 
205  void eraseFootprintPoint(QTreeWidgetItem *item);
206 
211  void addSonar(void);
212 
218  void addSonar(stdr_msgs::SonarSensorMsg smsg);
219 
225  void eraseSonar(QTreeWidgetItem *item);
226 
232  void editSonar(QTreeWidgetItem *item);
233 
239  int searchSonar(QString frameId);
240 
246  void saveSonar(QTreeWidgetItem *item);
247 
253  void saveRfidAntenna(QTreeWidgetItem *item);
254  void saveCO2Sensor(QTreeWidgetItem *item);
255  void saveThermalSensor(QTreeWidgetItem *item);
256  void saveSoundSensor(QTreeWidgetItem *item);
257 
263  void loadSonar(QTreeWidgetItem *item);
264 
270  void loadRfidAntenna(QTreeWidgetItem *item);
271  void loadCO2Sensor(QTreeWidgetItem *item);
272  void loadThermalSensor(QTreeWidgetItem *item);
273  void loadSoundSensor(QTreeWidgetItem *item);
274 
281  void updateSonarTree(QTreeWidgetItem *item,stdr_msgs::SonarSensorMsg l);
282 
289  void updateRfidTree(QTreeWidgetItem *item,stdr_msgs::RfidSensorMsg l);
290  void updateCO2SensorTree(QTreeWidgetItem *item,stdr_msgs::CO2SensorMsg l);
291  void updateThermalSensorTree(QTreeWidgetItem *item,stdr_msgs::ThermalSensorMsg l);
292  void updateSoundSensorTree(QTreeWidgetItem *item,stdr_msgs::SoundSensorMsg l);
293 
298  void addRfidAntenna(void);
299  void addCO2Sensor(void);
300  void addThermalSensor(void);
301  void addSoundSensor(void);
302 
308  void addRfidAntenna(stdr_msgs::RfidSensorMsg rmsg);
309  void addCO2Sensor(stdr_msgs::CO2SensorMsg rmsg);
310  void addThermalSensor(stdr_msgs::ThermalSensorMsg rmsg);
311  void addSoundSensor(stdr_msgs::SoundSensorMsg rmsg);
312 
318  void eraseRfid(QTreeWidgetItem *item);
319  void eraseCO2Sensor(QTreeWidgetItem *item);
320  void eraseThermalSensor(QTreeWidgetItem *item);
321  void eraseSoundSensor(QTreeWidgetItem *item);
322 
328  void editRfid(QTreeWidgetItem *item);
329  void editCO2Sensor(QTreeWidgetItem *item);
330  void editThermalSensor(QTreeWidgetItem *item);
331  void editSoundSensor(QTreeWidgetItem *item);
332 
338  void editFootprintPoint(QTreeWidgetItem *item);
339 
345  int searchRfid(QString frameId);
346  int searchCO2Sensor(QString frameId);
347  int searchThermalSensor(QString frameId);
348  int searchSoundSensor(QString frameId);
349 
354  void drawRobot(void);
355 
360  void drawLasers(void);
361 
366  void drawSonars(void);
367 
372  void drawRfidAntennas(void);
373  void drawCO2Sensors(void);
374  void drawThermalSensors(void);
375  void drawSoundSensors(void);
376 
381  void updateRobotPreview(void);
382 
387  void updateRobotTree(void);
388 
395  void setInitialPose(float x, float y);
396 
401  stdr_msgs::RobotMsg getNewRobot(void);
402 
408  void setNewRobot(stdr_msgs::RobotMsg msg);
409 
410  //------------------------------------------------------------------------//
411  public Q_SLOTS:
412 
419  void treeItemClicked ( QTreeWidgetItem * item, int column );
420 
425  void updateLaser(void);
426 
431  void updateSonar(void);
432 
437  void updateLaserOpen(void);
438 
443  void updateSonarOpen(void);
444 
449  void updateRfidAntenna(void);
450  void updateCO2Sensor(void);
451  void updateThermalSensor(void);
452  void updateSoundSensor(void);
453  void updateKinematicModel(void);
454 
459  void updateRfidAntennaOpen(void);
460  void updateCO2SensorOpen(void);
461  void updateThermalSensorOpen(void);
462  void updateSoundSensorOpen(void);
463 
468  void updateRobot(void);
469 
474  void updateRobotOpen(void);
475 
480  void updateFootprintPoint(void);
481 
486  void updateFootprintPointOpen(void);
487 
492  void saveRobot(void);
493 
498  void getRobotFromYaml(void);
499 
504  void loadRobot(void);
505 
506  //------------------------------------------------------------------------//
507  Q_SIGNALS:
508 
514  void loadRobotPressed(stdr_msgs::RobotMsg newRobotMsg);
515 
522  void saveRobotPressed(stdr_msgs::RobotMsg newRobotMsg,QString file_name);
523  };
524 }
525 
526 #endif
void updateRfidAntenna(void)
Called when the update button of the properties widget is clicked.
void updateLaserTree(QTreeWidgetItem *item, stdr_msgs::LaserSensorMsg l)
Updates a tree item with a specific laser sensor.
void eraseCO2Sensor(QTreeWidgetItem *item)
Erases a specific co2 sensor based on a tree item.
void eraseRfid(QTreeWidgetItem *item)
Erases a specific rfid antenna sensor based on a tree item.
QTreeWidgetItem * current_laser_
Tree item of the currently clicked sonar.
void saveRfidAntenna(QTreeWidgetItem *item)
Saves a specific rfid reader sensor in a file.
QTreeWidgetItem * current_sonar_
Tree item of the currently clicked rfid.
void showMessage(QString msg)
Pops up a message box with a specific message.
int argc_
< Number of input arguments
int searchRfid(QString frameId)
Returns the ID of an rfid antenna sensor.
void saveThermalSensor(QTreeWidgetItem *item)
Saves a specific thermal sensor in a file.
void drawCO2Sensors(void)
Draws the robot&#39;s rfid antennas.
void drawLasers(void)
Draws the robot&#39;s lasers.
void loadLaser(QTreeWidgetItem *item)
Loads a specific laser sensor from a file.
void updateSoundSensorTree(QTreeWidgetItem *item, stdr_msgs::SoundSensorMsg l)
Updates a tree item with a specific sound sensor.
CRobotCreatorLoader loader_
Container of the new robot message.
void initialise(void)
Initializes the robot creator.
void addFootprintPoint(void)
Adds a footprint point in the new robot.
int searchSoundSensor(QString frameId)
Returns the ID of a sound sensor.
void addSoundSensor(void)
Adds a sound sensor in the new robot.
void drawThermalSensors(void)
Draws the robot&#39;s rfid antennas.
void loadSoundSensor(QTreeWidgetItem *item)
Loads a specific sound sensor from a file.
void updateLaserOpen(void)
Called when the refresh button of the properties widget is clicked.
Implements the low level functionalities of the robot creator. Inherits form QWidget and Ui_RobotCrea...
void saveSonar(QTreeWidgetItem *item)
Saves a specific sonar sensor in a file.
void updateThermalSensorTree(QTreeWidgetItem *item, stdr_msgs::ThermalSensorMsg l)
Updates a tree item with a specific thermal sensor.
void updateThermalSensor(void)
Called when the update button of the properties widget is clicked.
void eraseSoundSensor(QTreeWidgetItem *item)
Erases a specific sound sensor based on a tree item.
void loadRobotPressed(stdr_msgs::RobotMsg newRobotMsg)
Emitted when the "load robot in map" button is pressed.
void updateRobotTree(void)
Updates the robot&#39;s tree widget.
void addLaser(void)
Adds a laser sensor in the new robot.
void updateSonar(void)
Called when the update button of the properties widget is clicked.
void addSonar(void)
Adds a sonar sensor in the new robot.
unsigned int sound_sensor_hightlight_id_
Tree item of the currently clicked laser.
void updateKinematicModel(void)
Called when the update button of the kinematic model widget is clicked.
void saveSoundSensor(QTreeWidgetItem *item)
Saves a specific sound sensor in a file.
void getRobotFromYaml(void)
Called when the load robot button.
void saveRobot(void)
Called when the save robot button is clicked.
void editThermalSensor(QTreeWidgetItem *item)
Edits a specific thermal sensor based on a tree item. \ Initiates the thermal sensor editor widget...
void updateSoundSensor(void)
Called when the update button of the properties widget is clicked.
void updateFootprintPoint(void)
Called when the update button of the footprint widget is clicked.
void updateRfidTree(QTreeWidgetItem *item, stdr_msgs::RfidSensorMsg l)
Updates a tree item with a specific rfid reader sensor.
void updateRobot(void)
Called when the update button of the properties widget is clicked.
void editCO2Sensor(QTreeWidgetItem *item)
Edits a specific co2 sensor based on a tree item. \ Initiates the co2 sensor editor widget...
void deleteTreeNode(QTreeWidgetItem *item)
Deletes a specific tree item and it&#39;s children recursively.
void updateSonarTree(QTreeWidgetItem *item, stdr_msgs::SonarSensorMsg l)
Updates a tree item with a specific sonar sensor.
QTreeWidgetItem * current_sound_sensor_
Tree item of the currently clicked footprint point.
void editSonar(QTreeWidgetItem *item)
Edits a specific sonar sensor based on a tree item. Initiates the sonar sensor editor widget...
void updateRobotPreview(void)
Updates the robot&#39;s preview.
void editFootprintPoint(QTreeWidgetItem *item)
Edits a specific footprint point based on a tree item. Initiates the footprint editor widget...
stdr_msgs::RobotMsg getNewRobot(void)
Returns the created robot.
int searchLaser(QString frameId)
Returns the ID of a laser sensor.
void updateSoundSensorOpen(void)
Called when the refresh button of the properties widget is clicked.
void loadRobot(void)
Called when the load robot in map button is clicked.
void updateLaser(void)
Called when the update button of the properties widget is clicked.
void updateFootprintPointOpen(void)
Called when the refresh button of the properties widget is clicked.
void addThermalSensor(void)
Adds a thermal sensor in the new robot.
float climax_
Object of CRobotCreatorLoader.
void saveLaser(QTreeWidgetItem *item)
Saves a specific laser sensor in a file.
int searchCO2Sensor(QString frameId)
Returns the ID of an co2 sensor.
void saveCO2Sensor(QTreeWidgetItem *item)
Saves a specific co2 sensor in a file.
char ** argv_
Variable that holds the proportion coefficient for the visualization of robot creator image...
int searchSonar(QString frameId)
Returns the ID of a sonar sensor.
unsigned int sonar_hightlight_id_
Current rfid antenna for highlight.
void loadRfidAntenna(QTreeWidgetItem *item)
Loads a specific rfid reader sensor from a file.
int searchThermalSensor(QString frameId)
Returns the ID of a thermal sensor.
static int laser_number
< Number of laser sensors
The main namespace for STDR GUI.
void loadSonar(QTreeWidgetItem *item)
Loads a specific sonar sensor from a file.
void treeItemClicked(QTreeWidgetItem *item, int column)
Called when a tree item is clicked.
stdr_msgs::RobotMsg new_robot_msg_
Current laser for highlight.
void drawSonars(void)
Draws the robot&#39;s sonars.
CRobotCreatorConnector(int argc, char **argv)
Default contructor.
void setNewRobot(stdr_msgs::RobotMsg msg)
Sets the created robot.
void addRfidAntenna(void)
Adds an rfid antenna sensor in the new robot.
void updateCO2SensorOpen(void)
Called when the refresh button of the properties widget is clicked.
void drawRfidAntennas(void)
Draws the robot&#39;s rfid antennas.
void setInitialPose(float x, float y)
Sets the robot&#39;s initial pose.
void editLaser(QTreeWidgetItem *item)
Edits a specific laser sensor based on a tree item. Initiates the laser sensor editor widget...
void eraseLaser(QTreeWidgetItem *item)
Erases a specific laser sensor based on a tree item.
void updateCO2Sensor(void)
Called when the update button of the properties widget is clicked.
Implements the high level functionalities of the robot creator widget. Inherits form QObject...
void updateThermalSensorOpen(void)
Called when the refresh button of the properties widget is clicked.
void drawSoundSensors(void)
Draws the robot&#39;s rfid antennas.
void editRfid(QTreeWidgetItem *item)
Edits a specific rfid antenna sensor based on a tree item. Initiates the rfid antenna sensor editor w...
void addCO2Sensor(void)
Adds a co2 sensor in the new robot.
static int sonar_number
Number of rfid antenna sensors.
void updateRfidAntennaOpen(void)
Called when the update button of the properties widget is clicked.
void editSoundSensor(QTreeWidgetItem *item)
Edits a specific sound sensor based on a tree item. \ Initiates the sound sensor editor widget...
void eraseThermalSensor(QTreeWidgetItem *item)
Erases a specific thermal sensor based on a tree item.
void editRobot(void)
Shows the edit robot widget.
void eraseFootprintPoint(QTreeWidgetItem *item)
Erases a footprint point in the new robot.
unsigned int rfid_antenna_hightlight_id_
Current rfid antenna for highlight.
void eraseSonar(QTreeWidgetItem *item)
Erases a specific sonar sensor based on a tree item.
void loadThermalSensor(QTreeWidgetItem *item)
Loads a specific thermal sensor from a file.
unsigned int laser_hightlight_id_
Current sonar for highlight.
void updateRobotOpen(void)
Called when the refresh button of the properties widget is clicked.
void saveRobotPressed(stdr_msgs::RobotMsg newRobotMsg, QString file_name)
Emitted to save the robot in a yaml file.
void updateCO2SensorTree(QTreeWidgetItem *item, stdr_msgs::CO2SensorMsg l)
Updates a tree item with a specific co2 sensor.
void updateSonarOpen(void)
Called when the refresh button of the properties widget is clicked.
void loadCO2Sensor(QTreeWidgetItem *item)
Loads a specific co2 sensor from a file.


stdr_gui
Author(s): Manos Tsardoulias
autogenerated on Mon Jun 10 2019 15:15:17