Commit 2d5018d6 authored by Lorenz Meier's avatar Lorenz Meier

Update XPlane link

parent 67bb4089
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2011 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
...@@ -24,7 +24,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -24,7 +24,7 @@ This file is part of the QGROUNDCONTROL project
/** /**
* @file QGCXPlaneLink.cc * @file QGCXPlaneLink.cc
* Implementation of X-Plane interface * Implementation of X-Plane interface
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <lm@qgroundcontrol.org>
* *
*/ */
...@@ -371,7 +371,9 @@ void QGCXPlaneLink::updateControls(quint64 time, float rollAilerons, float pitch ...@@ -371,7 +371,9 @@ void QGCXPlaneLink::updateControls(quint64 time, float rollAilerons, float pitch
bool isFixedWing = true; bool isFixedWing = true;
if (_vehicle->vehicleType() == MAV_TYPE_QUADROTOR) if (_vehicle->vehicleType() == MAV_TYPE_QUADROTOR
|| mav->getSystemType() == MAV_TYPE_HEXAROTOR
|| mav->getSystemType() == MAV_TYPE_OCTOROTOR)
{ {
qDebug() << "MAV_TYPE_QUADROTOR"; qDebug() << "MAV_TYPE_QUADROTOR";
...@@ -381,7 +383,9 @@ void QGCXPlaneLink::updateControls(quint64 time, float rollAilerons, float pitch ...@@ -381,7 +383,9 @@ void QGCXPlaneLink::updateControls(quint64 time, float rollAilerons, float pitch
p.f[2] = throttle; p.f[2] = throttle;
p.f[3] = pitchElevator; p.f[3] = pitchElevator;
isFixedWing = false; // Direct throttle control
p.index = 25;
writeBytesSafe((const char*)&p, sizeof(p));
} }
else else
{ {
...@@ -389,34 +393,26 @@ void QGCXPlaneLink::updateControls(quint64 time, float rollAilerons, float pitch ...@@ -389,34 +393,26 @@ void QGCXPlaneLink::updateControls(quint64 time, float rollAilerons, float pitch
p.f[0] = -pitchElevator; p.f[0] = -pitchElevator;
p.f[1] = rollAilerons; p.f[1] = rollAilerons;
p.f[2] = yawRudder; p.f[2] = yawRudder;
}
if(isFixedWing)
{
// Ail / Elevon / Rudder // Ail / Elevon / Rudder
p.index = 12; // XPlane, wing sweep
// Send to group 12
p.index = 12;
writeBytesSafe((const char*)&p, sizeof(p)); writeBytesSafe((const char*)&p, sizeof(p));
p.index = 8; // XPlane, joystick? why? // Send to group 8, which equals manual controls
p.index = 8;
writeBytesSafe((const char*)&p, sizeof(p)); writeBytesSafe((const char*)&p, sizeof(p));
p.index = 25; // Thrust // Send throttle to all four motors
p.index = 25;
memset(p.f, 0, sizeof(p.f)); memset(p.f, 0, sizeof(p.f));
p.f[0] = throttle; p.f[0] = throttle;
p.f[1] = throttle; p.f[1] = throttle;
p.f[2] = throttle; p.f[2] = throttle;
p.f[3] = throttle; p.f[3] = throttle;
// Throttle
writeBytesSafe((const char*)&p, sizeof(p)); writeBytesSafe((const char*)&p, sizeof(p));
} }
else
{
qDebug() << "Transmitting p.index = 25";
p.index = 25; // XPlane, throttle command.
writeBytesSafe((const char*)&p, sizeof(p));
}
} }
Eigen::Matrix3f euler_to_wRo(double yaw, double pitch, double roll) { Eigen::Matrix3f euler_to_wRo(double yaw, double pitch, double roll) {
......
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