Commit 7b1df3b8 authored by Lorenz Meier's avatar Lorenz Meier

Fixes to X Plane HIL

parent 716915e3
......@@ -523,7 +523,6 @@ SOURCES += src/main.cc \
src/ui/mission/QGCMissionDoStartSearch.cc \
src/ui/mission/QGCMissionDoFinishSearch.cc \
src/ui/QGCVehicleConfig.cc \
src/comm/QGCHilLink.cc \
src/ui/QGCHilConfiguration.cc \
src/ui/QGCHilFlightGearConfiguration.cc \
src/ui/QGCHilXPlaneConfiguration.cc
......
#include "QGCHilLink.h"
//QGCHilLink::QGCHilLink(QObject *parent) :
// QThread(parent)
//{
//}
......@@ -223,10 +223,12 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
void QGCXPlaneLink::updateActuators(uint64_t time, float act1, float act2, float act3, float act4, float act5, float act6, float act7, float act8)
{
// XXX Control this via the onboard system type exclusively
if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
// Only update this for multirotors
if (airframeID == AIRFRAME_QUAD_X_MK_10INCH_I2C ||
airframeID == AIRFRAME_QUAD_X_ARDRONE ||
airframeID == AIRFRAME_QUAD_DJI_F450_PWM)
// if (airframeID == AIRFRAME_QUAD_X_MK_10INCH_I2C ||
// airframeID == AIRFRAME_QUAD_X_ARDRONE ||
// airframeID == AIRFRAME_QUAD_DJI_F450_PWM)
{
Q_UNUSED(time);
......@@ -252,27 +254,34 @@ void QGCXPlaneLink::updateActuators(uint64_t time, float act1, float act2, float
p.index = 25;
memset(p.f, 0, sizeof(p.f));
if (airframeID == AIRFRAME_QUAD_X_MK_10INCH_I2C)
{
p.f[0] = act1 / 255.0f;
p.f[1] = act2 / 255.0f;
p.f[2] = act3 / 255.0f;
p.f[3] = act4 / 255.0f;
}
else if (airframeID == AIRFRAME_QUAD_X_ARDRONE)
{
p.f[0] = act1 / 500.0f;
p.f[1] = act2 / 500.0f;
p.f[2] = act3 / 500.0f;
p.f[3] = act4 / 500.0f;
}
else
{
p.f[0] = (act1 - 1000.0f) / 1000.0f;
p.f[1] = (act2 - 1000.0f) / 1000.0f;
p.f[2] = (act3 - 1000.0f) / 1000.0f;
p.f[3] = (act4 - 1000.0f) / 1000.0f;
}
p.f[0] = act1;
p.f[1] = act2;
p.f[2] = act3;
p.f[3] = act4;
// XXX the system corrects for the scale onboard, do not scale again
// if (airframeID == AIRFRAME_QUAD_X_MK_10INCH_I2C)
// {
// p.f[0] = act1 / 255.0f;
// p.f[1] = act2 / 255.0f;
// p.f[2] = act3 / 255.0f;
// p.f[3] = act4 / 255.0f;
// }
// else if (airframeID == AIRFRAME_QUAD_X_ARDRONE)
// {
// p.f[0] = act1 / 500.0f;
// p.f[1] = act2 / 500.0f;
// p.f[2] = act3 / 500.0f;
// p.f[3] = act4 / 500.0f;
// }
// else
// {
// p.f[0] = (act1 - 1000.0f) / 1000.0f;
// p.f[1] = (act2 - 1000.0f) / 1000.0f;
// p.f[2] = (act3 - 1000.0f) / 1000.0f;
// p.f[3] = (act4 - 1000.0f) / 1000.0f;
// }
// Throttle
writeBytes((const char*)&p, sizeof(p));
}
......@@ -282,7 +291,6 @@ void QGCXPlaneLink::updateControls(uint64_t time, float rollAilerons, float pitc
{
// Do not update this control type for
// all multirotors
if (airframeID == AIRFRAME_QUAD_X_MK_10INCH_I2C ||
airframeID == AIRFRAME_QUAD_X_ARDRONE ||
airframeID == AIRFRAME_QUAD_DJI_F450_PWM)
......
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