Commit 59a57d53 authored by dongfang's avatar dongfang

PFD rework

parent 8e4319ae
Messages interpreted in UAS.cc:
MAVLINK_MSG_ID_HEARTBEAT
MAVLINK_MSG_ID_SYS_STATUS
MAVLINK_MSG_ID_ATTITUDE
MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET
MAVLINK_MSG_ID_HIL_CONTROLS
MAVLINK_MSG_ID_VFR_HUD
MAVLINK_MSG_ID_LOCAL_POSITION_NED
MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE
MAVLINK_MSG_ID_GLOBAL_POSITION_INT
MAVLINK_MSG_ID_GPS_RAW_INT
MAVLINK_MSG_ID_GPS_STATUS
MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
MAVLINK_MSG_ID_RC_CHANNELS_RAW
MAVLINK_MSG_ID_RC_CHANNELS_SCALED
MAVLINK_MSG_ID_PARAM_VALUE
MAVLINK_MSG_ID_COMMAND_ACK
MAVLINK_MSG_ID_MISSION_COUNT
MAVLINK_MSG_ID_MISSION_ITEM
MAVLINK_MSG_ID_MISSION_ACK
MAVLINK_MSG_ID_MISSION_REQUEST
MAVLINK_MSG_ID_MISSION_ITEM_REACHED (we want a new signal for this one)
currentWaypointChanged
MAVLINK_MSG_ID_MISSION_CURRENT
MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT
MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT
MAVLINK_MSG_ID_STATUSTEXT
MAVLINK_MSG_ID_SERVO_OUTPUT_RAW
MAVLINK_MSG_ID_RAW_IMU
MAVLINK_MSG_ID_SCALED_IMU
MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT
MAVLINK_MSG_ID_RAW_PRESSURE
MAVLINK_MSG_ID_SCALED_PRESSURE
MAVLINK_MSG_ID_OPTICAL_FLOW
MAVLINK_MSG_ID_DEBUG_VECT
MAVLINK_MSG_ID_DEBUG
MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
MAVLINK_MSG_ID_NAMED_VALUE_INT
MAVLINK_MSG_ID_MANUAL_CONTROL
MAVLINK_MSG_ID_HIGHRES_IMU
Signals of interest:
On UAS.cc:
// General
value_changed (custom value tracking)
// Mode:
armingChanged (ARMED etc)
statusChanged
modechanged
navModeChanged
// System Status
loadChanged
Do we already have these in some form? Can they be merged?
batteryChanged (DONE)
voltageChanged (DONE)
gpsLocalizationChanged
satelliteCountChanged (DONE)
// Mission status
currentWaypointChanged (on WaypointManager)
new type for MAVLINK_MSG_ID_MISSION_ITEM_REACHED
distToWaypointChanged
// Link Status
heartbeatTimeout
dropRateChanged
// Attitude & speed
attitudeChanged
speedChanged
speedChanged (when message is MAVLINK_MSG_ID_VFR_HUD: x is airspeed, y is zero and z is VV)
// Position (if used)
globalPositionChanged
homePositionChanged (for pointer to home. Or we ignore signals and suck the data
off the UAS instance)
......@@ -681,4 +681,5 @@ win32-msvc2008|win32-msvc2010|win32-msvc2012 {
unix:!macx:!symbian: LIBS += -losg
OTHER_FILES += \
dongfang_notes.txt
dongfang_notes.txt \
src/ui/dongfang-scrapyard.txt
This diff is collapsed.
......@@ -7,7 +7,7 @@
#define SEPARATE_COMPASS_ASPECTRATIO (3.0f/4.0f)
#define LINEWIDTH 0.0032f
#define LINEWIDTH 0.0036f
//#define TAPES_TEXT_SIZE 0.028
//#define AI_TEXT_SIZE 0.040
......@@ -41,9 +41,9 @@
// width of the lines is reduced, down to PITCH_SCALE_WIDTHREDUCTION times
// the normal width. This helps keep orientation in extreme attitudes.
#define PITCH_SCALE_WIDTHREDUCTION_FROM 30
#define PITCH_SCALE_WIDTHREDUCTION 0.4
#define PITCH_SCALE_WIDTHREDUCTION 0.3
#define PITCH_SCALE_HALFRANGE 20
#define PITCH_SCALE_HALFRANGE 15
// The number of degrees to either side of the heading to draw the compass disk.
// 180 is valid, this will draw a complete disk. If the disk is partly clipped
......@@ -53,23 +53,20 @@
#define COMPASS_DISK_ARROWTICK 45
#define COMPASS_DISK_MAJORLINEWIDTH 0.006
#define COMPASS_DISK_MINORLINEWIDTH 0.004
#define COMPASS_DISK_SPAN 180
#define COMPASS_DISK_RESOLUTION 15
#define COMPASS_DISK_RESOLUTION 10
#define COMPASS_SEPARATE_DISK_RESOLUTION 5
#define COMPASS_DISK_MARKERWIDTH 0.2
#define COMPASS_DISK_MARKERHEIGHT 0.133
#define ALTIMETER_VVI_SPAN 10
#define ALTIMETER_VVI_LOGARITHMIC true
#define TAPE_GAUGES_TICKWIDTH_MAJOR 0.25
#define TAPE_GAUGES_TICKWIDTH_MINOR 0.15
// The altitude difference between top and bottom of scale
#define ALTIMETER_LINEAR_SPAN 35
#define ALTIMETER_LINEAR_SPAN 50
// every 5 meters there is a tick mark
#define ALTIMETER_LINEAR_RESOLUTION 5
// every 10 meters there is a number
#define ALTIMETER_LINEAR_MAJOR_RESOLUTION 10
// min. and max. vertical velocity
// Projected: An experiment. Make tape appear projected from a cylinder, like a French "drum" style gauge.
// The altitude difference between top and bottom of scale
......@@ -81,9 +78,12 @@
// min. and max. vertical velocity
//#define ALTIMETER_PROJECTED
// min. and max. vertical velocity
#define ALTIMETER_VVI_SPAN 5
#define ALTIMETER_VVI_WIDTH 0.2
// Now the same thing for airspeed!
#define AIRSPEED_LINEAR_SPAN 10
#define AIRSPEED_LINEAR_SPAN 15
#define AIRSPEED_LINEAR_RESOLUTION 1
#define AIRSPEED_LINEAR_MAJOR_RESOLUTION 5
......@@ -107,23 +107,10 @@ public slots:
/** @brief Attitude from one specific component / redundant autopilot */
void updateAttitude(UASInterface* uas, int component, double roll, double pitch, double yaw, quint64 timestamp);
// void updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec);
void updateBattery(UASInterface*, double, double, double, int);
void receiveHeartbeat(UASInterface*);
void updateThrust(UASInterface*, double);
void updateLocalPosition(UASInterface*,double,double,double,quint64);
void updateGlobalPosition(UASInterface*,double,double,double,quint64);
void updateSpeed(UASInterface*,double,double,double,quint64);
void updateState(UASInterface*,QString);
void updateMode(int id,QString mode, QString description);
void updateLoad(UASInterface*, double);
void updateGPSFixType(UASInterface*,int);
void updateSatelliteCount(double count,QString sth);
void selectWaypoint(int uasId, int id);
protected:
enum Layout {
//FEATUREPANELS_IN_CORNERS, // For a wide and low container.
//FEATUREPANELS_AT_BOTTOM, // For higher container.
COMPASS_INTEGRATED,
COMPASS_SEPARATED // For a very high container. Feature panels are at bottom.
};
......@@ -174,10 +161,10 @@ private:
void drawTextCenterTop(QPainter& painter, QString text, float fontSize, float x, float y);
void drawAIGlobalFeatures(QPainter& painter, QRectF mainArea, QRectF paintArea);
void drawAIAirframeFixedFeatures(QPainter& painter, QRectF area);
void drawPitchScale(QPainter& painter, QRectF area, bool drawNumbersLeft, bool drawNumbersRight);
void drawPitchScale(QPainter& painter, QRectF area, float intrusion, bool drawNumbersLeft, bool drawNumbersRight);
void drawRollScale(QPainter& painter, QRectF area, bool drawTicks, bool drawNumbers);
void drawAIAttitudeScales(QPainter& painter, QRectF area);
void drawAICompassDisk(QPainter& painter, QRectF area);
void drawAIAttitudeScales(QPainter& painter, QRectF area, float intrusion);
void drawAICompassDisk(QPainter& painter, QRectF area, float halfspan);
void drawSeparateCompassDisk(QPainter& painter, QRectF area);
void drawAltimeter(QPainter& painter, QRectF area, float altitude, float maxAltitude, float vv);
......@@ -186,10 +173,12 @@ private:
void fillInstrumentOpagueBackground(QPainter& painter, QRectF edge);
void drawInstrumentBackground(QPainter& painter, QRectF edge);
/* This information is not currently included. These headers left in as a memo for restoration later.
void drawLinkStatsPanel(QPainter& painter, QRectF area);
void drawSysStatsPanel(QPainter& painter, QRectF area);
void drawMissionStatsPanel(QPainter& painter, QRectF area);
void drawSensorsStatsPanel(QPainter& painter, QRectF area);
*/
void doPaint();
......@@ -212,18 +201,6 @@ private:
float airspeed;
float verticalVelocity;
bool uavIsArmed;
QString mode;
QString state;
float load; //
double batteryVoltage;
double batteryCurrent;
double batteryCharge;
int GPSFixType;
int satelliteCount;
Layout layout; // The display layout.
Style style; // The AI style (tapes translusent or opague)
......
/* This information is at least for the time not shown here but rather in some always visible bar.
void updateBattery(UASInterface*, double, double, double, int);
void receiveHeartbeat(UASInterface*);
void updateMode(int id,QString mode, QString description);
void updateLoad(UASInterface*, double);
void updateState(UASInterface*,QString);
void updateGPSFixType(UASInterface*,int);
void updateSatelliteCount(double count,QString sth);
void updateThrust(UASInterface*, double);
void updateLocalPosition(UASInterface*,double,double,double,quint64);
void updateGlobalPosition(UASInterface*,double,double,double,quint64);
void selectWaypoint(int uasId, int id);
*/
/*
bool uavIsArmed;
QString mode;
QString state;
float load;
double batteryVoltage;
double batteryCurrent;
double batteryCharge;
int GPSFixType;
int satelliteCount;
*/
batteryVoltage(UNKNOWN_BATTERY),
batteryCurrent(UNKNOWN_BATTERY),
batteryCharge(UNKNOWN_BATTERY),
GPSFixType(UNKNOWN_GPSFIXTYPE),
satelliteCount(UNKNOWN_COUNT),
uavIsArmed(false), // TODO: This is an assumption. We have no idea!
mode("-"),
state("-"),
load(0),
void PrimaryFlightDisplay::updateBattery(UASInterface* uas, double voltage, double current, double percent, int seconds)
{
Q_UNUSED(uas);
Q_UNUSED(seconds);
batteryVoltage = voltage;
batteryCurrent = current;
batteryCharge = percent;
}
void PrimaryFlightDisplay::updateGPSFixType(UASInterface* uas, int fixType) {
Q_UNUSED(uas);
this->GPSFixType = fixType;
}
void PrimaryFlightDisplay::updateSatelliteCount(double count, QString name) {
Q_UNUSED(uas)
this->satelliteCount = (int)count;
}
void PrimaryFlightDisplay::receiveHeartbeat(UASInterface*)
{
}
void PrimaryFlightDisplay::updateThrust(UASInterface* uas, double thrust)
{
Q_UNUSED(uas);
Q_UNUSED(thrust);
}
/*
* TODO! Implementation or removal of this.
* Currently a dummy.
*/
void PrimaryFlightDisplay::updateLocalPosition(UASInterface* uas,double x,double y,double z,quint64 timestamp)
{
Q_UNUSED(uas);
Q_UNUSED(x);
Q_UNUSED(y);
Q_UNUSED(z);
Q_UNUSED(timestamp);
}
void PrimaryFlightDisplay::updateGlobalPosition(UASInterface* uas,double lat, double lon, double altitude, quint64 timestamp)
{
Q_UNUSED(uas);
Q_UNUSED(lat);
Q_UNUSED(lon);
Q_UNUSED(timestamp);
// TODO: Examine whether this is really the GPS alt or the mix-alt coming in.
GPSAltitude = altitude;
}
void PrimaryFlightDisplay::updateState(UASInterface* uas,QString state)
{
// Only one UAS is connected at a time
Q_UNUSED(uas);
this->state = state;
}
void PrimaryFlightDisplay::updateMode(int id, QString mode, QString description)
{
// Only one UAS is connected at a time
Q_UNUSED(id);
Q_UNUSED(description);
this->mode = mode;
}
void PrimaryFlightDisplay::updateLoad(UASInterface* uas, double load)
{
Q_UNUSED(uas);
this->load = load;
//updateValue(uas, "load", load, MG::TIME::getGroundTimeNow());
}
void PrimaryFlightDisplay::selectWaypoint(int uasId, int id) {
}
void PrimaryFlightDisplay::drawLinkStatsPanel (
QPainter& painter,
QRectF area) {
// UAV Id
// Droprates up, down
QString s_linkStat("100%");
QString s_upTime("01:23:34");
painter.resetTransform();
if (style == NO_OVERLAYS)
drawInstrumentBackground(painter, area);
painter.translate(area.center());
QPen pen;
pen.setWidthF(lineWidth);
pen.setColor(amberColor);
painter.setPen(pen);
drawTextCenter(painter, s_linkStat, mediumTextSize, 0, -area.height()/6);
drawTextCenter(painter, s_upTime, mediumTextSize, 0, area.height()/6);
}
void PrimaryFlightDisplay::drawMissionStatsPanel (
QPainter& painter,
QRectF area) {
// Flight mode
// next WP
// next WP dist
QString s_flightMode("Auto");
QString s_nextWP("1234m\u21924");
painter.resetTransform();
if (style == NO_OVERLAYS)
drawInstrumentBackground(painter, area);
painter.translate(area.center());
QPen pen;
pen.setWidthF(lineWidth);
pen.setColor(amberColor);
painter.setPen(pen);
drawTextCenter(painter, s_flightMode, mediumTextSize, 0, -area.height()/6);
drawTextCenter(painter, s_nextWP, mediumTextSize, 0, area.height()/6);
}
void PrimaryFlightDisplay::drawSensorsStatsPanel (
QPainter& painter,
QRectF area) {
// GPS fixmode and #sats
// Home alt.?
// Groundspeed?
QString s_GPS("GPS 3D(8)");
QString s_homealt("H.alt 472m");
painter.resetTransform();
if (style == NO_OVERLAYS)
drawInstrumentBackground(painter, area);
painter.translate(area.center());
QPen pen;
pen.setWidthF(lineWidth);
pen.setColor(amberColor);
painter.setPen(pen);
drawTextCenter(painter, s_GPS, mediumTextSize, 0, -area.height()/6);
drawTextCenter(painter, s_homealt, mediumTextSize, 0, area.height()/6);
}
void PrimaryFlightDisplay::drawSysStatsPanel (
QPainter& painter,
QRectF area) {
// Timer
// Battery
// Armed/not
/*
energyStatus = tr("BAT [%1V | %2V%]").arg(voltage, 4, 'f', 1, QChar('0')).arg(percent, 2, 'f', 0, QChar('0'));
if (percent < 20.0f) {
fuelColor = warningColor;
} else if (percent < 10.0f) {
fuelColor = criticalColor;
} else {
fuelColor = infoColor;
}
*/
QString voltageStatus = batteryVoltage == UNKNOWN_BATTERY ? "-V" :
tr("%1V").arg(batteryVoltage, 4, 'f', 1, QChar('0'));
QString chargeStatus = batteryCharge == UNKNOWN_BATTERY ? "-%" :
tr("%2%").arg(batteryCharge, 2, 'f', 0, QChar('0'));
// We ignore current right now.
QString batteryStatus = voltageStatus.append(" ").append(chargeStatus);
QString s_arm = uavIsArmed ? "Armed" : "Disarmed";
painter.resetTransform();
if (style == NO_OVERLAYS)
drawInstrumentBackground(painter, area);
painter.translate(area.center());
QPen pen;
pen.setWidthF(lineWidth);
pen.setColor(amberColor);
painter.setPen(pen);
drawTextCenter(painter, batteryStatus, mediumTextSize, 0, -area.height()/6);
pen.setColor(redColor);
drawTextCenter(painter, s_arm, mediumTextSize, 0, area.height()/6);
}
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