/** * Initialize object. * \return 0 Success * \return -1 Failure to initialize or -2 for already initialized */ int32_t FlightTelemetryStatsInitialize(void) { // Compile time assertion that the FlightTelemetryStatsDataPacked and FlightTelemetryStatsData structs // have the same size (though instances of FlightTelemetryStatsData // should be placed in memory by the linker/compiler on a 4 byte alignment). PIOS_STATIC_ASSERT(sizeof(FlightTelemetryStatsDataPacked) == sizeof(FlightTelemetryStatsData)); // Don't set the handle to null if already registered if (UAVObjGetByID(FLIGHTTELEMETRYSTATS_OBJID)) { return -2; } // Register object with the object manager handle = UAVObjRegister(FLIGHTTELEMETRYSTATS_OBJID, FLIGHTTELEMETRYSTATS_ISSINGLEINST, FLIGHTTELEMETRYSTATS_ISSETTINGS, FLIGHTTELEMETRYSTATS_ISPRIORITY, FLIGHTTELEMETRYSTATS_NUMBYTES, &FlightTelemetryStatsSetDefaults); // Done return handle ? 0 : -1; }
/** * Initialize object. * \return 0 Success * \return -1 Failure to initialize or -2 for already initialized */ int32_t SystemSettingsInitialize(void) { // Compile time assertion that the SystemSettingsDataPacked and SystemSettingsData structs // have the same size (though instances of SystemSettingsData // should be placed in memory by the linker/compiler on a 4 byte alignment). PIOS_STATIC_ASSERT(sizeof(SystemSettingsDataPacked) == sizeof(SystemSettingsData)); // Don't set the handle to null if already registered if (UAVObjGetByID(SYSTEMSETTINGS_OBJID)) { return -2; } // Register object with the object manager handle = UAVObjRegister(SYSTEMSETTINGS_OBJID, SYSTEMSETTINGS_ISSINGLEINST, SYSTEMSETTINGS_ISSETTINGS, SYSTEMSETTINGS_ISPRIORITY, SYSTEMSETTINGS_NUMBYTES, &SystemSettingsSetDefaults); // Done return handle ? 0 : -1; }
/** * Initialize object. * \return 0 Success * \return -1 Failure to initialize or -2 for already initialized */ int32_t PositionStateInitialize(void) { // Compile time assertion that the PositionStateDataPacked and PositionStateData structs // have the same size (though instances of PositionStateData // should be placed in memory by the linker/compiler on a 4 byte alignment). PIOS_STATIC_ASSERT(sizeof(PositionStateDataPacked) == sizeof(PositionStateData)); // Don't set the handle to null if already registered if (UAVObjGetByID(POSITIONSTATE_OBJID)) { return -2; } // Register object with the object manager handle = UAVObjRegister(POSITIONSTATE_OBJID, POSITIONSTATE_ISSINGLEINST, POSITIONSTATE_ISSETTINGS, POSITIONSTATE_ISPRIORITY, POSITIONSTATE_NUMBYTES, &PositionStateSetDefaults); // Done return handle ? 0 : -1; }
/** * Initialize object. * \return 0 Success * \return -1 Failure to initialize or -2 for already initialized */ int32_t VtolSelfTuningStatsInitialize(void) { // Compile time assertion that the VtolSelfTuningStatsDataPacked and VtolSelfTuningStatsData structs // have the same size (though instances of VtolSelfTuningStatsData // should be placed in memory by the linker/compiler on a 4 byte alignment). PIOS_STATIC_ASSERT(sizeof(VtolSelfTuningStatsDataPacked) == sizeof(VtolSelfTuningStatsData)); // Don't set the handle to null if already registered if (UAVObjGetByID(VTOLSELFTUNINGSTATS_OBJID)) { return -2; } // Register object with the object manager handle = UAVObjRegister(VTOLSELFTUNINGSTATS_OBJID, VTOLSELFTUNINGSTATS_ISSINGLEINST, VTOLSELFTUNINGSTATS_ISSETTINGS, VTOLSELFTUNINGSTATS_ISPRIORITY, VTOLSELFTUNINGSTATS_NUMBYTES, &VtolSelfTuningStatsSetDefaults); // Done return handle ? 0 : -1; }
/** * Initialize object. * \return 0 Success * \return -1 Failure to initialize or -2 for already initialized */ int32_t AccelSensorInitialize(void) { // Compile time assertion that the AccelSensorDataPacked and AccelSensorData structs // have the same size (though instances of AccelSensorData // should be placed in memory by the linker/compiler on a 4 byte alignment). PIOS_STATIC_ASSERT(sizeof(AccelSensorDataPacked) == sizeof(AccelSensorData)); // Don't set the handle to null if already registered if (UAVObjGetByID(ACCELSENSOR_OBJID)) { return -2; } // Register object with the object manager handle = UAVObjRegister(ACCELSENSOR_OBJID, ACCELSENSOR_ISSINGLEINST, ACCELSENSOR_ISSETTINGS, ACCELSENSOR_ISPRIORITY, ACCELSENSOR_NUMBYTES, &AccelSensorSetDefaults); // Done return handle ? 0 : -1; }
/** * Initialize object. * \return 0 Success * \return -1 Failure to initialize or -2 for already initialized */ int32_t EKFConfigurationInitialize(void) { // Compile time assertion that the EKFConfigurationDataPacked and EKFConfigurationData structs // have the same size (though instances of EKFConfigurationData // should be placed in memory by the linker/compiler on a 4 byte alignment). PIOS_STATIC_ASSERT(sizeof(EKFConfigurationDataPacked) == sizeof(EKFConfigurationData)); // Don't set the handle to null if already registered if (UAVObjGetByID(EKFCONFIGURATION_OBJID)) { return -2; } // Register object with the object manager handle = UAVObjRegister(EKFCONFIGURATION_OBJID, EKFCONFIGURATION_ISSINGLEINST, EKFCONFIGURATION_ISSETTINGS, EKFCONFIGURATION_ISPRIORITY, EKFCONFIGURATION_NUMBYTES, &EKFConfigurationSetDefaults); // Done return handle ? 0 : -1; }
/** * Module initialization */ int32_t ManualControlInitialize() { /* Check the assumptions about uavobject enum's are correct */ PIOS_STATIC_ASSERT(assumptions); ManualControlCommandInitialize(); FlightStatusInitialize(); ManualControlSettingsInitialize(); FlightModeSettingsInitialize(); SystemSettingsInitialize(); StabilizationSettingsInitialize(); #ifndef PIOS_EXCLUDE_ADVANCED_FEATURES VtolSelfTuningStatsInitialize(); VtolPathFollowerSettingsInitialize(); VtolPathFollowerSettingsConnectCallback(&SettingsUpdatedCb); SystemSettingsConnectCallback(&SettingsUpdatedCb); #endif callbackHandle = PIOS_CALLBACKSCHEDULER_Create(&manualControlTask, CALLBACK_PRIORITY, CBTASK_PRIORITY, CALLBACKINFO_RUNNING_MANUALCONTROL, STACK_SIZE_BYTES); return 0; }