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

baroaltitude: rename AltitudeActual to BaroAltitude

This is to align the object names to matches the UAVObject
architecture doc.  No functional changes.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1351 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
stac 2010-08-21 16:19:10 +00:00 committed by stac
parent 47c36b3da0
commit 7b2111e512
22 changed files with 586 additions and 586 deletions

View File

@ -162,7 +162,7 @@ SRC += $(OPUAVOBJ)/manualcontrolsettings.c
SRC += $(OPUAVOBJ)/attitudedesired.c
SRC += $(OPUAVOBJ)/stabilizationsettings.c
SRC += $(OPUAVOBJ)/ahrsstatus.c
SRC += $(OPUAVOBJ)/altitudeactual.c
SRC += $(OPUAVOBJ)/baroaltitude.c
SRC += $(OPUAVOBJ)/attitudeactual.c
SRC += $(OPUAVOBJ)/attitudesettings.c
SRC += $(OPUAVOBJ)/flightsituationactual.c

View File

@ -1,347 +1,347 @@
/**
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup AHRSCommsModule AHRSComms Module
* @brief Handles communication with AHRS and updating position
* Specifically updates the the @ref AttitudeActual "AttitudeActual" and @ref AttitudeRaw "AttitudeRaw" settings objects
* @{
*
* @file ahrs_comms.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Module to handle all comms to the AHRS on a periodic basis.
*
* @see The GNU Public License (GPL) Version 3
*
******************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Input object: AttitudeSettings
* Output object: AttitudeActual
*
* This module will periodically update the value of latest attitude solution
* that is available from the AHRS.
* The module settings can configure how often AHRS is polled for a new solution.
*
* The module executes in its own thread.
*
* UAVObjects are automatically generated by the UAVObjectGenerator from
* the object definition XML file.
*
* Modules have no API, all communication to other modules is done through UAVObjects.
* However modules may use the API exposed by shared libraries.
* See the OpenPilot wiki for more details.
* http://www.openpilot.org/OpenPilot_Application_Architecture
*
*/
#include "ahrs_comms.h"
#include "attitudeactual.h"
#include "attitudesettings.h"
#include "attituderaw.h"
#include "ahrsstatus.h"
#include "alarms.h"
#include "altitudeactual.h"
#include "stdbool.h"
#include "positionactual.h"
#include "homelocation.h"
#include "pios_opahrs.h" // library for OpenPilot AHRS access functions
#include "pios_opahrs_proto.h"
// Private constants
#define STACK_SIZE 400
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
// Private types
// Private variables
static xTaskHandle taskHandle;
// Private functions
static void ahrscommsTask(void* parameters);
static void load_altitude_actual(struct opahrs_msg_v1_req_altitude * altitude);
static void load_magnetic_north(struct opahrs_msg_v1_req_north * north);
static void load_position_actual(struct opahrs_msg_v1_req_gps * gps);
static void update_attitude_actual(struct opahrs_msg_v1_rsp_attitude * attitude);
static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw);
static void update_ahrs_status(struct opahrs_msg_v1_rsp_serial * serial);
static bool AltitudeActualIsUpdatedFlag = false;
static void AltitudeActualUpdatedCb(UAVObjEvent * ev)
{
AltitudeActualIsUpdatedFlag = true;
}
static bool PositionActualIsUpdatedFlag = false;
static void PositionActualUpdatedCb(UAVObjEvent * ev)
{
PositionActualIsUpdatedFlag = true;
}
static bool HomeLocationIsUpdatedFlag = false;
static void HomeLocationUpdatedCb(UAVObjEvent * ev)
{
HomeLocationIsUpdatedFlag = true;
}
static bool AHRSKnowsHome = FALSE;
/**
* Initialise the module, called on startup
* \returns 0 on success or -1 if initialisation failed
*/
int32_t AHRSCommsInitialize(void)
{
AltitudeActualConnectCallback(AltitudeActualUpdatedCb);
PositionActualConnectCallback(PositionActualUpdatedCb);
HomeLocationConnectCallback(HomeLocationUpdatedCb);
PIOS_OPAHRS_Init();
// Start main task
xTaskCreate(ahrscommsTask, (signed char*)"AHRSComms", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
return 0;
}
static uint16_t attitude_errors = 0, attituderaw_errors = 0, position_errors = 0, home_errors = 0, altitude_errors = 0;
/**
* Module thread, should not return.
*/
static void ahrscommsTask(void* parameters)
{
enum opahrs_result result;
// Main task loop
while (1) {
struct opahrs_msg_v1 rsp;
AlarmsSet(SYSTEMALARMS_ALARM_AHRSCOMMS, SYSTEMALARMS_ALARM_CRITICAL);
/* Whenever resyncing, assume AHRS doesn't reset and doesn't know home */
AHRSKnowsHome = FALSE;
/* Spin here until we're in sync */
while (PIOS_OPAHRS_resync() != OPAHRS_RESULT_OK) {
vTaskDelay(100 / portTICK_RATE_MS);
}
/* Give the other side a chance to keep up */
//vTaskDelay(100 / portTICK_RATE_MS);
if (PIOS_OPAHRS_GetSerial(&rsp) == OPAHRS_RESULT_OK) {
update_ahrs_status(&(rsp.payload.user.v.rsp.serial));
} else {
/* Comms error */
continue;
}
AlarmsClear(SYSTEMALARMS_ALARM_AHRSCOMMS);
/* We're in sync with the AHRS, spin here until an error occurs */
while (1) {
AttitudeSettingsData settings;
/* Update settings with latest value */
AttitudeSettingsGet(&settings);
if ((result = PIOS_OPAHRS_GetAttitude(&rsp)) == OPAHRS_RESULT_OK) {
update_attitude_actual(&(rsp.payload.user.v.rsp.attitude));
} else {
/* Comms error */
attitude_errors++;
break;
}
if ((result = PIOS_OPAHRS_GetAttitudeRaw(&rsp)) == OPAHRS_RESULT_OK) {
update_attitude_raw(&(rsp.payload.user.v.rsp.attituderaw));
} else {
/* Comms error */
attituderaw_errors++;
break;
}
if (AltitudeActualIsUpdatedFlag) {
struct opahrs_msg_v1 req;
load_altitude_actual(&(req.payload.user.v.req.altitude));
if ((result = PIOS_OPAHRS_SetAltitudeActual(&req)) == OPAHRS_RESULT_OK) {
AltitudeActualIsUpdatedFlag = false;
} else {
/* Comms error */
altitude_errors++;
break;
}
}
if (PositionActualIsUpdatedFlag) {
struct opahrs_msg_v1 req;
load_position_actual(&(req.payload.user.v.req.gps));
if ((result = PIOS_OPAHRS_SetPositionActual(&req)) == OPAHRS_RESULT_OK) {
PositionActualIsUpdatedFlag = false;
} else {
/* Comms error */
position_errors++;
break;
}
}
if (HomeLocationIsUpdatedFlag || !AHRSKnowsHome) {
struct opahrs_msg_v1 req;
load_magnetic_north(&(req.payload.user.v.req.north));
if ((result = PIOS_OPAHRS_SetMagNorth(&req)) == OPAHRS_RESULT_OK) {
HomeLocationIsUpdatedFlag = false;
AHRSKnowsHome = TRUE;
} else {
/* Comms error */
PIOS_LED_Off(LED2);
home_errors++;
break;
}
}
/* Wait for the next update interval */
vTaskDelay( settings.UpdatePeriod / portTICK_RATE_MS );
}
}
}
static void load_magnetic_north(struct opahrs_msg_v1_req_north * mag_north)
{
HomeLocationData data;
HomeLocationGet(&data);
mag_north->Be[0] = data.Be[0];
mag_north->Be[1] = data.Be[1];
mag_north->Be[2] = data.Be[2];
if(data.Be[0] == 0 && data.Be[1] == 0 && data.Be[2] == 0)
{
// in case nothing has been set go to default to prevent NaN in attitude solution
mag_north->Be[0] = 1;
mag_north->Be[1] = 0;
mag_north->Be[2] = 0;
}
else {
// normalize for unit length here
float len = sqrt(data.Be[0] * data.Be[0] + data.Be[1] * data.Be[1] + data.Be[2] * data.Be[2]);
mag_north->Be[0] = data.Be[0] / len;
mag_north->Be[1] = data.Be[1] / len;
mag_north->Be[2] = data.Be[2] / len;
}
}
static void load_altitude_actual(struct opahrs_msg_v1_req_altitude * altitude)
{
AltitudeActualData data;
AltitudeActualGet(&data);
altitude->altitude = data.Altitude;
altitude->pressure = data.Pressure;
altitude->temperature = data.Temperature;
}
static void load_position_actual(struct opahrs_msg_v1_req_gps * gps)
{
PositionActualData data;
PositionActualGet(&data);
gps->latitude = data.Latitude;
gps->longitude = data.Longitude;
gps->altitude = data.GeoidSeparation;
gps->heading = data.Heading;
gps->groundspeed = data.Groundspeed;
gps->status = data.Status;
}
static void update_attitude_actual(struct opahrs_msg_v1_rsp_attitude * attitude)
{
AttitudeActualData data;
data.q1 = attitude->quaternion.q1;
data.q2 = attitude->quaternion.q2;
data.q3 = attitude->quaternion.q3;
data.q4 = attitude->quaternion.q4;
data.Roll = attitude->euler.roll;
data.Pitch = attitude->euler.pitch;
data.Yaw = attitude->euler.yaw;
AttitudeActualSet(&data);
}
static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw)
{
AttitudeRawData data;
data.magnetometers[ATTITUDERAW_MAGNETOMETERS_X] = attituderaw->mags.x;
data.magnetometers[ATTITUDERAW_MAGNETOMETERS_Y] = attituderaw->mags.y;
data.magnetometers[ATTITUDERAW_MAGNETOMETERS_Z] = attituderaw->mags.z;
data.gyros[ATTITUDERAW_GYROS_X] = attituderaw->gyros.x;
data.gyros[ATTITUDERAW_GYROS_Y] = attituderaw->gyros.y;
data.gyros[ATTITUDERAW_GYROS_Z] = attituderaw->gyros.z;
data.gyros_filtered[ATTITUDERAW_GYROS_FILTERED_X] = attituderaw->gyros_filtered.x;
data.gyros_filtered[ATTITUDERAW_GYROS_FILTERED_Y] = attituderaw->gyros_filtered.y;
data.gyros_filtered[ATTITUDERAW_GYROS_FILTERED_Z] = attituderaw->gyros_filtered.z;
data.gyrotemp[ATTITUDERAW_GYROTEMP_XY] = attituderaw->gyros.xy_temp;
data.gyrotemp[ATTITUDERAW_GYROTEMP_Z] = attituderaw->gyros.z_temp;
data.accels[ATTITUDERAW_ACCELS_X] = attituderaw->accels.x;
data.accels[ATTITUDERAW_ACCELS_Y] = attituderaw->accels.y;
data.accels[ATTITUDERAW_ACCELS_Z] = attituderaw->accels.z;
data.accels_filtered[ATTITUDERAW_ACCELS_FILTERED_X] = attituderaw->accels_filtered.x;
data.accels_filtered[ATTITUDERAW_ACCELS_FILTERED_Y] = attituderaw->accels_filtered.y;
data.accels_filtered[ATTITUDERAW_ACCELS_FILTERED_Z] = attituderaw->accels_filtered.z;
AttitudeRawSet(&data);
}
static void update_ahrs_status(struct opahrs_msg_v1_rsp_serial * serial)
{
AhrsStatusData data;
// Get the current object data
AhrsStatusGet(&data);
for (uint8_t i = 0; i < sizeof(serial->serial_bcd); i++) {
data.SerialNumber[i] = serial->serial_bcd[i];
}
data.CommErrors[AHRSSTATUS_COMMERRORS_ATTITUDE] = attitude_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_ATTITUDERAW] = attituderaw_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_POSITIONACTUAL] = position_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_HOMELOCATION] = home_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_ALTITUDE] = altitude_errors;
AhrsStatusSet(&data);
}
/**
* @}
* @}
*/
/**
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup AHRSCommsModule AHRSComms Module
* @brief Handles communication with AHRS and updating position
* Specifically updates the the @ref AttitudeActual "AttitudeActual" and @ref AttitudeRaw "AttitudeRaw" settings objects
* @{
*
* @file ahrs_comms.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Module to handle all comms to the AHRS on a periodic basis.
*
* @see The GNU Public License (GPL) Version 3
*
******************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Input object: AttitudeSettings
* Output object: AttitudeActual
*
* This module will periodically update the value of latest attitude solution
* that is available from the AHRS.
* The module settings can configure how often AHRS is polled for a new solution.
*
* The module executes in its own thread.
*
* UAVObjects are automatically generated by the UAVObjectGenerator from
* the object definition XML file.
*
* Modules have no API, all communication to other modules is done through UAVObjects.
* However modules may use the API exposed by shared libraries.
* See the OpenPilot wiki for more details.
* http://www.openpilot.org/OpenPilot_Application_Architecture
*
*/
#include "ahrs_comms.h"
#include "attitudeactual.h"
#include "attitudesettings.h"
#include "attituderaw.h"
#include "ahrsstatus.h"
#include "alarms.h"
#include "baroaltitude.h"
#include "stdbool.h"
#include "positionactual.h"
#include "homelocation.h"
#include "pios_opahrs.h" // library for OpenPilot AHRS access functions
#include "pios_opahrs_proto.h"
// Private constants
#define STACK_SIZE 400
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
// Private types
// Private variables
static xTaskHandle taskHandle;
// Private functions
static void ahrscommsTask(void* parameters);
static void load_baro_altitude(struct opahrs_msg_v1_req_altitude * altitude);
static void load_magnetic_north(struct opahrs_msg_v1_req_north * north);
static void load_position_actual(struct opahrs_msg_v1_req_gps * gps);
static void update_attitude_actual(struct opahrs_msg_v1_rsp_attitude * attitude);
static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw);
static void update_ahrs_status(struct opahrs_msg_v1_rsp_serial * serial);
static bool BaroAltitudeIsUpdatedFlag = false;
static void BaroAltitudeUpdatedCb(UAVObjEvent * ev)
{
BaroAltitudeIsUpdatedFlag = true;
}
static bool PositionActualIsUpdatedFlag = false;
static void PositionActualUpdatedCb(UAVObjEvent * ev)
{
PositionActualIsUpdatedFlag = true;
}
static bool HomeLocationIsUpdatedFlag = false;
static void HomeLocationUpdatedCb(UAVObjEvent * ev)
{
HomeLocationIsUpdatedFlag = true;
}
static bool AHRSKnowsHome = FALSE;
/**
* Initialise the module, called on startup
* \returns 0 on success or -1 if initialisation failed
*/
int32_t AHRSCommsInitialize(void)
{
BaroAltitudeConnectCallback(BaroAltitudeUpdatedCb);
PositionActualConnectCallback(PositionActualUpdatedCb);
HomeLocationConnectCallback(HomeLocationUpdatedCb);
PIOS_OPAHRS_Init();
// Start main task
xTaskCreate(ahrscommsTask, (signed char*)"AHRSComms", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
return 0;
}
static uint16_t attitude_errors = 0, attituderaw_errors = 0, position_errors = 0, home_errors = 0, altitude_errors = 0;
/**
* Module thread, should not return.
*/
static void ahrscommsTask(void* parameters)
{
enum opahrs_result result;
// Main task loop
while (1) {
struct opahrs_msg_v1 rsp;
AlarmsSet(SYSTEMALARMS_ALARM_AHRSCOMMS, SYSTEMALARMS_ALARM_CRITICAL);
/* Whenever resyncing, assume AHRS doesn't reset and doesn't know home */
AHRSKnowsHome = FALSE;
/* Spin here until we're in sync */
while (PIOS_OPAHRS_resync() != OPAHRS_RESULT_OK) {
vTaskDelay(100 / portTICK_RATE_MS);
}
/* Give the other side a chance to keep up */
//vTaskDelay(100 / portTICK_RATE_MS);
if (PIOS_OPAHRS_GetSerial(&rsp) == OPAHRS_RESULT_OK) {
update_ahrs_status(&(rsp.payload.user.v.rsp.serial));
} else {
/* Comms error */
continue;
}
AlarmsClear(SYSTEMALARMS_ALARM_AHRSCOMMS);
/* We're in sync with the AHRS, spin here until an error occurs */
while (1) {
AttitudeSettingsData settings;
/* Update settings with latest value */
AttitudeSettingsGet(&settings);
if ((result = PIOS_OPAHRS_GetAttitude(&rsp)) == OPAHRS_RESULT_OK) {
update_attitude_actual(&(rsp.payload.user.v.rsp.attitude));
} else {
/* Comms error */
attitude_errors++;
break;
}
if ((result = PIOS_OPAHRS_GetAttitudeRaw(&rsp)) == OPAHRS_RESULT_OK) {
update_attitude_raw(&(rsp.payload.user.v.rsp.attituderaw));
} else {
/* Comms error */
attituderaw_errors++;
break;
}
if (BaroAltitudeIsUpdatedFlag) {
struct opahrs_msg_v1 req;
load_baro_altitude(&(req.payload.user.v.req.altitude));
if ((result = PIOS_OPAHRS_SetBaroAltitude(&req)) == OPAHRS_RESULT_OK) {
BaroAltitudeIsUpdatedFlag = false;
} else {
/* Comms error */
altitude_errors++;
break;
}
}
if (PositionActualIsUpdatedFlag) {
struct opahrs_msg_v1 req;
load_position_actual(&(req.payload.user.v.req.gps));
if ((result = PIOS_OPAHRS_SetPositionActual(&req)) == OPAHRS_RESULT_OK) {
PositionActualIsUpdatedFlag = false;
} else {
/* Comms error */
position_errors++;
break;
}
}
if (HomeLocationIsUpdatedFlag || !AHRSKnowsHome) {
struct opahrs_msg_v1 req;
load_magnetic_north(&(req.payload.user.v.req.north));
if ((result = PIOS_OPAHRS_SetMagNorth(&req)) == OPAHRS_RESULT_OK) {
HomeLocationIsUpdatedFlag = false;
AHRSKnowsHome = TRUE;
} else {
/* Comms error */
PIOS_LED_Off(LED2);
home_errors++;
break;
}
}
/* Wait for the next update interval */
vTaskDelay( settings.UpdatePeriod / portTICK_RATE_MS );
}
}
}
static void load_magnetic_north(struct opahrs_msg_v1_req_north * mag_north)
{
HomeLocationData data;
HomeLocationGet(&data);
mag_north->Be[0] = data.Be[0];
mag_north->Be[1] = data.Be[1];
mag_north->Be[2] = data.Be[2];
if(data.Be[0] == 0 && data.Be[1] == 0 && data.Be[2] == 0)
{
// in case nothing has been set go to default to prevent NaN in attitude solution
mag_north->Be[0] = 1;
mag_north->Be[1] = 0;
mag_north->Be[2] = 0;
}
else {
// normalize for unit length here
float len = sqrt(data.Be[0] * data.Be[0] + data.Be[1] * data.Be[1] + data.Be[2] * data.Be[2]);
mag_north->Be[0] = data.Be[0] / len;
mag_north->Be[1] = data.Be[1] / len;
mag_north->Be[2] = data.Be[2] / len;
}
}
static void load_baro_altitude(struct opahrs_msg_v1_req_altitude * altitude)
{
BaroAltitudeData data;
BaroAltitudeGet(&data);
altitude->altitude = data.Altitude;
altitude->pressure = data.Pressure;
altitude->temperature = data.Temperature;
}
static void load_position_actual(struct opahrs_msg_v1_req_gps * gps)
{
PositionActualData data;
PositionActualGet(&data);
gps->latitude = data.Latitude;
gps->longitude = data.Longitude;
gps->altitude = data.GeoidSeparation;
gps->heading = data.Heading;
gps->groundspeed = data.Groundspeed;
gps->status = data.Status;
}
static void update_attitude_actual(struct opahrs_msg_v1_rsp_attitude * attitude)
{
AttitudeActualData data;
data.q1 = attitude->quaternion.q1;
data.q2 = attitude->quaternion.q2;
data.q3 = attitude->quaternion.q3;
data.q4 = attitude->quaternion.q4;
data.Roll = attitude->euler.roll;
data.Pitch = attitude->euler.pitch;
data.Yaw = attitude->euler.yaw;
AttitudeActualSet(&data);
}
static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw)
{
AttitudeRawData data;
data.magnetometers[ATTITUDERAW_MAGNETOMETERS_X] = attituderaw->mags.x;
data.magnetometers[ATTITUDERAW_MAGNETOMETERS_Y] = attituderaw->mags.y;
data.magnetometers[ATTITUDERAW_MAGNETOMETERS_Z] = attituderaw->mags.z;
data.gyros[ATTITUDERAW_GYROS_X] = attituderaw->gyros.x;
data.gyros[ATTITUDERAW_GYROS_Y] = attituderaw->gyros.y;
data.gyros[ATTITUDERAW_GYROS_Z] = attituderaw->gyros.z;
data.gyros_filtered[ATTITUDERAW_GYROS_FILTERED_X] = attituderaw->gyros_filtered.x;
data.gyros_filtered[ATTITUDERAW_GYROS_FILTERED_Y] = attituderaw->gyros_filtered.y;
data.gyros_filtered[ATTITUDERAW_GYROS_FILTERED_Z] = attituderaw->gyros_filtered.z;
data.gyrotemp[ATTITUDERAW_GYROTEMP_XY] = attituderaw->gyros.xy_temp;
data.gyrotemp[ATTITUDERAW_GYROTEMP_Z] = attituderaw->gyros.z_temp;
data.accels[ATTITUDERAW_ACCELS_X] = attituderaw->accels.x;
data.accels[ATTITUDERAW_ACCELS_Y] = attituderaw->accels.y;
data.accels[ATTITUDERAW_ACCELS_Z] = attituderaw->accels.z;
data.accels_filtered[ATTITUDERAW_ACCELS_FILTERED_X] = attituderaw->accels_filtered.x;
data.accels_filtered[ATTITUDERAW_ACCELS_FILTERED_Y] = attituderaw->accels_filtered.y;
data.accels_filtered[ATTITUDERAW_ACCELS_FILTERED_Z] = attituderaw->accels_filtered.z;
AttitudeRawSet(&data);
}
static void update_ahrs_status(struct opahrs_msg_v1_rsp_serial * serial)
{
AhrsStatusData data;
// Get the current object data
AhrsStatusGet(&data);
for (uint8_t i = 0; i < sizeof(serial->serial_bcd); i++) {
data.SerialNumber[i] = serial->serial_bcd[i];
}
data.CommErrors[AHRSSTATUS_COMMERRORS_ATTITUDE] = attitude_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_ATTITUDERAW] = attituderaw_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_POSITIONACTUAL] = position_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_HOMELOCATION] = home_errors;
data.CommErrors[AHRSSTATUS_COMMERRORS_ALTITUDE] = altitude_errors;
AhrsStatusSet(&data);
}
/**
* @}
* @}
*/

