diff --git a/flight/AHRS/ahrs.c b/flight/AHRS/ahrs.c index 2d5146336..3831c8e9c 100644 --- a/flight/AHRS/ahrs.c +++ b/flight/AHRS/ahrs.c @@ -62,6 +62,7 @@ void DMA1_Channel1_IRQHandler() __attribute__ ((alias ("AHRS_ADC_DMA_Handler"))) // For debugging the raw sensors //#define DUMP_RAW +//#define DUMP_FRIENDLY /** * @addtogroup AHRS_Definitions @@ -85,6 +86,8 @@ void DMA1_Channel1_IRQHandler() __attribute__ ((alias ("AHRS_ADC_DMA_Handler"))) #define RAD_PER_DEGREE ( M_PI / 180 ) #define GYRO_SCALE ( (VDD / FULL_RANGE) / GYRO_SENSITIVITY * RAD_PER_DEGREE ) #define GYRO_OFFSET -1675 /* From data sheet, zero accel output is 1.35 v */ + +#define MAX_IDLE_COUNT 65e3 /** * @} */ @@ -207,6 +210,8 @@ double BaseECEF[3] = {0, 0, 0}; float Rne[3][3]; //! Indicates the communications are requesting a calibration uint8_t calibration_pending = FALSE; +//! Counter for tracking the idle level +static uint32_t idle_counter = 0; /** * @} @@ -220,8 +225,7 @@ int main() { float gyro[3], accel[3], mag[3]; float vel[3] = {0,0,0}; - uint32_t loop_ctr = 0; - + ahrs_algorithm = INSGPS_Algo; /* Brings up System using CMSIS functions, enables the LEDs. */ @@ -299,9 +303,7 @@ int main() while (1) { // Alive signal PIOS_LED_Toggle(LED1); - - loop_ctr ++; - + if(calibration_pending) { calibrate_sensors(); @@ -312,7 +314,10 @@ int main() PIOS_HMC5843_ReadMag(mag_data.raw.axis); // Delay for valid data - while( ahrs_state != AHRS_DATA_READY ); + idle_counter = 0; + while( ahrs_state != AHRS_DATA_READY ) + idle_counter ++; + ahrs_state = AHRS_PROCESSING; downsample_data(); @@ -387,6 +392,13 @@ int main() } ahrs_state = AHRS_IDLE; + +#ifdef DUMP_FRIENDLY + PIOS_COM_SendFormattedString(PIOS_COM_AUX, "a: %d %d %d\r\n", (int16_t)(accel_data.filtered.x * 100), (int16_t)(accel_data.filtered.y * 100), (int16_t)(accel_data.filtered.z * 100)); + PIOS_COM_SendFormattedString(PIOS_COM_AUX, "g: %d %d %d\r\n", (int16_t)(gyro_data.filtered.x * 100), (int16_t)(gyro_data.filtered.y * 100), (int16_t)(gyro_data.filtered.z * 100)); + PIOS_COM_SendFormattedString(PIOS_COM_AUX, "m: %d %d %d\r\n", mag_data.raw.axis[0], mag_data.raw.axis[1], mag_data.raw.axis[2]); + PIOS_COM_SendFormattedString(PIOS_COM_AUX, "q: %d %d %d %d\r\n", (int16_t)(Nav.q[0] * 100), (int16_t)(Nav.q[1] * 100), (int16_t)(Nav.q[2] * 100), (int16_t)(Nav.q[3] * 100)); +#endif process_spi_request(); @@ -680,9 +692,9 @@ void process_spi_request(void) lfsm_user_set_tx_v1 (&user_tx_v1); break; case OPAHRS_MSG_V1_REQ_CALIBRATION: - if(user_rx_v1.payload.user.v.req.calibration.measure_var) { + if(user_rx_v1.payload.user.v.req.calibration.measure_var == AHRS_MEASURE) { calibration_pending = TRUE; - } else { + } else if (user_rx_v1.payload.user.v.req.calibration.measure_var == AHRS_SET) { accel_var[0] = user_rx_v1.payload.user.v.req.calibration.accel_var[0]; accel_var[1] = user_rx_v1.payload.user.v.req.calibration.accel_var[1]; accel_var[2] = user_rx_v1.payload.user.v.req.calibration.accel_var[2]; @@ -700,20 +712,22 @@ void process_spi_request(void) INSSetGyroBias(gyro_bias_ins); //gyro bias corrects in preprocessing INSSetGyroVar(gyro_var); INSSetMagVar(mag_var); - } - accel_bias[0] = user_rx_v1.payload.user.v.req.calibration.accel_bias[0]; - accel_bias[1] = user_rx_v1.payload.user.v.req.calibration.accel_bias[1]; - accel_bias[2] = user_rx_v1.payload.user.v.req.calibration.accel_bias[2]; - accel_scale[0] = user_rx_v1.payload.user.v.req.calibration.accel_scale[0]; - accel_scale[1] = user_rx_v1.payload.user.v.req.calibration.accel_scale[1]; - accel_scale[2] = user_rx_v1.payload.user.v.req.calibration.accel_scale[2]; - gyro_scale[0] = user_rx_v1.payload.user.v.req.calibration.gyro_scale[0]; - gyro_scale[1] = user_rx_v1.payload.user.v.req.calibration.gyro_scale[1]; - gyro_scale[2] = user_rx_v1.payload.user.v.req.calibration.gyro_scale[2]; - mag_bias[0] = user_rx_v1.payload.user.v.req.calibration.mag_bias[0]; - mag_bias[1] = user_rx_v1.payload.user.v.req.calibration.mag_bias[1]; - mag_bias[2] = user_rx_v1.payload.user.v.req.calibration.mag_bias[2]; - + } + if(user_rx_v1.payload.user.v.req.calibration.measure_var != AHRS_ECHO) { + /* if echoing don't set anything */ + accel_bias[0] = user_rx_v1.payload.user.v.req.calibration.accel_bias[0]; + accel_bias[1] = user_rx_v1.payload.user.v.req.calibration.accel_bias[1]; + accel_bias[2] = user_rx_v1.payload.user.v.req.calibration.accel_bias[2]; + accel_scale[0] = user_rx_v1.payload.user.v.req.calibration.accel_scale[0]; + accel_scale[1] = user_rx_v1.payload.user.v.req.calibration.accel_scale[1]; + accel_scale[2] = user_rx_v1.payload.user.v.req.calibration.accel_scale[2]; + gyro_scale[0] = user_rx_v1.payload.user.v.req.calibration.gyro_scale[0]; + gyro_scale[1] = user_rx_v1.payload.user.v.req.calibration.gyro_scale[1]; + gyro_scale[2] = user_rx_v1.payload.user.v.req.calibration.gyro_scale[2]; + mag_bias[0] = user_rx_v1.payload.user.v.req.calibration.mag_bias[0]; + mag_bias[1] = user_rx_v1.payload.user.v.req.calibration.mag_bias[1]; + mag_bias[2] = user_rx_v1.payload.user.v.req.calibration.mag_bias[2]; + } // echo back the values used opahrs_msg_v1_init_user_tx (&user_tx_v1, OPAHRS_MSG_V1_RSP_CALIBRATION); user_tx_v1.payload.user.v.rsp.calibration.accel_var[0] = accel_var[0]; @@ -793,6 +807,9 @@ void process_spi_request(void) user_tx_v1.payload.user.v.rsp.update.Vel[1] = Nav.Vel[1]; user_tx_v1.payload.user.v.rsp.update.Vel[2] = Nav.Vel[2]; + // compute the idle fraction + user_tx_v1.payload.user.v.rsp.update.load = (MAX_IDLE_COUNT - idle_counter) * 100 / MAX_IDLE_COUNT; + dump_spi_message(PIOS_COM_AUX, "U", (uint8_t *)&user_tx_v1, sizeof(user_tx_v1)); lfsm_user_set_tx_v1 (&user_tx_v1); break; diff --git a/flight/OpenPilot/Modules/AHRSComms/ahrs_comms.c b/flight/OpenPilot/Modules/AHRSComms/ahrs_comms.c index b07dc5845..3205014f0 100644 --- a/flight/OpenPilot/Modules/AHRSComms/ahrs_comms.c +++ b/flight/OpenPilot/Modules/AHRSComms/ahrs_comms.c @@ -221,7 +221,8 @@ static void ahrscommsTask(void* parameters) if(( result = PIOS_OPAHRS_SetGetCalibration(&req,&rsp) ) == OPAHRS_RESULT_OK ) { update_calibration(&(rsp.payload.user.v.rsp.calibration)); AHRSCalibrationIsUpdatedFlag = false; - data.CalibrationSet = AHRSSTATUS_CALIBRATIONSET_TRUE; + if(rsp.payload.user.v.rsp.calibration.measure_var != AHRS_ECHO) + data.CalibrationSet = AHRSSTATUS_CALIBRATIONSET_TRUE; AhrsStatusSet(&data); } else { @@ -311,8 +312,13 @@ static void load_calibration(struct opahrs_msg_v1_req_calibration * calibration) { AHRSCalibrationData data; AHRSCalibrationGet(&data); - - calibration->measure_var = data.measure_var; + if(data.measure_var == AHRSCALIBRATION_MEASURE_VAR_SET) + calibration->measure_var = AHRS_SET; + else if(data.measure_var == AHRSCALIBRATION_MEASURE_VAR_MEASURE) + calibration->measure_var = AHRS_MEASURE; + else + calibration->measure_var = AHRS_ECHO; + calibration->accel_bias[0] = data.accel_bias[0]; calibration->accel_bias[1] = data.accel_bias[1]; calibration->accel_bias[2] = data.accel_bias[2]; @@ -451,6 +457,11 @@ static void process_update(struct opahrs_msg_v1_rsp_update * update) pos.Vel[1] = update->Vel[1]; pos.Vel[2] = update->Vel[2]; PositionActualSet(&pos); + + AhrsStatusData status; + AhrsStatusGet(&status); + status.CPULoad = update->load; + AhrsStatusSet(&status); } static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw) diff --git a/flight/OpenPilot/UAVObjects/inc/ahrscalibration.h b/flight/OpenPilot/UAVObjects/inc/ahrscalibration.h index fd0cdab39..7ac863586 100644 --- a/flight/OpenPilot/UAVObjects/inc/ahrscalibration.h +++ b/flight/OpenPilot/UAVObjects/inc/ahrscalibration.h @@ -86,7 +86,7 @@ typedef struct { // Field information // Field measure_var information /* Enumeration options for field measure_var */ -typedef enum { AHRSCALIBRATION_MEASURE_VAR_FALSE=0, AHRSCALIBRATION_MEASURE_VAR_TRUE=1 } AHRSCalibrationmeasure_varOptions; +typedef enum { AHRSCALIBRATION_MEASURE_VAR_SET=0, AHRSCALIBRATION_MEASURE_VAR_MEASURE=1, AHRSCALIBRATION_MEASURE_VAR_ECHO=2 } AHRSCalibrationmeasure_varOptions; // Field accel_bias information /* Array element names for field accel_bias */ typedef enum { AHRSCALIBRATION_ACCEL_BIAS_X=0, AHRSCALIBRATION_ACCEL_BIAS_Y=1, AHRSCALIBRATION_ACCEL_BIAS_Z=2 } AHRSCalibrationaccel_biasElem; diff --git a/flight/OpenPilot/UAVObjects/inc/ahrsstatus.h b/flight/OpenPilot/UAVObjects/inc/ahrsstatus.h index 3a8c1c71f..200e5cdee 100644 --- a/flight/OpenPilot/UAVObjects/inc/ahrsstatus.h +++ b/flight/OpenPilot/UAVObjects/inc/ahrsstatus.h @@ -41,7 +41,7 @@ #define AHRSSTATUS_H // Object constants -#define AHRSSTATUS_OBJID 842145078U +#define AHRSSTATUS_OBJID 3393301276U #define AHRSSTATUS_NAME "AhrsStatus" #define AHRSSTATUS_METANAME "AhrsStatusMeta" #define AHRSSTATUS_ISSINGLEINST 1 @@ -72,6 +72,7 @@ // Object data typedef struct { uint8_t SerialNumber[25]; + uint8_t CPULoad; uint8_t CommErrors[5]; uint8_t AlgorithmSet; uint8_t CalibrationSet; @@ -83,6 +84,7 @@ typedef struct { // Field SerialNumber information /* Number of elements for field SerialNumber */ #define AHRSSTATUS_SERIALNUMBER_NUMELEM 25 +// Field CPULoad information // Field CommErrors information /* Array element names for field CommErrors */ typedef enum { AHRSSTATUS_COMMERRORS_ALGORITHM=0, AHRSSTATUS_COMMERRORS_UPDATE=1, AHRSSTATUS_COMMERRORS_ATTITUDERAW=2, AHRSSTATUS_COMMERRORS_HOMELOCATION=3, AHRSSTATUS_COMMERRORS_CALIBRATION=4 } AhrsStatusCommErrorsElem; diff --git a/flight/PiOS/inc/pios_opahrs_proto.h b/flight/PiOS/inc/pios_opahrs_proto.h index f1b9aeef0..a66a87402 100644 --- a/flight/PiOS/inc/pios_opahrs_proto.h +++ b/flight/PiOS/inc/pios_opahrs_proto.h @@ -211,8 +211,10 @@ struct opahrs_msg_v1_req_update { struct opahrs_msg_v1_req_attituderaw { } __attribute__((__packed__)); +enum measure_mode {AHRS_SET, AHRS_MEASURE, AHRS_ECHO}; + struct opahrs_msg_v1_req_calibration { - uint8_t measure_var; + enum measure_mode measure_var; uint16_t accel_bias[3]; float accel_scale[3]; float accel_var[3]; @@ -293,6 +295,7 @@ struct opahrs_msg_v1_rsp_update { } quaternion; float NED[3]; float Vel[3]; + uint8_t load; } __attribute__((__packed__)); struct opahrs_msg_v1_rsp_calibration { diff --git a/ground/src/experimental/SerialLogger/main.cpp b/ground/src/experimental/SerialLogger/main.cpp index 1d835d68f..b54f37c89 100644 --- a/ground/src/experimental/SerialLogger/main.cpp +++ b/ground/src/experimental/SerialLogger/main.cpp @@ -40,7 +40,7 @@ public: while(1) { - dat = serialPort.read(10); + dat = serialPort.read(100); qDebug() << dat; ts << dat; } diff --git a/ground/src/plugins/config/ahrs.ui b/ground/src/plugins/config/ahrs.ui index 17d5f17ae..2cd0ee630 100644 --- a/ground/src/plugins/config/ahrs.ui +++ b/ground/src/plugins/config/ahrs.ui @@ -165,45 +165,13 @@ Takes about 30 seconds max. 220 - 290 + 250 111 27 - Save Position - - - - - false - - - - 220 - 320 - 111 - 27 - - - - Compute - - - - - false - - - - 220 - 260 - 111 - 27 - - - - Cal Mode + Six Point Cal diff --git a/ground/src/plugins/config/configahrswidget.cpp b/ground/src/plugins/config/configahrswidget.cpp index 06892daf6..7af4b76ca 100644 --- a/ground/src/plugins/config/configahrswidget.cpp +++ b/ground/src/plugins/config/configahrswidget.cpp @@ -163,7 +163,7 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent) mag_z->setPos(startX,startY); mag_z->setTransform(QTransform::fromScale(1,0),true); - position = 0; + position = -1; // Fill the dropdown menus: UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSSettings"))); @@ -177,8 +177,6 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent) connect(m_ahrs->ahrsSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveRAM())); connect(m_ahrs->ahrsSettingsSaveSD, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveSD())); connect(m_ahrs->ahrsSavePosition, SIGNAL(clicked()), this, SLOT(savePositionData())); - connect(m_ahrs->ahrsComputeScaleBias, SIGNAL(clicked()), this, SLOT(computeScaleBias())); - connect(m_ahrs->ahrsCalibrationMode, SIGNAL(clicked()), this, SLOT(calibrationMode())); connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest())); @@ -204,12 +202,12 @@ void ConfigAHRSWidget::showEvent(QShowEvent *event) */ void ConfigAHRSWidget::launchAHRSCalibration() { - m_ahrs->calibInstructions->setText("Calibration launched..."); + m_ahrs->calibInstructions->setText("Estimating sensor variance..."); m_ahrs->ahrsCalibStart->setEnabled(false); UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); UAVObjectField *field = obj->getField(QString("measure_var")); - field->setValue("TRUE"); + field->setValue("MEASURE"); obj->updated(); QTimer::singleShot(calibrationDelay*1000, this, SLOT(calibPhase2())); @@ -245,42 +243,19 @@ void ConfigAHRSWidget::incrementProgress() void ConfigAHRSWidget::calibPhase2() { UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); + UAVObjectField *field = obj->getField(QString("measure_var")); - // This is a bit weird, but it is because we are expecting an update from the - // OP board with the correct calibration values, and those only arrive on the object update - // which comes back from the board, and not the first object update signal which is in fast - // the object update we did ourselves... Clear ? - switch (phaseCounter) { - case 0: - phaseCounter++; - m_ahrs->calibInstructions->setText("Getting results..."); - connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(calibPhase2())); - obj->updated(); - break; - case 1: // this is where we end up with the update just above - phaseCounter++; - break; - case 2: { // This is the update with the right values (coming from the board) - disconnect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(calibPhase2())); - // Now update size of all the graphs - drawVariancesGraph(); + // We need to echo back the results of calibration before changing to set mode + m_ahrs->calibInstructions->setText("Getting results..."); + field->setValue("ECHO"); + obj->updated(); - // Now wait 15 more seconds before re-enabling the "Save" button - QTimer::singleShot(calibrationDelay*1000, this, SLOT(calibPhase2())); - m_ahrs->calibInstructions->setText(QString("Saving the results...")); - progressBarIndex = 0; - phaseCounter++; - } - break; - - case 3: // This step saves the configuration. - saveAHRSCalibration(); - m_ahrs->calibInstructions->setText(QString("Calibration saved.")); - m_ahrs->ahrsCalibStart->setEnabled(true); - break; - - } + // Now update size of all the graphs + drawVariancesGraph(); + saveAHRSCalibration(); + m_ahrs->calibInstructions->setText(QString("Calibration saved.")); + m_ahrs->ahrsCalibStart->setEnabled(true); } /** @@ -290,7 +265,7 @@ void ConfigAHRSWidget::saveAHRSCalibration() { UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); UAVObjectField *field = obj->getField(QString("measure_var")); - field->setValue("FALSE"); + field->setValue("SET"); obj->updated(); updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); @@ -300,7 +275,15 @@ void ConfigAHRSWidget::saveAHRSCalibration() * Saves the data from the aircraft in one of six positions */ void ConfigAHRSWidget::savePositionData() -{ +{ + if(position < 0) + { + calibrationMode(); + m_ahrs->calibInstructions->setText("Place horizontally and click save position..."); + position = 0; + return; + } + UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AttitudeRaw"))); UAVObjectField *accel_field = obj->getField(QString("accels_filtered")); UAVObjectField *mag_field = obj->getField(QString("magnetometers")); @@ -313,6 +296,18 @@ void ConfigAHRSWidget::savePositionData() mag_data_z[position] = mag_field->getValue(2).toDouble(); position = (position + 1) % 6; + if(position == 1) + m_ahrs->calibInstructions->setText("Place with left side down and click save position..."); + if(position == 2) + m_ahrs->calibInstructions->setText("Place upside down and click save position..."); + if(position == 3) + m_ahrs->calibInstructions->setText("Place with right side down and click save position..."); + if(position == 4) + m_ahrs->calibInstructions->setText("Place with nose up and click save position..."); + if(position == 5) + m_ahrs->calibInstructions->setText("Place with nose down and click save position..."); + if(position == 0) + computeScaleBias(); } //***************************************************************** @@ -442,12 +437,17 @@ void ConfigAHRSWidget::computeScaleBias() field->setDouble(b[2] / S[2], 2); obj->updated(); + position = -1; //set to run again + m_ahrs->calibInstructions->setText("Computed accel and mag scale and bias..."); + } void ConfigAHRSWidget::calibrationMode() { UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); + m_ahrs->calibInstructions->setText("Now place in the horizontal position..."); + // set accels to unity gain UAVObjectField *field = obj->getField(QString("accel_scale")); field->setDouble(1,0); @@ -513,8 +513,6 @@ void ConfigAHRSWidget::ahrsSettingsRequest() drawVariancesGraph(); m_ahrs->ahrsCalibStart->setEnabled(true); m_ahrs->ahrsSavePosition->setEnabled(true); - m_ahrs->ahrsComputeScaleBias->setEnabled(true); - m_ahrs->ahrsCalibrationMode->setEnabled(true); m_ahrs->calibInstructions->setText(QString("Press \"Start\" above to calibrate.")); } diff --git a/ground/src/plugins/uavobjects/ahrscalibration.cpp b/ground/src/plugins/uavobjects/ahrscalibration.cpp index 000339a52..8112b4a84 100644 --- a/ground/src/plugins/uavobjects/ahrscalibration.cpp +++ b/ground/src/plugins/uavobjects/ahrscalibration.cpp @@ -45,8 +45,9 @@ AHRSCalibration::AHRSCalibration(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTING QStringList measure_varElemNames; measure_varElemNames.append("0"); QStringList measure_varEnumOptions; - measure_varEnumOptions.append("FALSE"); - measure_varEnumOptions.append("TRUE"); + measure_varEnumOptions.append("SET"); + measure_varEnumOptions.append("MEASURE"); + measure_varEnumOptions.append("ECHO"); fields.append( new UAVObjectField(QString("measure_var"), QString(""), UAVObjectField::ENUM, measure_varElemNames, measure_varEnumOptions) ); QStringList accel_biasElemNames; accel_biasElemNames.append("X"); diff --git a/ground/src/plugins/uavobjects/ahrscalibration.h b/ground/src/plugins/uavobjects/ahrscalibration.h index ef8b740ef..7004e111c 100644 --- a/ground/src/plugins/uavobjects/ahrscalibration.h +++ b/ground/src/plugins/uavobjects/ahrscalibration.h @@ -58,7 +58,7 @@ public: // Field information // Field measure_var information /* Enumeration options for field measure_var */ - typedef enum { MEASURE_VAR_FALSE=0, MEASURE_VAR_TRUE=1 } measure_varOptions; + typedef enum { MEASURE_VAR_SET=0, MEASURE_VAR_MEASURE=1, MEASURE_VAR_ECHO=2 } measure_varOptions; // Field accel_bias information /* Array element names for field accel_bias */ typedef enum { ACCEL_BIAS_X=0, ACCEL_BIAS_Y=1, ACCEL_BIAS_Z=2 } accel_biasElem; diff --git a/ground/src/plugins/uavobjects/ahrscalibration.py b/ground/src/plugins/uavobjects/ahrscalibration.py index 173dc52ab..856aa40f0 100644 --- a/ground/src/plugins/uavobjects/ahrscalibration.py +++ b/ground/src/plugins/uavobjects/ahrscalibration.py @@ -45,8 +45,9 @@ _fields = [ \ '0', ], { - '0' : 'FALSE', - '1' : 'TRUE', + '0' : 'SET', + '1' : 'MEASURE', + '2' : 'ECHO', } ), uavobject.UAVObjectField( diff --git a/ground/src/plugins/uavobjects/ahrsstatus.cpp b/ground/src/plugins/uavobjects/ahrsstatus.cpp index 2b5f49af6..bdc08b3e2 100644 --- a/ground/src/plugins/uavobjects/ahrsstatus.cpp +++ b/ground/src/plugins/uavobjects/ahrsstatus.cpp @@ -69,6 +69,9 @@ AhrsStatus::AhrsStatus(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) SerialNumberElemNames.append("23"); SerialNumberElemNames.append("24"); fields.append( new UAVObjectField(QString("SerialNumber"), QString("n/a"), UAVObjectField::UINT8, SerialNumberElemNames, QStringList()) ); + QStringList CPULoadElemNames; + CPULoadElemNames.append("0"); + fields.append( new UAVObjectField(QString("CPULoad"), QString("count"), UAVObjectField::UINT8, CPULoadElemNames, QStringList()) ); QStringList CommErrorsElemNames; CommErrorsElemNames.append("Algorithm"); CommErrorsElemNames.append("Update"); diff --git a/ground/src/plugins/uavobjects/ahrsstatus.h b/ground/src/plugins/uavobjects/ahrsstatus.h index 611a66655..14eb6b13d 100644 --- a/ground/src/plugins/uavobjects/ahrsstatus.h +++ b/ground/src/plugins/uavobjects/ahrsstatus.h @@ -44,6 +44,7 @@ public: // Field structure typedef struct { quint8 SerialNumber[25]; + quint8 CPULoad; quint8 CommErrors[5]; quint8 AlgorithmSet; quint8 CalibrationSet; @@ -55,6 +56,7 @@ public: // Field SerialNumber information /* Number of elements for field SerialNumber */ static const quint32 SERIALNUMBER_NUMELEM = 25; + // Field CPULoad information // Field CommErrors information /* Array element names for field CommErrors */ typedef enum { COMMERRORS_ALGORITHM=0, COMMERRORS_UPDATE=1, COMMERRORS_ATTITUDERAW=2, COMMERRORS_HOMELOCATION=3, COMMERRORS_CALIBRATION=4 } CommErrorsElem; @@ -72,7 +74,7 @@ public: // Constants - static const quint32 OBJID = 842145078U; + static const quint32 OBJID = 3393301276U; static const QString NAME; static const bool ISSINGLEINST = 1; static const bool ISSETTINGS = 0; diff --git a/ground/src/plugins/uavobjects/ahrsstatus.py b/ground/src/plugins/uavobjects/ahrsstatus.py index 5ff403006..dd4fc4f78 100644 --- a/ground/src/plugins/uavobjects/ahrsstatus.py +++ b/ground/src/plugins/uavobjects/ahrsstatus.py @@ -71,6 +71,16 @@ _fields = [ \ { } ), + uavobject.UAVObjectField( + 'CPULoad', + 'B', + 1, + [ + '0', + ], + { + } + ), uavobject.UAVObjectField( 'CommErrors', 'B', @@ -126,7 +136,7 @@ _fields = [ \ class AhrsStatus(uavobject.UAVObject): ## Object constants - OBJID = 842145078 + OBJID = 3393301276 NAME = "AhrsStatus" METANAME = "AhrsStatusMeta" ISSINGLEINST = 1 diff --git a/ground/src/shared/uavobjectdefinition/ahrscalibration.xml b/ground/src/shared/uavobjectdefinition/ahrscalibration.xml index c8b2066a2..5936fab47 100644 --- a/ground/src/shared/uavobjectdefinition/ahrscalibration.xml +++ b/ground/src/shared/uavobjectdefinition/ahrscalibration.xml @@ -1,7 +1,7 @@ Contains the calibration settings for the @ref AHRSCommsModule - + diff --git a/ground/src/shared/uavobjectdefinition/ahrsstatus.xml b/ground/src/shared/uavobjectdefinition/ahrsstatus.xml index f435fadab..11568d370 100644 --- a/ground/src/shared/uavobjectdefinition/ahrsstatus.xml +++ b/ground/src/shared/uavobjectdefinition/ahrsstatus.xml @@ -2,6 +2,7 @@ Status for the @ref AHRSCommsModule, including communication errors +