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
#include "Waypoint.h"
#include <QStringList>
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)
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)
: id(_id),
x(_x),
y(_y),
......
......@@ -131,7 +131,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
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);
//get next waypoint
......
......@@ -203,8 +203,6 @@ void WaypointList::add()
Waypoint *wp = new Waypoint(0, uas->getLongitude(), uas->getLatitude(), uas->getAltitude(),
0.0, true, true, 0.15, 2000);
uas->getWaypointManager().addWaypoint(wp);
}
}
}
......
......@@ -60,13 +60,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL);
m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL);
// defaults
changedAction(0);
changedFrame(wp->getFrame());
// Read values and set user interface
updateValues();
// defaults
//changedAction(wp->getAction());
//changedFrame(wp->getFrame());
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->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));
......@@ -133,7 +133,7 @@ void WaypointView::changedAction(int index)
m_ui->holdTimeSpinBox->hide();
// 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);
// expose ui based on action
......@@ -206,7 +206,8 @@ void WaypointView::updateValues()
{
// update frame
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)
{
case(MAV_FRAME_LOCAL):
......@@ -220,11 +221,12 @@ void WaypointView::updateValues()
m_ui->altSpinBox->setValue(wp->getZ());
break;
}
changedFrame(frame_index);
// update action
MAV_ACTION action = wp->getAction();
changedFrame(m_ui->comboBox_frame->findData(frame));
changedAction(m_ui->comboBox_action->findData(action));
int action_index = m_ui->comboBox_action->findData(action);
m_ui->comboBox_action->setCurrentIndex(action_index);
switch(action)
{
case MAV_ACTION_TAKEOFF:
......@@ -238,6 +240,7 @@ void WaypointView::updateValues()
default:
std::cerr << "unknown action" << std::endl;
}
changedAction(action_index);
m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.);
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