Commit a076f256 authored by pixhawk's avatar pixhawk

Fixed local global transform

parent 1e90dab4
...@@ -70,7 +70,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) : ...@@ -70,7 +70,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
localAvailable(0), localAvailable(0),
roll(0), roll(0),
pitch(0), pitch(0),
yaw(0.0f), yaw(1.0f), // FIXME Should be 0
bodyXSetCoordinate(0.0f), bodyXSetCoordinate(0.0f),
bodyYSetCoordinate(0.0f), bodyYSetCoordinate(0.0f),
bodyZSetCoordinate(0.0f), bodyZSetCoordinate(0.0f),
...@@ -83,7 +83,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) : ...@@ -83,7 +83,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
positionLock(false), positionLock(false),
attControlEnabled(false), attControlEnabled(false),
xyControlEnabled(false), xyControlEnabled(false),
zControlEnabled(false) zControlEnabled(false),
mavInitialized(false)
{ {
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
refreshTimer->setInterval(60); refreshTimer->setInterval(60);
...@@ -272,7 +273,7 @@ QPointF HSIDisplay::metricWorldToBody(QPointF world) ...@@ -272,7 +273,7 @@ QPointF HSIDisplay::metricWorldToBody(QPointF world)
{ {
// First translate to body-centered coordinates // First translate to body-centered coordinates
// Rotate around -yaw // Rotate around -yaw
QPointF result(cos(yaw) * (world.x() - x) + -sin(yaw) * (world.x() - x), sin(yaw) * (world.y() - y) + cos(yaw) * (world.y() - y)); QPointF result(cos(yaw) * (x - world.x()) + -sin(yaw) * (x - world.x()), sin(yaw) * (y - world.y()) + cos(yaw) * (y - world.y()));
return result; return result;
} }
...@@ -400,7 +401,9 @@ void HSIDisplay::setBodySetpointCoordinateXY(double x, double y) ...@@ -400,7 +401,9 @@ void HSIDisplay::setBodySetpointCoordinateXY(double x, double y)
uiXSetCoordinate = sp.x(); uiXSetCoordinate = sp.x();
uiYSetCoordinate = sp.y(); uiYSetCoordinate = sp.y();
if (uas) qDebug() << "Attempting to set new setpoint at x: " << x << "metric y:" << y;
if (uas && mavInitialized)
{ {
uas->setLocalPositionSetpoint(uiXSetCoordinate, uiYSetCoordinate, uiZSetCoordinate, uiYawSet); uas->setLocalPositionSetpoint(uiXSetCoordinate, uiYSetCoordinate, uiZSetCoordinate, uiYawSet);
qDebug() << "Setting new setpoint at x: " << x << "metric y:" << y; qDebug() << "Setting new setpoint at x: " << x << "metric y:" << y;
...@@ -445,6 +448,9 @@ void HSIDisplay::updatePositionSetpoints(int uasid, float xDesired, float yDesir ...@@ -445,6 +448,9 @@ void HSIDisplay::updatePositionSetpoints(int uasid, float xDesired, float yDesir
bodyYSetCoordinate = yDesired; bodyYSetCoordinate = yDesired;
bodyZSetCoordinate = zDesired; bodyZSetCoordinate = zDesired;
bodyYawSet = yawDesired; bodyYawSet = yawDesired;
mavInitialized = true;
qDebug() << "Received setpoint at x: " << x << "metric y:" << y;
// posXSet = xDesired; // posXSet = xDesired;
// posYSet = yDesired; // posYSet = yDesired;
// posZSet = zDesired; // posZSet = zDesired;
......
...@@ -195,6 +195,7 @@ protected: ...@@ -195,6 +195,7 @@ protected:
bool attControlEnabled; bool attControlEnabled;
bool xyControlEnabled; bool xyControlEnabled;
bool zControlEnabled; bool zControlEnabled;
bool mavInitialized; ///< The MAV is initialized once the setpoint has been received
private: private:
}; };
......
#include "WatchdogProcessView.h" #include "WatchdogProcessView.h"
#include "ui_WatchdogProcessView.h" #include "ui_WatchdogProcessView.h"
WatchdogProcessView::WatchdogProcessView(QWidget *parent) : WatchdogProcessView::WatchdogProcessView(int processid, QWidget *parent) :
QWidget(parent), QWidget(parent),
m_ui(new Ui::WatchdogProcessView) m_ui(new Ui::WatchdogProcessView)
{ {
......
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