1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-25 14:54:16 +01:00

AeroSimRC plugin fixes and updates

This commit is contained in:
sambas 2013-03-28 18:30:14 +02:00
parent 5ded8c6dfc
commit c60a750d96
3 changed files with 50 additions and 14 deletions

View File

@ -25,7 +25,7 @@ cc_channel_6 = Ch13-FPV-Tilt
;cc_channel_10= ;cc_channel_10=
; Control TX or RX (before or after mixes) ; Control TX or RX (before or after mixes)
send_to = RX send_to = TX
[Output] [Output]

View File

@ -71,13 +71,48 @@ void AeroSimRCSimulator::transmitUpdate()
channels[i] = out; channels[i] = out;
} }
ActuatorDesired::DataFields actData;
FlightStatus::DataFields flightStatusData = flightStatus->getData();
ManualControlCommand::DataFields manCtrlData = manCtrlCommand->getData();
float roll = -1;
float pitch = -1;
float yaw = -1;
float throttle = -1;
if(flightStatusData.FlightMode == FlightStatus::FLIGHTMODE_MANUAL)
{
// Read joystick input
if(flightStatusData.Armed == FlightStatus::ARMED_ARMED)
{
// Note: Pitch sign is reversed in FG ?
roll = manCtrlData.Roll;
pitch = -manCtrlData.Pitch;
yaw = manCtrlData.Yaw;
throttle = manCtrlData.Throttle;
}
}
else
{
// Read ActuatorDesired from autopilot
actData = actDesired->getData();
roll = actData.Roll;
pitch = -actData.Pitch;
yaw = actData.Yaw;
throttle = (actData.Throttle*2.0)-1.0;
}
channels[0]=roll;
channels[1]=pitch;
if(throttle<-1)
throttle=-1;
channels[2]=throttle;
channels[3]=yaw;
// read flight status // read flight status
FlightStatus::DataFields flightData;
flightData = flightStatus->getData();
quint8 armed; quint8 armed;
quint8 mode; quint8 mode;
armed = flightData.Armed; armed = flightStatusData.Armed;
mode = flightData.FlightMode; mode = flightStatusData.FlightMode;
QByteArray data; QByteArray data;
// 50 - current size of values, 4(quint32) + 10*4(float) + 2(quint8) + 4(quint32) // 50 - current size of values, 4(quint32) + 10*4(float) + 2(quint8) + 4(quint32)
@ -132,8 +167,9 @@ void AeroSimRCSimulator::processUpdate(const QByteArray &data)
posX, posY, posZ, // world posX, posY, posZ, // world
velX, velY, velZ, // world velX, velY, velZ, // world
angX, angY, angZ, // model angX, angY, angZ, // model
accX, accY, accZ, // model accX, accY, accZ; // model
lat, lon, agl, // world qreal lat, lon;
float agl, // world
yaw, pitch, roll, // model yaw, pitch, roll, // model
volt, curr, volt, curr,
rx, ry, rz, fx, fy, fz, ux, uy, uz, // matrix rx, ry, rz, fx, fy, fz, ux, uy, uz, // matrix
@ -209,13 +245,13 @@ void AeroSimRCSimulator::processUpdate(const QByteArray &data)
out.groundspeed = qSqrt(velX * velX + velY * velY); out.groundspeed = qSqrt(velX * velX + velY * velY);
/**********************************************************************************************/ /**********************************************************************************************/
out.dstN = posY * 100; out.dstN = posY * 1;
out.dstE = posX * 100; out.dstE = posX * 1;
out.dstD = posZ * -100; out.dstD = posZ * -1;
out.velDown = velY * 100; out.velNorth = velY * 1;
out.velEast = velX * 100; out.velEast = velX * 1;
out.velDown = velZ * 100; //WHY ISN'T THIS `-velZ`??? out.velDown = velZ * -1;
updateUAVOs(out); updateUAVOs(out);

View File

@ -809,7 +809,7 @@
<item> <item>
<widget class="QGroupBox" name="baroAltitudeCheckbox"> <widget class="QGroupBox" name="baroAltitudeCheckbox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="title"> <property name="title">
<string>BaroAltitude</string> <string>BaroAltitude</string>