20 #include <QMessageBox> 37 "Which qt_ctrl controller do you want\n" 38 "to start, and in which ROS environment?"),
39 ROS_workspace( tr(
"ROS workspace") ), ctrl_id(-1),
40 save_file( tr(default_save_name) ), time_step(tm_stp),
41 motion_model(motion), controller(NULL), ctrl_wdgt(NULL) {
43 QWidget *ROS_line =
new QWidget();
44 QHBoxLayout *ROS_layout =
new QHBoxLayout(ROS_line);
50 *ROS_connect =
new QGroupBox(tr(
"Connection to ROS"), ROS_line),
51 *ctrl_line =
new QGroupBox(tr(
"Controller Selection"),
this),
52 *output_line =
new QGroupBox(tr(
"Output File"),
this);
59 = { {
"ROS &already started",
"&Start ROS with Gazebo"},
60 {
"&Empty workspace",
"&Default workspace"} },
62 = { {
'A',
'S'}, {
'E',
'D'} };
64 ROS_layout->addWidget(ROS_widget[index]);
66 =
new QBoxLayout(QBoxLayout::LeftToRight, ROS_widget[index]);
72 connect( &
select_ROS[index][idx2], SIGNAL( clicked() ),
81 QHBoxLayout *ctrl_layout =
new QHBoxLayout(ctrl_line);
82 static const int ctrl_nb = 7;
83 static const char *ctrl_names[ctrl_nb]
84 = {
"Keyboard Operating Controller",
"File Operating Controller",
85 "PID Reaching Controller",
"Analytic Reaching Controller",
86 "Copy Tracking Controller",
"PID Tracking Controller",
87 "(Analytic Tracking Controller - not yet working)" };
90 for(index = 0; index < ctrl_nb; index++)
104 QHBoxLayout *output_layout =
new QHBoxLayout(output_line);
105 output_layout->addWidget(
new QLabel( tr(
"Robot's motion" 108 connect( &
save_file, SIGNAL( clicked() ),
116 const bool tracking = new_id > 3;
119 iSeeML::rob::OrPtConfig q;
120 static const int nb_coef = 6;
121 static const double h_coef = 1 / 0.35;
123 double coef[nb_coef] =
124 { h_coef * h_coef, h_coef, 0,
125 time_coef * time_coef, time_coef, 0 };
127 bool valid_change = (new_id == 0);
129 if ( (new_id == 1) || tracking ) {
130 const QString input_type = QString( tr(
"%1 File") )
131 .arg(new_id == 1 ?
"Accelerations" :
"Trajectory");
132 input_file = QFileDialog::getOpenFileName
133 (
this, input_type,
"", tr(
"CSV File (*.csv *.txt)") );
134 valid_change = (! input_file.isNull() )
135 && (! input_file.isEmpty() );
137 if ( (new_id > 1) && (new_id < 4) )
139 (
this,
"State to reach",
140 "Enter the goal for the controller to reach", goal);
141 if (tracking && valid_change)
143 "Set the initial error", q);
145 if ( ( (new_id == 2) || (new_id == 5) ) && valid_change ) {
146 static const char* name_coef[nb_coef]
147 = {
"Prop_trans",
"Integ_trans",
"Deriv_trans",
148 "Prop_rot",
"Integ_rot",
"Deriv_rot" };
149 static const bool coef_Greek[nb_coef]
150 = {
false,
false,
false,
false,
false,
false};
152 (
this,
"PID Parameters Setting",
"Enter the PID parameters:",
153 2, nb_coef / 2, name_coef, coef_Greek, coef);
159 ctrl_param.setText( tr(
"Controller #%1's parameters")
166 const std::string file_sname = input_file.toStdString();
168 const char *file_name = file_sname.c_str();
170 if ( (*file_name !=
'\0') && (*file_name !=
'/') )
171 QMessageBox::warning(
this, tr(
"Abnormal Input File Name"),
172 tr(
"Input file name '%1' seems invalid")
193 connect( new_ctrl, SIGNAL( pathChanged() ),
194 ctrl_gui, SLOT( updateTrajectory() ) );
220 (
this, tr(
"Please select a save file"),
221 "", tr(
"CSV File (*.csv *.txt)") );
226 save_file.setText( file_info.baseName() );
Qt based GUI for qt_ctrl package.
Oriented point reaching controller class using a smooth path generator.
PIDCtrl uses a PID to compute the trajectory's velocities.
QString save_file_name
The save file name.
This class defines a sub-class of dialog windows which lower part is a horizontal button panel with o...
KbdCtrl allows to control the robot with the keyboard.
static const char * default_save_name
The name displayed when no save file is selected.
File controller (teleoperation) class.
TrackingCtrl aims at following a trajectory with the robot.
QPushButton save_file
The button displaying and changing save file.
QComboBox ctrl_select
The pop-up menu with the list of possible controllers.
int ctrl_id
The identification number of the selected controller.
This class is a Qt widget which allows to show the controller's behaviour (current and aimed velociti...
Path following controller class, using a PID.
static bool getDoubleArray(QWidget *parent, const char *title, const char *msg, const int nb_lines, const int nb_col, const char *nameVal[], const bool isGreek[], double val[])
Asks in a dialog for a set of doubles, and returns it.
const double time_step
The controller's time step.
void updateFileName()
Updates the button displaying the save file.
void insertWidget(QWidget &widget)
Inserts the given widget (containing the inputs) in the dialog, between message and buttons...
void newTrajectory(const std::list< State * > &trajectory)
Adds a trajectory to the motion display.
QRadioButton select_ROS[ROS_choices][ROS_choices]
The radio buttons to select ROS environment.
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
ControlWidget * ctrl_wdgt
The widget showing the controller's velocities.
SmoothPathCtrl aims at reaching an oriented point with the robot, using a smooth path generator...
Qt based teleoperation widget for qt_ctrl.
const MotionModel & motion_model
The motion model of the controlled robot.
Qt dialog window to select the control used by the qt_ctrl GUI.
This class defines a motion model, with the motion limits.
FileCtrl allows to control the robot from a file.
QGroupBox ROS_workspace
The ROS workspace group box (may be desabled).
void updateCtrl()
Updates the parameters of the current controller.
PID controller reaching an oriented point.
ImitateCtrl copies the trajectory's velocities.
Path following controller class, copying the velocities.
This class is the Qt main window of qt_ctrl package.
QPushButton ctrl_param
The button to set the controller's parameters.
PIDreachCtrl aims at reaching an oriented point with the robot, using a PID controller.
const std::list< State * > & trajectory() const
Gives the tracked trajectory.
QtCtrlSelect(QWidget *parent, const double tm_stp, const MotionModel &motion)
The dialog is build with a given parent and a time step for the future controller.
static bool getOrPtConfig(QWidget *parent, const char *title, const char *msg, iSeeML::rob::OrPtConfig &q)
Asks in a dialog for an oriented point.
Path following controller class, with an analytic approach.
AnalyticCtrl compute the trajectory's velocities using analytic geometry and mecanic.
void updateROSline()
Enables or disables the ROS workspace group box.
static const int ROS_choices
The number of ROS environments and sub-environments.
int index
The index of additional widgets.
static bool getState(QWidget *parent, const char *title, const char *msg, State &state)
Asks in a dialog for a state.
Controller * controller
The controller created by this dialog.