Commit 116c0f5c authored by pixhawk's avatar pixhawk

fixed some waypoint initialization problems (action and frame were not updated...

fixed some waypoint initialization problems (action and frame were not updated correctly in the waypoint list when read from the waypointplanner
parent 5d25e982
...@@ -33,8 +33,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -33,8 +33,7 @@ This file is part of the QGROUNDCONTROL project
#include "Waypoint.h" #include "Waypoint.h"
#include <QStringList> #include <QStringList>
Waypoint::Waypoint(quint16 _id, float _x, float _y, float _z, float _yaw, bool _autocontinue, bool _current, float _orbit, int _holdTime, Waypoint::Waypoint(quint16 _id, float _x, float _y, float _z, float _yaw, bool _autocontinue, bool _current, float _orbit, int _holdTime, MAV_FRAME _frame, MAV_ACTION _action)
MAV_FRAME _frame, MAV_ACTION _action)
: id(_id), : id(_id),
x(_x), x(_x),
y(_y), y(_y),
......
...@@ -131,7 +131,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ ...@@ -131,7 +131,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
if(wp->seq == current_wp_id) if(wp->seq == current_wp_id)
{ {
Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2); qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->yaw << wp->autocontinue << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_ACTION) wp->action;
Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2, (MAV_FRAME) wp->frame, (MAV_ACTION) wp->action);
addWaypoint(lwp); addWaypoint(lwp);
//get next waypoint //get next waypoint
......
...@@ -203,8 +203,6 @@ void WaypointList::add() ...@@ -203,8 +203,6 @@ void WaypointList::add()
Waypoint *wp = new Waypoint(0, uas->getLongitude(), uas->getLatitude(), uas->getAltitude(), Waypoint *wp = new Waypoint(0, uas->getLongitude(), uas->getLatitude(), uas->getAltitude(),
0.0, true, true, 0.15, 2000); 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().addWaypoint(wp); uas->getWaypointManager().addWaypoint(wp);
} }
} }
} }
......
...@@ -60,13 +60,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -60,13 +60,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL); m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL);
m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL); m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL);
// defaults
changedAction(0);
changedFrame(wp->getFrame());
// Read values and set user interface // Read values and set user interface
updateValues(); updateValues();
// defaults
//changedAction(wp->getAction());
//changedFrame(wp->getFrame());
connect(m_ui->posNSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double))); connect(m_ui->posNSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double)));
connect(m_ui->posESpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double))); connect(m_ui->posESpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double)));
connect(m_ui->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double))); connect(m_ui->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));
...@@ -133,7 +133,7 @@ void WaypointView::changedAction(int index) ...@@ -133,7 +133,7 @@ void WaypointView::changedAction(int index)
m_ui->holdTimeSpinBox->hide(); m_ui->holdTimeSpinBox->hide();
// set waypoint action // set waypoint action
MAV_ACTION action = (MAV_ACTION)m_ui->comboBox_action->itemData(index).toUInt(); MAV_ACTION action = (MAV_ACTION) m_ui->comboBox_action->itemData(index).toUInt();
wp->setAction(action); wp->setAction(action);
// expose ui based on action // expose ui based on action
...@@ -206,7 +206,8 @@ void WaypointView::updateValues() ...@@ -206,7 +206,8 @@ void WaypointView::updateValues()
{ {
// update frame // update frame
MAV_FRAME frame = wp->getFrame(); MAV_FRAME frame = wp->getFrame();
changedFrame(m_ui->comboBox_frame->findData(frame)); int frame_index = m_ui->comboBox_frame->findData(frame);
m_ui->comboBox_frame->setCurrentIndex(frame_index);
switch(frame) switch(frame)
{ {
case(MAV_FRAME_LOCAL): case(MAV_FRAME_LOCAL):
...@@ -220,11 +221,12 @@ void WaypointView::updateValues() ...@@ -220,11 +221,12 @@ void WaypointView::updateValues()
m_ui->altSpinBox->setValue(wp->getZ()); m_ui->altSpinBox->setValue(wp->getZ());
break; break;
} }
changedFrame(frame_index);
// update action // update action
MAV_ACTION action = wp->getAction(); MAV_ACTION action = wp->getAction();
changedFrame(m_ui->comboBox_frame->findData(frame)); int action_index = m_ui->comboBox_action->findData(action);
changedAction(m_ui->comboBox_action->findData(action)); m_ui->comboBox_action->setCurrentIndex(action_index);
switch(action) switch(action)
{ {
case MAV_ACTION_TAKEOFF: case MAV_ACTION_TAKEOFF:
...@@ -238,6 +240,7 @@ void WaypointView::updateValues() ...@@ -238,6 +240,7 @@ void WaypointView::updateValues()
default: default:
std::cerr << "unknown action" << std::endl; std::cerr << "unknown action" << std::endl;
} }
changedAction(action_index);
m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.); m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.);
m_ui->selectedBox->setChecked(wp->getCurrent()); m_ui->selectedBox->setChecked(wp->getCurrent());
......
Markdown is supported
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