Commit 927c066e authored by Bryant Mairs's avatar Bryant Mairs
parents 93821e15 deddf85c
...@@ -451,6 +451,14 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -451,6 +451,14 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
stopLowBattAlarm(); stopLowBattAlarm();
} }
// control_sensors_enabled:
// relevant bits: 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control
emit attitudeControlEnabled(state.onboard_control_sensors_enabled & (1 << 11));
emit positionYawControlEnabled(state.onboard_control_sensors_enabled & (1 << 12));
emit positionZControlEnabled(state.onboard_control_sensors_enabled & (1 << 13));
emit positionXYControlEnabled(state.onboard_control_sensors_enabled & (1 << 14));
// Trigger drop rate updates as needed. Here we convert the incoming // Trigger drop rate updates as needed. Here we convert the incoming
// drop_rate_comm value from 1/100 of a percent in a uint16 to a true // drop_rate_comm value from 1/100 of a percent in a uint16 to a true
// percentage as a float. We also cap the incoming value at 100% as defined // percentage as a float. We also cap the incoming value at 100% as defined
...@@ -580,6 +588,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -580,6 +588,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
speedZ = pos.vz/100.0; speedZ = pos.vz/100.0;
emit globalPositionChanged(this, latitude, longitude, altitude, time); emit globalPositionChanged(this, latitude, longitude, altitude, time);
emit speedChanged(this, speedX, speedY, speedZ, time); emit speedChanged(this, speedX, speedY, speedZ, time);
// Set internal state // Set internal state
if (!positionLock) if (!positionLock)
{ {
...@@ -601,6 +610,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -601,6 +610,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// only accept values in a realistic range // only accept values in a realistic range
// quint64 time = getUnixTime(pos.time_usec); // quint64 time = getUnixTime(pos.time_usec);
quint64 time = getUnixTime(pos.time_usec); quint64 time = getUnixTime(pos.time_usec);
emit gpsLocalizationChanged(this, pos.fix_type);
// TODO: track localization state not only for gps but also for other loc. sources
int loc_type = pos.fix_type;
if (loc_type == 1)
{
loc_type = 0;
}
emit localizationChanged(this, loc_type);
if (pos.fix_type > 2) if (pos.fix_type > 2)
{ {
......
...@@ -472,25 +472,45 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b ...@@ -472,25 +472,45 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b
void HSIDisplay::updatePositionLock(UASInterface* uas, bool lock) void HSIDisplay::updatePositionLock(UASInterface* uas, bool lock)
{ {
Q_UNUSED(uas); Q_UNUSED(uas);
bool changed = positionLock != lock;
positionLock = lock; positionLock = lock;
if (changed)
{
update();
}
} }
void HSIDisplay::updateAttitudeControllerEnabled(bool enabled) void HSIDisplay::updateAttitudeControllerEnabled(bool enabled)
{ {
bool changed = attControlEnabled != enabled;
attControlEnabled = enabled; attControlEnabled = enabled;
attControlKnown = true; attControlKnown = true;
if (changed)
{
update();
}
} }
void HSIDisplay::updatePositionXYControllerEnabled(bool enabled) void HSIDisplay::updatePositionXYControllerEnabled(bool enabled)
{ {
bool changed = xyControlEnabled != enabled;
xyControlEnabled = enabled; xyControlEnabled = enabled;
xyControlKnown = true; xyControlKnown = true;
if (changed)
{
update();
}
} }
void HSIDisplay::updatePositionZControllerEnabled(bool enabled) void HSIDisplay::updatePositionZControllerEnabled(bool enabled)
{ {
bool changed = zControlEnabled != enabled;
zControlEnabled = enabled; zControlEnabled = enabled;
zControlKnown = true; zControlKnown = true;
if (changed)
{
update();
}
} }
void HSIDisplay::updateObjectPosition(unsigned int time, int id, int type, const QString& name, int quality, float bearing, float distance) void HSIDisplay::updateObjectPosition(unsigned int time, int id, int type, const QString& name, int quality, float bearing, float distance)
......
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