View File

@ -3,7 +3,7 @@
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup AltitudeModule Altitude Module
* @brief Communicate with BMP085 and update @ref AltitudeActual "AltitudeActual UAV Object"
* @brief Communicate with BMP085 and update @ref BaroAltitude "BaroAltitude UAV Object"
* @{
*
* @file altitude.c
@ -30,14 +30,14 @@
*/
/**
* Output object: AltitudeActual
* Output object: BaroAltitude
*
* This module will periodically update the value of the AltitudeActual object.
* This module will periodically update the value of the BaroAltitude object.
*
*/
#include "openpilot.h"
#include "altitudeactual.h" // object that will be updated by the module
#include "baroaltitude.h" // object that will be updated by the module
// Private constants
#define STACK_SIZE configMINIMAL_STACK_SIZE
@ -69,7 +69,7 @@ int32_t AltitudeInitialize()
*/
static void altitudeTask(void* parameters)
{
AltitudeActualData data;
BaroAltitudeData data;
portTickType lastSysTime;
PIOS_BMP085_Init();
@ -104,7 +104,7 @@ static void altitudeTask(void* parameters)
data.Altitude = 44330.0 * (1.0 - powf((data.Pressure/ (BMP085_P0 / 1000.0)), (1.0/5.255)));
// Update the AltitudeActual UAVObject
AltitudeActualSet(&data);
BaroAltitudeSet(&data);
// Delay until it is time to read the next sample
vTaskDelayUntil(&lastSysTime, UPDATE_PERIOD / portTICK_RATE_MS );
@ -114,4 +114,4 @@ static void altitudeTask(void* parameters)
/**
* @}
* @}
*/
*/

View File

@ -1,12 +1,12 @@
/**
******************************************************************************
*
* @file altitudeactual.c
* @file baroaltitude.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Implementation of the AltitudeActual object. This file has been
* @brief Implementation of the BaroAltitude object. This file has been
* automatically generated by the UAVObjectGenerator.
*
* @note Object definition file: altitudeactual.xml.
* @note Object definition file: baroaltitude.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
@ -30,7 +30,7 @@
*/
#include "openpilot.h"
#include "altitudeactual.h"
#include "baroaltitude.h"
// Private variables
static UAVObjHandle handle;
@ -43,11 +43,11 @@ static void setDefaults(UAVObjHandle obj, uint16_t instId);
* \return 0 Success
* \return -1 Failure
*/
int32_t AltitudeActualInitialize()
int32_t BaroAltitudeInitialize()
{
// Register object with the object manager
handle = UAVObjRegister(ALTITUDEACTUAL_OBJID, ALTITUDEACTUAL_NAME, ALTITUDEACTUAL_METANAME, 0,
ALTITUDEACTUAL_ISSINGLEINST, ALTITUDEACTUAL_ISSETTINGS, ALTITUDEACTUAL_NUMBYTES, &setDefaults);
handle = UAVObjRegister(BAROALTITUDE_OBJID, BAROALTITUDE_NAME, BAROALTITUDE_METANAME, 0,
BAROALTITUDE_ISSINGLEINST, BAROALTITUDE_ISSETTINGS, BAROALTITUDE_NUMBYTES, &setDefaults);
// Done
if (handle != 0)
@ -67,12 +67,12 @@ int32_t AltitudeActualInitialize()
*/
static void setDefaults(UAVObjHandle obj, uint16_t instId)
{
AltitudeActualData data;
BaroAltitudeData data;
UAVObjMetadata metadata;
// Initialize object fields to their default values
UAVObjGetInstanceData(obj, instId, &data);
memset(&data, 0, sizeof(AltitudeActualData));
memset(&data, 0, sizeof(BaroAltitudeData));
UAVObjSetInstanceData(obj, instId, &data);
@ -93,7 +93,7 @@ static void setDefaults(UAVObjHandle obj, uint16_t instId)
/**
* Get object handle
*/
UAVObjHandle AltitudeActualHandle()
UAVObjHandle BaroAltitudeHandle()
{
return handle;
}

View File

@ -1,76 +0,0 @@
/**
******************************************************************************
*
* @file altitudeactual.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Implementation of the AltitudeActual object. This file has been
* automatically generated by the UAVObjectGenerator.
*
* @note Object definition file: altitudeactual.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ALTITUDEACTUAL_H
#define ALTITUDEACTUAL_H
// Object constants
#define ALTITUDEACTUAL_OBJID 2251817750U
#define ALTITUDEACTUAL_NAME "AltitudeActual"
#define ALTITUDEACTUAL_METANAME "AltitudeActualMeta"
#define ALTITUDEACTUAL_ISSINGLEINST 1
#define ALTITUDEACTUAL_ISSETTINGS 0
#define ALTITUDEACTUAL_NUMBYTES sizeof(AltitudeActualData)
// Object access macros
#define AltitudeActualGet(dataOut) UAVObjGetData(AltitudeActualHandle(), dataOut)
#define AltitudeActualSet(dataIn) UAVObjSetData(AltitudeActualHandle(), dataIn)
#define AltitudeActualInstGet(instId, dataOut) UAVObjGetInstanceData(AltitudeActualHandle(), instId, dataOut)
#define AltitudeActualInstSet(instId, dataIn) UAVObjSetInstanceData(AltitudeActualHandle(), instId, dataIn)
#define AltitudeActualConnectQueue(queue) UAVObjConnectQueue(AltitudeActualHandle(), queue, EV_MASK_ALL_UPDATES)
#define AltitudeActualConnectCallback(cb) UAVObjConnectCallback(AltitudeActualHandle(), cb, EV_MASK_ALL_UPDATES)
#define AltitudeActualCreateInstance() UAVObjCreateInstance(AltitudeActualHandle())
#define AltitudeActualRequestUpdate() UAVObjRequestUpdate(AltitudeActualHandle())
#define AltitudeActualRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(AltitudeActualHandle(), instId)
#define AltitudeActualUpdated() UAVObjUpdated(AltitudeActualHandle())
#define AltitudeActualInstUpdated(instId) UAVObjUpdated(AltitudeActualHandle(), instId)
#define AltitudeActualGetMetadata(dataOut) UAVObjGetMetadata(AltitudeActualHandle(), dataOut)
#define AltitudeActualSetMetadata(dataIn) UAVObjSetMetadata(AltitudeActualHandle(), dataIn)
// Object data
typedef struct {
float Altitude;
float Temperature;
float Pressure;
} __attribute__((packed)) AltitudeActualData;
// Field information
// Field Altitude information
// Field Temperature information
// Field Pressure information
// Generic interface functions
int32_t AltitudeActualInitialize();
UAVObjHandle AltitudeActualHandle();
#endif // ALTITUDEACTUAL_H

View File

@ -0,0 +1,76 @@
/**
******************************************************************************
*
* @file baroaltitude.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Implementation of the BaroAltitude object. This file has been
* automatically generated by the UAVObjectGenerator.
*
* @note Object definition file: baroaltitude.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BAROALTITUDE_H
#define BAROALTITUDE_H
// Object constants
#define BAROALTITUDE_OBJID 3980666102U
#define BAROALTITUDE_NAME "BaroAltitude"
#define BAROALTITUDE_METANAME "BaroAltitudeMeta"
#define BAROALTITUDE_ISSINGLEINST 1
#define BAROALTITUDE_ISSETTINGS 0
#define BAROALTITUDE_NUMBYTES sizeof(BaroAltitudeData)
// Object access macros
#define BaroAltitudeGet(dataOut) UAVObjGetData(BaroAltitudeHandle(), dataOut)
#define BaroAltitudeSet(dataIn) UAVObjSetData(BaroAltitudeHandle(), dataIn)
#define BaroAltitudeInstGet(instId, dataOut) UAVObjGetInstanceData(BaroAltitudeHandle(), instId, dataOut)
#define BaroAltitudeInstSet(instId, dataIn) UAVObjSetInstanceData(BaroAltitudeHandle(), instId, dataIn)
#define BaroAltitudeConnectQueue(queue) UAVObjConnectQueue(BaroAltitudeHandle(), queue, EV_MASK_ALL_UPDATES)
#define BaroAltitudeConnectCallback(cb) UAVObjConnectCallback(BaroAltitudeHandle(), cb, EV_MASK_ALL_UPDATES)
#define BaroAltitudeCreateInstance() UAVObjCreateInstance(BaroAltitudeHandle())
#define BaroAltitudeRequestUpdate() UAVObjRequestUpdate(BaroAltitudeHandle())
#define BaroAltitudeRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(BaroAltitudeHandle(), instId)
#define BaroAltitudeUpdated() UAVObjUpdated(BaroAltitudeHandle())
#define BaroAltitudeInstUpdated(instId) UAVObjUpdated(BaroAltitudeHandle(), instId)
#define BaroAltitudeGetMetadata(dataOut) UAVObjGetMetadata(BaroAltitudeHandle(), dataOut)
#define BaroAltitudeSetMetadata(dataIn) UAVObjSetMetadata(BaroAltitudeHandle(), dataIn)
// Object data
typedef struct {
float Altitude;
float Temperature;
float Pressure;
} __attribute__((packed)) BaroAltitudeData;
// Field information
// Field Altitude information
// Field Temperature information
// Field Pressure information
// Generic interface functions
int32_t BaroAltitudeInitialize();
UAVObjHandle BaroAltitudeHandle();
#endif // BAROALTITUDE_H

View File

@ -32,11 +32,11 @@
#include "actuatordesired.h"
#include "actuatorsettings.h"
#include "ahrsstatus.h"
#include "altitudeactual.h"
#include "attitudeactual.h"
#include "attitudedesired.h"
#include "attituderaw.h"
#include "attitudesettings.h"
#include "baroaltitude.h"
#include "exampleobject1.h"
#include "exampleobject2.h"
#include "examplesettings.h"
@ -68,11 +68,11 @@ void UAVObjectsInitializeAll()
ActuatorDesiredInitialize();
ActuatorSettingsInitialize();
AhrsStatusInitialize();
AltitudeActualInitialize();
AttitudeActualInitialize();
AttitudeDesiredInitialize();
AttitudeRawInitialize();
AttitudeSettingsInitialize();
BaroAltitudeInitialize();
ExampleObject1Initialize();
ExampleObject2Initialize();
ExampleSettingsInitialize();

View File

@ -310,7 +310,7 @@ enum opahrs_result PIOS_OPAHRS_SetPositionActual(struct opahrs_msg_v1 *req)
return opahrs_msg_v1_recv_rsp (OPAHRS_MSG_V1_RSP_GPS, &rsp);
}
enum opahrs_result PIOS_OPAHRS_SetAltitudeActual(struct opahrs_msg_v1 *req)
enum opahrs_result PIOS_OPAHRS_SetBaroAltitude(struct opahrs_msg_v1 *req)
{
struct opahrs_msg_v1 rsp;
enum opahrs_result rc;

View File

@ -43,7 +43,7 @@ extern enum opahrs_result PIOS_OPAHRS_Sync(struct opahrs_msg_v1 *rsp);
extern enum opahrs_result PIOS_OPAHRS_GetSerial(struct opahrs_msg_v1 *rsp);
extern enum opahrs_result PIOS_OPAHRS_GetAttitude(struct opahrs_msg_v1 *rsp);
extern enum opahrs_result PIOS_OPAHRS_GetAttitudeRaw(struct opahrs_msg_v1 *rsp);
extern enum opahrs_result PIOS_OPAHRS_SetAltitudeActual(struct opahrs_msg_v1 *req);
extern enum opahrs_result PIOS_OPAHRS_SetBaroAltitude(struct opahrs_msg_v1 *req);
extern enum opahrs_result PIOS_OPAHRS_SetMagNorth(struct opahrs_msg_v1 *req);
extern enum opahrs_result PIOS_OPAHRS_SetPositionActual(struct opahrs_msg_v1 *req);
extern enum opahrs_result PIOS_OPAHRS_resync(void);

View File

@ -60,7 +60,7 @@ void FlightGearBridge::onStart()
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
actDesired = ActuatorDesired::GetInstance(objManager);
altActual = AltitudeActual::GetInstance(objManager);
baroAltitude = BaroAltitude::GetInstance(objManager);
attActual = AttitudeActual::GetInstance(objManager);
posActual = PositionActual::GetInstance(objManager);
telStats = GCSTelemetryStats::GetInstance(objManager);
@ -167,7 +167,7 @@ void FlightGearBridge::receiveUpdate()
void FlightGearBridge::setupObjects()
{
setupInputObject(actDesired, 75);
setupOutputObject(altActual, 250);
setupOutputObject(baroAltitude, 250);
setupOutputObject(attActual, 75);
setupOutputObject(posActual, 250);
}
@ -267,12 +267,12 @@ void FlightGearBridge::processUpdate(QString& data)
// Get pressure (kpa)
float pressure = fields[20].toFloat() * INHG2KPA;
// Update AltitudeActual object
AltitudeActual::DataFields altActualData;
altActualData.Altitude = altitudeAGL;
altActualData.Temperature = temperature;
altActualData.Pressure = pressure;
altActual->setData(altActualData);
// Update BaroAltitude object
BaroAltitude::DataFields baroAltitudeData;
baroAltitudeData.Altitude = altitudeAGL;
baroAltitudeData.Temperature = temperature;
baroAltitudeData.Pressure = pressure;
baroAltitude->setData(baroAltitudeData);
// Update attActual object
AttitudeActual::DataFields attActualData;

View File

@ -35,7 +35,7 @@
#include "uavtalk/telemetrymanager.h"
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/actuatordesired.h"
#include "uavobjects/altitudeactual.h"
#include "uavobjects/baroaltitude.h"
#include "uavobjects/attitudeactual.h"
#include "uavobjects/positionactual.h"
#include "uavobjects/gcstelemetrystats.h"
@ -75,7 +75,7 @@ private:
QUdpSocket* inSocket;
QUdpSocket* outSocket;
ActuatorDesired* actDesired;
AltitudeActual* altActual;
BaroAltitude* baroAltitude;
AttitudeActual* attActual;
PositionActual* posActual;
GCSTelemetryStats* telStats;

View File

@ -108,7 +108,7 @@ void Il2Bridge::onStart()
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
actDesired = ActuatorDesired::GetInstance(objManager);
altActual = AltitudeActual::GetInstance(objManager);
baroAltitude = BaroAltitude::GetInstance(objManager);
attActual = AttitudeActual::GetInstance(objManager);
posActual = PositionActual::GetInstance(objManager);
telStats = GCSTelemetryStats::GetInstance(objManager);
@ -218,7 +218,7 @@ void Il2Bridge::receiveUpdate()
void Il2Bridge::setupObjects()
{
setupInputObject(actDesired, 75);
setupOutputObject(altActual, 250);
setupOutputObject(baroAltitude, 250);
setupOutputObject(attActual, 75);
setupOutputObject(posActual, 250);
}
@ -356,12 +356,12 @@ void Il2Bridge::processUpdate(QString& data)
current.X = old.X + (current.dX*current.dT);
current.Y = old.Y + (current.dY*current.dT);
// Update AltitudeActual object
AltitudeActual::DataFields altActualData;
altActualData.Altitude = current.Z;
altActualData.Temperature = TEMP_GROUND + (current.Z * TEMP_LAPSE_RATE) - 273.0;
altActualData.Pressure = PRESSURE(current.Z)/1000.0; // kpa
altActual->setData(altActualData);
// Update BaroAltitude object
BaroAltitude::DataFields baroAltitudeData;
baroAltitudeData.Altitude = current.Z;
baroAltitudeData.Temperature = TEMP_GROUND + (current.Z * TEMP_LAPSE_RATE) - 273.0;
baroAltitudeData.Pressure = PRESSURE(current.Z)/1000.0; // kpa
baroAltitude->setData(baroAltitudeData);
// Update attActual object
AttitudeActual::DataFields attActualData;
@ -394,7 +394,7 @@ void Il2Bridge::processUpdate(QString& data)
// issue manual update
attActual->updated();
altActual->updated();
baroAltitude->updated();
posActual->updated();
}

View File

@ -37,7 +37,7 @@
#include "uavtalk/telemetrymanager.h"
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/actuatordesired.h"
#include "uavobjects/altitudeactual.h"
#include "uavobjects/baroaltitude.h"
#include "uavobjects/attitudeactual.h"
#include "uavobjects/positionactual.h"
#include "uavobjects/gcstelemetrystats.h"
@ -122,7 +122,7 @@ private:
struct flightParams old;
QUdpSocket* outSocket;
ActuatorDesired* actDesired;
AltitudeActual* altActual;
BaroAltitude* baroAltitude;
AttitudeActual* attActual;
PositionActual* posActual;
GCSTelemetryStats* telStats;

View File

@ -29,7 +29,7 @@
#define PLOTDATA_H
#include "uavobjects/uavobject.h"
#include "uavobjects/altitudeactual.h"
#include "uavobjects/baroaltitude.h"
#include "uavobjects/positionactual.h"

View File

@ -312,7 +312,7 @@ TestDataGen::TestDataGen()
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
altActual = AltitudeActual::GetInstance(objManager);
baroAltitude = BaroAltitude::GetInstance(objManager);
gps = PositionActual::GetInstance(objManager);
//Setup timer
@ -326,12 +326,12 @@ TestDataGen::TestDataGen()
void TestDataGen::genTestData()
{
// Update AltitudeActual object
AltitudeActual::DataFields altActualData;
altActualData.Altitude = 500 * sin(1 * testTime) + 200 * cos(4 * testTime) + 800;
altActualData.Temperature = 30 * sin(0.5 * testTime);
altActualData.Pressure = 100;
altActual->setData(altActualData);
// Update BaroAltitude object
BaroAltitude::DataFields baroAltitudeData;
baroAltitudeData.Altitude = 500 * sin(1 * testTime) + 200 * cos(4 * testTime) + 800;
baroAltitudeData.Temperature = 30 * sin(0.5 * testTime);
baroAltitudeData.Pressure = 100;
baroAltitude->setData(baroAltitudeData);
// Update gps objects

View File

@ -30,7 +30,7 @@
#include "plotdata.h"
#include "uavobjects/uavobject.h"
#include "uavobjects/altitudeactual.h"
#include "uavobjects/baroaltitude.h"
#include "uavobjects/positionactual.h"
@ -78,7 +78,7 @@ public:
~TestDataGen();
private:
AltitudeActual* altActual;
BaroAltitude* baroAltitude;
PositionActual* gps;
QTimer *timer;

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file altitudeactual.cpp
* @file baroaltitude.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
@ -9,7 +9,7 @@
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: altitudeactual.xml.
* @note Object definition file: baroaltitude.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
@ -30,15 +30,15 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "altitudeactual.h"
#include "baroaltitude.h"
#include "uavobjectfield.h"
const QString AltitudeActual::NAME = QString("AltitudeActual");
const QString BaroAltitude::NAME = QString("BaroAltitude");
/**
* Constructor
*/
AltitudeActual::AltitudeActual(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
BaroAltitude::BaroAltitude(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
@ -61,7 +61,7 @@ AltitudeActual::AltitudeActual(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS,
/**
* Get the default metadata for this object
*/
UAVObject::Metadata AltitudeActual::getDefaultMetadata()
UAVObject::Metadata BaroAltitude::getDefaultMetadata()
{
UAVObject::Metadata metadata;
metadata.flightAccess = ACCESS_READWRITE;
@ -82,7 +82,7 @@ UAVObject::Metadata AltitudeActual::getDefaultMetadata()
* If a default value is not specified the object fields
* will be initialized to zero.
*/
void AltitudeActual::setDefaultFieldValues()
void BaroAltitude::setDefaultFieldValues()
{
}
@ -90,7 +90,7 @@ void AltitudeActual::setDefaultFieldValues()
/**
* Get the object data fields
*/
AltitudeActual::DataFields AltitudeActual::getData()
BaroAltitude::DataFields BaroAltitude::getData()
{
QMutexLocker locker(mutex);
return data;
@ -99,7 +99,7 @@ AltitudeActual::DataFields AltitudeActual::getData()
/**
* Set the object data fields
*/
void AltitudeActual::setData(const DataFields& data)
void BaroAltitude::setData(const DataFields& data)
{
QMutexLocker locker(mutex);
// Get metadata
@ -118,9 +118,9 @@ void AltitudeActual::setData(const DataFields& data)
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
UAVDataObject* AltitudeActual::clone(quint32 instID)
UAVDataObject* BaroAltitude::clone(quint32 instID)
{
AltitudeActual* obj = new AltitudeActual();
BaroAltitude* obj = new BaroAltitude();
obj->initialize(instID, this->getMetaObject());
return obj;
}
@ -128,7 +128,7 @@ UAVDataObject* AltitudeActual::clone(quint32 instID)
/**
* Static function to retrieve an instance of the object.
*/
AltitudeActual* AltitudeActual::GetInstance(UAVObjectManager* objMngr, quint32 instID)
BaroAltitude* BaroAltitude::GetInstance(UAVObjectManager* objMngr, quint32 instID)
{
return dynamic_cast<AltitudeActual*>(objMngr->getObject(AltitudeActual::OBJID, instID));
return dynamic_cast<BaroAltitude*>(objMngr->getObject(BaroAltitude::OBJID, instID));
}

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file altitudeactual.h
* @file baroaltitude.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
@ -9,7 +9,7 @@
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: altitudeactual.xml.
* @note Object definition file: baroaltitude.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
@ -30,13 +30,13 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ALTITUDEACTUAL_H
#define ALTITUDEACTUAL_H
#ifndef BAROALTITUDE_H
#define BAROALTITUDE_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT AltitudeActual: public UAVDataObject
class UAVOBJECTS_EXPORT BaroAltitude: public UAVDataObject
{
Q_OBJECT
@ -56,21 +56,21 @@ public:
// Constants
static const quint32 OBJID = 2251817750U;
static const quint32 OBJID = 3980666102U;
static const QString NAME;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
AltitudeActual();
BaroAltitude();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static AltitudeActual* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
static BaroAltitude* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
@ -79,4 +79,4 @@ private:
};
#endif // ALTITUDEACTUAL_H
#endif // BAROALTITUDE_H

View File

@ -1,12 +1,12 @@
##
##############################################################################
#
# @file altitudeactual.py
# @file baroaltitude.py
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
# @brief Implementation of the AltitudeActual object. This file has been
# @brief Implementation of the BaroAltitude object. This file has been
# automatically generated by the UAVObjectGenerator.
#
# @note Object definition file: altitudeactual.xml.
# @note Object definition file: baroaltitude.xml.
# This is an automatically generated file.
# DO NOT modify manually.
#
@ -70,11 +70,11 @@ _fields = [ \
]
class AltitudeActual(uavobject.UAVObject):
class BaroAltitude(uavobject.UAVObject):
## Object constants
OBJID = 2251817750
NAME = "AltitudeActual"
METANAME = "AltitudeActualMeta"
OBJID = 3980666102
NAME = "BaroAltitude"
METANAME = "BaroAltitudeMeta"
ISSINGLEINST = 1
ISSETTINGS = 0
@ -98,7 +98,7 @@ class AltitudeActual(uavobject.UAVObject):
def main():
# Instantiate the object and dump out some interesting info
x = AltitudeActual()
x = BaroAltitude()
print (x)
if __name__ == "__main__":

View File

@ -1,77 +1,77 @@
TEMPLATE = lib
TARGET = UAVObjects
DEFINES += UAVOBJECTS_LIBRARY
include(../../openpilotgcsplugin.pri)
include(uavobjects_dependencies.pri)
HEADERS += uavobjects_global.h \
uavobject.h \
uavmetaobject.h \
uavobjectmanager.h \
uavdataobject.h \
uavobjectfield.h \
uavobjectsinit.h \
uavobjectsplugin.h \
examplesettings.h \
ahrsstatus.h \
altitudeactual.h \
attitudeactual.h \
attitudesettings.h \
exampleobject2.h \
exampleobject1.h \
gcstelemetrystats.h \
attituderaw.h \
flighttelemetrystats.h \
systemstats.h \
systemalarms.h \
objectpersistence.h \
telemetrysettings.h \
systemsettings.h \
stabilizationsettings.h \
flightsituationactual.h \
manualcontrolsettings.h \
manualcontrolcommand.h \
attitudedesired.h \
actuatorsettings.h \
actuatordesired.h \
actuatorcommand.h \
navigationsettings.h \
navigationdesired.h \
positionactual.h \
flightbatterystate.h \
homelocation.h
SOURCES += uavobject.cpp \
uavmetaobject.cpp \
uavobjectmanager.cpp \
uavdataobject.cpp \
uavobjectfield.cpp \
uavobjectsinit.cpp \
uavobjectsplugin.cpp \
ahrsstatus.cpp \
altitudeactual.cpp \
attitudeactual.cpp \
attitudesettings.cpp \
examplesettings.cpp \
exampleobject2.cpp \
exampleobject1.cpp \
gcstelemetrystats.cpp \
attituderaw.cpp \
flighttelemetrystats.cpp \
systemstats.cpp \
systemalarms.cpp \
objectpersistence.cpp \
telemetrysettings.cpp \
systemsettings.cpp \
stabilizationsettings.cpp \
flightsituationactual.cpp \
manualcontrolsettings.cpp \
manualcontrolcommand.cpp \
attitudedesired.cpp \
actuatorsettings.cpp \
actuatordesired.cpp \
actuatorcommand.cpp \
navigationsettings.cpp \
navigationdesired.cpp \
positionactual.cpp \
flightbatterystate.cpp \
homelocation.cpp
OTHER_FILES += UAVObjects.pluginspec
TEMPLATE = lib
TARGET = UAVObjects
DEFINES += UAVOBJECTS_LIBRARY
include(../../openpilotgcsplugin.pri)
include(uavobjects_dependencies.pri)
HEADERS += uavobjects_global.h \
uavobject.h \
uavmetaobject.h \
uavobjectmanager.h \
uavdataobject.h \
uavobjectfield.h \
uavobjectsinit.h \
uavobjectsplugin.h \
examplesettings.h \
ahrsstatus.h \
baroaltitude.h \
attitudeactual.h \
attitudesettings.h \
exampleobject2.h \
exampleobject1.h \
gcstelemetrystats.h \
attituderaw.h \
flighttelemetrystats.h \
systemstats.h \
systemalarms.h \
objectpersistence.h \
telemetrysettings.h \
systemsettings.h \
stabilizationsettings.h \
flightsituationactual.h \
manualcontrolsettings.h \
manualcontrolcommand.h \
attitudedesired.h \
actuatorsettings.h \
actuatordesired.h \
actuatorcommand.h \
navigationsettings.h \
navigationdesired.h \
positionactual.h \
flightbatterystate.h \
homelocation.h
SOURCES += uavobject.cpp \
uavmetaobject.cpp \
uavobjectmanager.cpp \
uavdataobject.cpp \
uavobjectfield.cpp \
uavobjectsinit.cpp \
uavobjectsplugin.cpp \
ahrsstatus.cpp \
baroaltitude.cpp \
attitudeactual.cpp \
attitudesettings.cpp \
examplesettings.cpp \
exampleobject2.cpp \
exampleobject1.cpp \
gcstelemetrystats.cpp \
attituderaw.cpp \
flighttelemetrystats.cpp \
systemstats.cpp \
systemalarms.cpp \
objectpersistence.cpp \
telemetrysettings.cpp \
systemsettings.cpp \
stabilizationsettings.cpp \
flightsituationactual.cpp \
manualcontrolsettings.cpp \
manualcontrolcommand.cpp \
attitudedesired.cpp \
actuatorsettings.cpp \
actuatordesired.cpp \
actuatorcommand.cpp \
navigationsettings.cpp \
navigationdesired.cpp \
positionactual.cpp \
flightbatterystate.cpp \
homelocation.cpp
OTHER_FILES += UAVObjects.pluginspec

View File

@ -34,11 +34,11 @@
#include "actuatordesired.h"
#include "actuatorsettings.h"
#include "ahrsstatus.h"
#include "altitudeactual.h"
#include "attitudeactual.h"
#include "attitudedesired.h"
#include "attituderaw.h"
#include "attitudesettings.h"
#include "baroaltitude.h"
#include "exampleobject1.h"
#include "exampleobject2.h"
#include "examplesettings.h"
@ -70,11 +70,11 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
objMngr->registerObject( new ActuatorDesired() );
objMngr->registerObject( new ActuatorSettings() );
objMngr->registerObject( new AhrsStatus() );
objMngr->registerObject( new AltitudeActual() );
objMngr->registerObject( new AttitudeActual() );
objMngr->registerObject( new AttitudeDesired() );
objMngr->registerObject( new AttitudeRaw() );
objMngr->registerObject( new AttitudeSettings() );
objMngr->registerObject( new BaroAltitude() );
objMngr->registerObject( new ExampleObject1() );
objMngr->registerObject( new ExampleObject2() );
objMngr->registerObject( new ExampleSettings() );

View File

@ -1,5 +1,5 @@
<xml>
<object name="AltitudeActual" singleinstance="true" settings="false">
<object name="BaroAltitude" singleinstance="true" settings="false">
<field name="Altitude" units="m" type="float" elements="1"/>
<field name="Temperature" units="C" type="float" elements="1"/>
<field name="Pressure" units="kPa" type="float" elements="1"/>