BaxterInterface/rviz_interface/src/InterfacePanel.hpp

83 lines
2.3 KiB
C++
Raw Normal View History

2018-08-08 16:13:45 +02:00
/*
* Rviz panel for the configuration of the RvizInterface.
* @author : antoine.harle@etu.upmc.Fr
* @see : RvizInterface.cpp/.hpp
*/
2018-06-26 18:27:30 +02:00
#ifndef INTERFACE_PANEL_HPP
#define INTERFACE_PANEL_HPP
//#ifndef Q_MOC_RUN
# include <ros/ros.h>
# include <rviz/panel.h>
//#endif
#include <stdio.h>
#include <QPainter>
#include <QLineEdit>
// #include <QDoubleValidator>
#include <QCheckBox>
2018-06-29 15:31:04 +02:00
#include <QPushButton>
2018-06-26 18:27:30 +02:00
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QTimer>
#include <rviz_interface/InterfaceConfig.h>
#define MAX_ERROR 999999999
class QLineEdit;
namespace rviz_interface
{
2018-08-08 16:13:45 +02:00
2018-06-26 18:27:30 +02:00
class InterfacePanel: public rviz::Panel
{
// This class uses Qt slots and is a subclass of QObject, so it needs
// the Q_OBJECT macro.
Q_OBJECT
public:
InterfacePanel( QWidget* parent = 0 );
~InterfacePanel();
2018-06-26 18:27:30 +02:00
// Now we declare overrides of rviz::Panel functions for saving and
// loading data from the config file. Here the data is the
// topic name.
2018-06-27 16:24:10 +02:00
// virtual void load( const rviz::Config& config );
// virtual void save( rviz::Config config ) const;
2018-06-26 18:27:30 +02:00
// Next come a couple of public Qt slots.
public Q_SLOTS:
// Here we declare some internal slots.
protected Q_SLOTS:
2018-08-08 16:13:45 +02:00
void updateError(); //Update the error in the current_configuration & publish the configuration.
void updateType(int state); //Update the objective type (ie Precise or not) in the current_configuration & publish the configuration.
void updateVisuals(int state); //Update the visual flag (ie Show visuals or not) in the current_configuration & publish the configuration.
void handleResetButton(); //Send a signal through the configuration telling the subscriber to follow the object it's linked to.
2018-06-26 18:27:30 +02:00
protected:
2018-08-08 16:13:45 +02:00
rviz_interface::InterfaceConfig current_config; //Current configuration which is sent at every interaction with the panel.
2018-06-26 18:27:30 +02:00
2018-08-08 16:13:45 +02:00
QLineEdit* _max_error_editor; //Line editor used to let user cusomize the maximum error allowed.
QCheckBox* _objective_type_editor; //CheckBox used to modify the objective type.
QCheckBox* _show_visuals_editor; //CheckBox used to choose if the error area should be shown.
QPushButton* _reset_button; //Button to reattach a marker to it's linked object.
2018-06-26 18:27:30 +02:00
2018-08-08 16:13:45 +02:00
//Publisher
2018-06-26 18:27:30 +02:00
ros::Publisher _config_publisher;
// The ROS node handle.
ros::NodeHandle _nh;
2018-06-26 18:27:30 +02:00
};
} // end namespace rviz_plugin_tutorials
#endif