Commit edd95094 authored by mastefan's avatar mastefan
Browse files

Added GUI input for weight and pitch baseline. TODO: Implement callbacks.

parent 1571892b
......@@ -355,6 +355,8 @@ private:
ros::Subscriber dronexSetpointSubscriber;
ros::Subscriber dronexSetpointToGUISubscriber;
ros::Publisher droneXIntegrParamPublisher;
ros::Publisher droneXWeightParamPublisher;
ros::Publisher droneXPitchBaselineParamPublisher;
// > For the PICKER CONTROLLER
......
......@@ -118,7 +118,10 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
dronexSetpointSubscriber = nodeHandle.subscribe("DroneXControllerService/Setpoint", 1, &MainWindow::dronexSetpointCallback, this);
dronexSetpointToGUISubscriber = nodeHandle.subscribe("DroneXControllerService/SetpointToGUI", 1, &MainWindow::dronexSetpointCallback, this);
droneXIntegrParamPublisher = nodeHandle.advertise<Setpoint>("DroneXControllerService/IntegrParams", 1);
droneXWeightParamPublisher = nodeHandle.advertise<Setpoint>("DroneXControllerService/WeightParam", 1);
droneXWeightParamPublisher = nodeHandle.advertise<Setpoint>("DroneXControllerService/WeightParam", 1);
droneXPitchBaselineParamPublisher = nodeHandle.advertise<Setpoint>("DroneXControllerService/PitchBaselineParam", 1);
// SET ALL SLIDERS AND DIALS TO DEFAULT VALUES
ui->picker_z_slider->setValue( 40 );
ui->picker_mass_slider->setValue( 29 );
......@@ -1630,6 +1633,28 @@ void MainWindow::on_set_Integr_Param_button_clicked()
}
void MainWindow::on_set_weigth_param_clicked()
{
Setpoint msg;
msg.x = (ui->weight_param->text()).toFloat();
msg.y = 0;
msg.z = 0;
this->droneXWeightParamPublisher.publish(msg);
}
void MainWindow::on_set_pitch_baseline_param_clicked()
{
Setpoint msg;
msg.x = (ui->pitch_baseline_param->text()).toFloat();
msg.y = 0;
msg.z = 0;
this->droneXPitchBaselineParamPublisher.publish(msg);
}
......
......@@ -568,6 +568,40 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_63">
<property name="text">
<string>Drone weight param[g]</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="weight_param"/>
</item>
<item>
<widget class="QPushButton" name="set_weight_param">
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_64">
<property name="text">
<string>Pitch angle baseline[?]</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pitch_baseline_param"/>
</item>
<item>
<widget class="QPushButton" name="set_pitch_baseline">
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
......
......@@ -231,12 +231,23 @@ void buttonPressed_integrator_reset(){
integratorFlag = DRONEX_INTEGRATOR_RESET;
}
void integratorCallback(const Setpoint& integrParams ) {
void integratorCallback (const Setpoint& integrParams ) {
integrator_var[0] = integrParams.x;
integrator_var[1] = integrParams.y;
integrator_var[2] = integrParams.z;
}
void WeightParamCallback (const Setpoint& weightParam ) {
// TODO for changing yaml: set weight in yaml OR just set m_mass_CF_grams?
// m_mass_CF_grams = weightParam.x;
}
void PitchBaselineParamCallback(const Setpoint& pitchAngleParam ) {
// TODO
}
......@@ -1962,9 +1973,10 @@ int main(int argc, char* argv[]) {
// get Integrator params from GUI
ros::Subscriber droneXIntegrParamSubscriber = nodeHandle.subscribe("IntegrParams", 1, integratorCallback);
// get weight params from GUI
ros::Subscriber droneXWeightParamSubscriber = nodeHandle.subscribe("WeightParam", 1, WeightParamCallback);
ros::Subscriber droneXPitchBaselineParamSubscriber = nodeHandle.subscribe("PitchBaselineParam", 1, PitchBaselineParamCallback);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment