mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
OP-32 Flight Initial release of Actuator (ServoOut) and ManualControl (ServoIn) modules, still work in progress (not fully tested).
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@632 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
3f79770f7f
commit
6b6740109e
@ -81,6 +81,10 @@ MODTELEMETRY = $(OPMODULEDIR)/Telemetry
|
||||
MODTELEMETRYINC = $(MODTELEMETRY)/inc
|
||||
MODGPS = $(OPMODULEDIR)/GPS
|
||||
MODGPSINC = $(MODGPS)/inc
|
||||
MODMANUALCONTROL = $(OPMODULEDIR)/ManualControl
|
||||
MODMANUALCONTROLINC = $(MODMANUALCONTROL)/inc
|
||||
MODACTUATOR = $(OPMODULEDIR)/Actuator
|
||||
MODACTUATORINC = $(MODACTUATOR)/inc
|
||||
PIOS = ../PiOS
|
||||
PIOSINC = $(PIOS)/inc
|
||||
PIOSSTM32F10X = $(PIOS)/STM32F10x
|
||||
@ -109,8 +113,10 @@ DOXYGENDIR = ../Doc/Doxygen
|
||||
## MODULES
|
||||
SRC = $(MODEXAMPLE)/examplemodevent.c $(MODEXAMPLE)/examplemodperiodic.c $(MODEXAMPLE)/examplemodthread.c
|
||||
SRC += $(MODSYSTEM)/systemmod.c
|
||||
SRC += $(MODTELEMETRY)/telemetry.c
|
||||
SRC += $(MODTELEMETRY)/telemetry.c
|
||||
SRC += $(MODGPS)/GPS.c $(MODGPS)/buffer.c
|
||||
SRC += $(MODMANUALCONTROL)/manualcontrol.c
|
||||
SRC += $(MODACTUATOR)/actuator.c
|
||||
|
||||
## OPENPILOT:
|
||||
SRC += $(OPSYSTEM)/openpilot.c
|
||||
@ -140,7 +146,15 @@ SRC += $(OPUAVOBJ)/gcstelemetrystats.c
|
||||
SRC += $(OPUAVOBJ)/flighttelemetrystats.c
|
||||
SRC += $(OPUAVOBJ)/systemstats.c
|
||||
SRC += $(OPUAVOBJ)/systemalarms.c
|
||||
SRC += $(OPUAVOBJ)/systemsettings.c
|
||||
SRC += $(OPUAVOBJ)/telemetrysettings.c
|
||||
SRC += $(OPUAVOBJ)/actuatorcommand.c
|
||||
SRC += $(OPUAVOBJ)/actuatordesired.c
|
||||
SRC += $(OPUAVOBJ)/actuatorsettings.c
|
||||
SRC += $(OPUAVOBJ)/manualcontrolcommand.c
|
||||
SRC += $(OPUAVOBJ)/manualcontrolsettings.c
|
||||
SRC += $(OPUAVOBJ)/attitudedesired.c
|
||||
SRC += $(OPUAVOBJ)/stabilizationsettings.c
|
||||
|
||||
## PIOS Hardware (STM32F10x)
|
||||
SRC += $(PIOSSTM32F10X)/pios_sys.c
|
||||
@ -262,6 +276,10 @@ EXTRAINCDIRS += $(MODTELEMETRY)
|
||||
EXTRAINCDIRS += $(MODTELEMETRYINC)
|
||||
EXTRAINCDIRS += $(MODGPS)
|
||||
EXTRAINCDIRS += $(MODGPSINC)
|
||||
EXTRAINCDIRS += $(MODMANUALCONTROL)
|
||||
EXTRAINCDIRS += $(MODMANUALCONTROLINC)
|
||||
EXTRAINCDIRS += $(MODACTUATOR)
|
||||
EXTRAINCDIRS += $(MODACTUATORINC)
|
||||
EXTRAINCDIRS += $(PIOS)
|
||||
EXTRAINCDIRS += $(PIOSINC)
|
||||
EXTRAINCDIRS += $(PIOSSTM32F10X)
|
||||
|
238
flight/OpenPilot/Modules/Actuator/actuator.c
Normal file
238
flight/OpenPilot/Modules/Actuator/actuator.c
Normal file
@ -0,0 +1,238 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuator.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Actuator module. Drives the actuators (servos, motors etc).
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "actuator.h"
|
||||
#include "actuatorsettings.h"
|
||||
#include "systemsettings.h"
|
||||
#include "actuatordesired.h"
|
||||
#include "actuatorcommand.h"
|
||||
|
||||
// Private constants
|
||||
#define MAX_QUEUE_SIZE 2
|
||||
#define STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
|
||||
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
static xQueueHandle queue;
|
||||
static xTaskHandle taskHandle;
|
||||
|
||||
// Private functions
|
||||
static void actuatorTask(void* parameters);
|
||||
static int32_t mixerFixedWing(const ActuatorSettingsData* settings, const ActuatorDesiredData* desired, ActuatorCommandData* cmd);
|
||||
static int32_t mixerFixedWingElevon(const ActuatorSettingsData* settings, const ActuatorDesiredData* desired, ActuatorCommandData* cmd);
|
||||
static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDesiredData* desired, ActuatorCommandData* cmd);
|
||||
static int16_t scaleChannel(float value, int16_t max, int16_t min, int16_t neutral);
|
||||
|
||||
/**
|
||||
* Module initialization
|
||||
*/
|
||||
int32_t ActuatorInitialize()
|
||||
{
|
||||
// Create object queue
|
||||
queue = xQueueCreate(MAX_QUEUE_SIZE, sizeof(UAVObjEvent));
|
||||
|
||||
// Listen for ExampleObject1 updates
|
||||
ActuatorDesiredConnectQueue(queue);
|
||||
|
||||
// Start main task
|
||||
xTaskCreate(actuatorTask, (signed char*)"Actuator", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main module task
|
||||
*/
|
||||
static void actuatorTask(void* parameters)
|
||||
{
|
||||
UAVObjEvent ev;
|
||||
ActuatorSettingsData settings;
|
||||
SystemSettingsData sysSettings;
|
||||
ActuatorDesiredData desired;
|
||||
ActuatorCommandData cmd;
|
||||
|
||||
// Set servo update frequency (done only on start-up)
|
||||
ActuatorSettingsGet(&settings);
|
||||
PIOS_Servo_SetHz(settings.ChannelUpdateFreq[0], settings.ChannelUpdateFreq[1]);
|
||||
|
||||
// Main task loop
|
||||
while (1)
|
||||
{
|
||||
// Wait until the ActuatorDesired object is updated
|
||||
while ( xQueueReceive(queue, &ev, portMAX_DELAY) != pdTRUE );
|
||||
|
||||
// Read settings
|
||||
ActuatorSettingsGet(&settings);
|
||||
SystemSettingsGet(&sysSettings);
|
||||
|
||||
// Reset ActuatorCommand to neutral values
|
||||
for (int n = 0; n < ACTUATORCOMMAND_CHANNEL_NUMELEM; ++n)
|
||||
{
|
||||
cmd.Channel[n] = settings.ChannelNeutral[n];
|
||||
}
|
||||
|
||||
// Read input object
|
||||
ActuatorDesiredGet(&desired);
|
||||
|
||||
// Call appropriate mixer depending on the airframe configuration
|
||||
if ( sysSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_FIXEDWING )
|
||||
{
|
||||
if ( mixerFixedWing(&settings, &desired, &cmd) == -1 )
|
||||
{
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_ACTUATOR, SYSTEMALARMS_ALARM_CRITICAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
|
||||
}
|
||||
}
|
||||
else if ( sysSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_FIXEDWINGELEVON )
|
||||
{
|
||||
if ( mixerFixedWingElevon(&settings, &desired, &cmd) == -1 )
|
||||
{
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_ACTUATOR, SYSTEMALARMS_ALARM_CRITICAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
|
||||
}
|
||||
}
|
||||
else if ( sysSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_VTOL )
|
||||
{
|
||||
if ( mixerVTOL(&settings, &desired, &cmd) == -1 )
|
||||
{
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_ACTUATOR, SYSTEMALARMS_ALARM_CRITICAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
|
||||
}
|
||||
}
|
||||
|
||||
// Update servo outputs
|
||||
for (int n = 0; n < ACTUATORCOMMAND_CHANNEL_NUMELEM; ++n)
|
||||
{
|
||||
PIOS_Servo_Set( n+1, cmd.Channel[n] );
|
||||
}
|
||||
|
||||
// Update output object
|
||||
ActuatorCommandSet(&cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mixer for Fixed Wing airframes. Converts desired roll,pitch,yaw and throttle to servo outputs.
|
||||
* @return -1 if error, 0 if success
|
||||
*/
|
||||
static int32_t mixerFixedWing(const ActuatorSettingsData* settings, const ActuatorDesiredData* desired, ActuatorCommandData* cmd)
|
||||
{
|
||||
// Check settings
|
||||
if ( settings->FixedWingPitch1 == ACTUATORSETTINGS_FIXEDWINGPITCH1_NONE ||
|
||||
settings->FixedWingRoll1 == ACTUATORSETTINGS_FIXEDWINGROLL1_NONE ||
|
||||
settings->FixedWingThrottle == ACTUATORSETTINGS_FIXEDWINGTHROTTLE_NONE )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set pitch servo command
|
||||
cmd->Channel[ settings->FixedWingPitch1 ] = scaleChannel(desired->Pitch, settings->ChannelMax[ settings->FixedWingPitch1 ],
|
||||
settings->ChannelMin[ settings->FixedWingPitch1 ],
|
||||
settings->ChannelNeutral[ settings->FixedWingPitch1 ]);
|
||||
if ( settings->FixedWingPitch2 != ACTUATORSETTINGS_FIXEDWINGPITCH2_NONE )
|
||||
{
|
||||
cmd->Channel[ settings->FixedWingPitch2 ] = scaleChannel(desired->Pitch, settings->ChannelMax[ settings->FixedWingPitch2 ],
|
||||
settings->ChannelMin[ settings->FixedWingPitch2 ],
|
||||
settings->ChannelNeutral[ settings->FixedWingPitch2 ]);
|
||||
}
|
||||
|
||||
// Set roll servo command
|
||||
cmd->Channel[ settings->FixedWingRoll1 ] = scaleChannel(desired->Roll, settings->ChannelMax[ settings->FixedWingRoll1 ],
|
||||
settings->ChannelMin[ settings->FixedWingRoll1 ],
|
||||
settings->ChannelNeutral[ settings->FixedWingRoll1 ]);
|
||||
if ( settings->FixedWingRoll2 != ACTUATORSETTINGS_FIXEDWINGROLL2_NONE )
|
||||
{
|
||||
cmd->Channel[ settings->FixedWingRoll2 ] = scaleChannel(desired->Roll, settings->ChannelMax[ settings->FixedWingRoll2 ],
|
||||
settings->ChannelMin[ settings->FixedWingRoll2 ],
|
||||
settings->ChannelNeutral[ settings->FixedWingRoll2 ]);
|
||||
}
|
||||
|
||||
// Set yaw servo command
|
||||
if ( settings->FixedWingYaw != ACTUATORSETTINGS_FIXEDWINGYAW_NONE )
|
||||
{
|
||||
cmd->Channel[ settings->FixedWingYaw ] = scaleChannel(desired->Yaw, settings->ChannelMax[ settings->FixedWingYaw ],
|
||||
settings->ChannelMin[ settings->FixedWingYaw ],
|
||||
settings->ChannelNeutral[ settings->FixedWingYaw ]);
|
||||
}
|
||||
|
||||
// Set throttle servo command
|
||||
cmd->Channel[ settings->FixedWingThrottle ] = scaleChannel(desired->Throttle, settings->ChannelMax[ settings->FixedWingThrottle ],
|
||||
settings->ChannelMin[ settings->FixedWingThrottle ],
|
||||
settings->ChannelNeutral[ settings->FixedWingThrottle ]);
|
||||
|
||||
// Done
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mixer for Fixed Wing airframes with elevons. Converts desired roll,pitch,yaw and throttle to servo outputs.
|
||||
* @return -1 if error, 0 if success
|
||||
*/
|
||||
static int32_t mixerFixedWingElevon(const ActuatorSettingsData* settings, const ActuatorDesiredData* desired, ActuatorCommandData* cmd)
|
||||
{
|
||||
// TODO: Implement elevon mixer
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mixer for VTOL (quads and octo copters). Converts desired roll,pitch,yaw and throttle to servo outputs.
|
||||
* @return -1 if error, 0 if success
|
||||
*/
|
||||
static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDesiredData* desired, ActuatorCommandData* cmd)
|
||||
{
|
||||
// TODO: Implement VTOL mixer
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert channel from -1/+1 to servo pulse duration in microseconds
|
||||
*/
|
||||
static int16_t scaleChannel(float value, int16_t max, int16_t min, int16_t neutral)
|
||||
{
|
||||
int16_t valueScaled;
|
||||
// Scale
|
||||
if ( value >= 0.0)
|
||||
{
|
||||
valueScaled = (int16_t)(value*((float)(max-neutral))) + neutral;
|
||||
}
|
||||
else
|
||||
{
|
||||
valueScaled = (int16_t)(value*((float)(neutral-min))) + neutral;
|
||||
}
|
||||
return valueScaled;
|
||||
}
|
31
flight/OpenPilot/Modules/Actuator/inc/actuator.h
Normal file
31
flight/OpenPilot/Modules/Actuator/inc/actuator.h
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuator.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Actuator module. Drives the actuators (servos, motors etc).
|
||||
*
|
||||
* @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 ACTUATOR_H
|
||||
#define ACTUATOR_H
|
||||
|
||||
int32_t ActuatorInitialize();
|
||||
|
||||
#endif // ACTUATOR_H
|
31
flight/OpenPilot/Modules/ManualControl/inc/manualcontrol.h
Normal file
31
flight/OpenPilot/Modules/ManualControl/inc/manualcontrol.h
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file manualcontrol.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief ManualControl module. Handles safety R/C link and flight mode.
|
||||
*
|
||||
* @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 MANUALCONTROL_H
|
||||
#define MANUALCONTROL_H
|
||||
|
||||
int32_t ManualControlInitialize();
|
||||
|
||||
#endif // MANUALCONTROL_H
|
213
flight/OpenPilot/Modules/ManualControl/manualcontrol.c
Normal file
213
flight/OpenPilot/Modules/ManualControl/manualcontrol.c
Normal file
@ -0,0 +1,213 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file manualcontrol.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief ManualControl module. Handles safety R/C link and flight mode.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "manualcontrol.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
#include "stabilizationsettings.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "actuatordesired.h"
|
||||
#include "attitudedesired.h"
|
||||
|
||||
// Private constants
|
||||
#define STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
|
||||
#define UPDATE_PERIOD_MS 20
|
||||
#define THROTTLE_FAILSAFE -0.1
|
||||
#define FLIGHT_MODE_LIMIT 1.0/3.0
|
||||
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
static xTaskHandle taskHandle;
|
||||
|
||||
// Private functions
|
||||
static void manualControlTask(void* parameters);
|
||||
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral);
|
||||
|
||||
/**
|
||||
* Module initialization
|
||||
*/
|
||||
int32_t ManualControlInitialize()
|
||||
{
|
||||
// Start main task
|
||||
xTaskCreate(manualControlTask, (signed char*)"ManualControl", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module task
|
||||
*/
|
||||
static void manualControlTask(void* parameters)
|
||||
{
|
||||
ManualControlSettingsData settings;
|
||||
StabilizationSettingsData stabSettings;
|
||||
ManualControlCommandData cmd;
|
||||
ActuatorDesiredData actuator;
|
||||
AttitudeDesiredData attitude;
|
||||
portTickType lastSysTime;
|
||||
float flightMode;
|
||||
|
||||
// Main task loop
|
||||
lastSysTime = xTaskGetTickCount();
|
||||
while (1)
|
||||
{
|
||||
// Wait until next update
|
||||
vTaskDelayUntil(&lastSysTime, UPDATE_PERIOD_MS / portTICK_RATE_MS );
|
||||
|
||||
// Read settings
|
||||
ManualControlSettingsGet(&settings);
|
||||
StabilizationSettingsGet(&stabSettings);
|
||||
|
||||
// Check settings, if error raise alarm
|
||||
if ( settings.Roll >= MANUALCONTROLSETTINGS_ROLL_NONE ||
|
||||
settings.Pitch >= MANUALCONTROLSETTINGS_PITCH_NONE ||
|
||||
settings.Yaw >= MANUALCONTROLSETTINGS_YAW_NONE ||
|
||||
settings.Throttle >= MANUALCONTROLSETTINGS_THROTTLE_NONE ||
|
||||
settings.FlightMode >= MANUALCONTROLSETTINGS_FLIGHTMODE_NONE )
|
||||
{
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_MANUALCONTROL, SYSTEMALARMS_ALARM_CRITICAL);
|
||||
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO;
|
||||
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_FALSE;
|
||||
ManualControlCommandSet(&cmd);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read channel values in us
|
||||
// TODO: settings.InputMode is currently ignored because PIOS will not allow runtime
|
||||
// selection of PWM and PPM. The configuration is currently done at compile time in
|
||||
// the pios_config.h file.
|
||||
for (int n = 0; n < MANUALCONTROLCOMMAND_CHANNEL_NUMELEM; ++n)
|
||||
{
|
||||
#if defined(PIOS_INCLUDE_PWM)
|
||||
cmd.Channel[n] = PIOS_PWM_Get(n);
|
||||
#elif defined(PIOS_INCLUDE_PPM)
|
||||
cmd.Channel[n] = PIOS_PPM_Get(n);
|
||||
#elif defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
cmd.Channel[n] = PIOS_SPEKTRUM_Get(n);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Calculate roll command in range +1 to -1
|
||||
cmd.Roll = scaleChannel( cmd.Channel[settings.Roll], settings.ChannelMax[settings.Roll],
|
||||
settings.ChannelMin[settings.Roll], settings.ChannelNeutral[settings.Roll] );
|
||||
|
||||
// Calculate pitch command in range +1 to -1
|
||||
cmd.Pitch = scaleChannel( cmd.Channel[settings.Pitch], settings.ChannelMax[settings.Pitch],
|
||||
settings.ChannelMin[settings.Pitch], settings.ChannelNeutral[settings.Pitch] );
|
||||
|
||||
// Calculate yaw command in range +1 to -1
|
||||
cmd.Yaw = scaleChannel( cmd.Channel[settings.Yaw], settings.ChannelMax[settings.Yaw],
|
||||
settings.ChannelMin[settings.Yaw], settings.ChannelNeutral[settings.Yaw] );
|
||||
|
||||
// Calculate throttle command in range +1 to -1
|
||||
cmd.Throttle = scaleChannel( cmd.Channel[settings.Throttle], settings.ChannelMax[settings.Throttle],
|
||||
settings.ChannelMin[settings.Throttle], settings.ChannelNeutral[settings.Throttle] );
|
||||
|
||||
// Update flight mode
|
||||
flightMode = scaleChannel( cmd.Channel[settings.FlightMode], settings.ChannelMax[settings.FlightMode],
|
||||
settings.ChannelMin[settings.FlightMode], settings.ChannelNeutral[settings.FlightMode] );
|
||||
if (flightMode < -FLIGHT_MODE_LIMIT)
|
||||
{
|
||||
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL;
|
||||
}
|
||||
else if (flightMode > FLIGHT_MODE_LIMIT)
|
||||
{
|
||||
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED;
|
||||
}
|
||||
|
||||
// Check for connection status (negative throttle values)
|
||||
// The receiver failsafe for the throttle channel should be set to a value below the channel NEUTRAL
|
||||
if ( cmd.Throttle < THROTTLE_FAILSAFE )
|
||||
{
|
||||
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_FALSE;
|
||||
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO;
|
||||
AlarmsSet(SYSTEMALARMS_ALARM_MANUALCONTROL, SYSTEMALARMS_ALARM_WARNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_TRUE;
|
||||
AlarmsClear(SYSTEMALARMS_ALARM_MANUALCONTROL);
|
||||
if ( cmd.Throttle < 0 )
|
||||
{
|
||||
cmd.Throttle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the ManualControlCommand object
|
||||
ManualControlCommandSet(&cmd);
|
||||
|
||||
// Depending on the mode update the Stabilization or Actuator objects
|
||||
if ( cmd.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL )
|
||||
{
|
||||
actuator.Roll = cmd.Roll;
|
||||
actuator.Pitch = cmd.Pitch;
|
||||
actuator.Yaw = cmd.Yaw;
|
||||
actuator.Throttle = cmd.Throttle;
|
||||
ActuatorDesiredSet(&actuator);
|
||||
}
|
||||
else if ( cmd.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED )
|
||||
{
|
||||
attitude.Roll = cmd.Roll*stabSettings.RollMax;
|
||||
attitude.Pitch = cmd.Pitch*stabSettings.PitchMax;
|
||||
attitude.Yaw = cmd.Yaw*180.0;
|
||||
attitude.Throttle = cmd.Throttle*stabSettings.ThrottleMax;
|
||||
AttitudeDesiredSet(&attitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert channel from servo pulse duration (microseconds) to scaled -1/+1 range.
|
||||
*/
|
||||
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral)
|
||||
{
|
||||
float valueScaled;
|
||||
// Scale
|
||||
if ( value >= neutral)
|
||||
{
|
||||
valueScaled = (float)(value-neutral)/(float)(max-neutral);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueScaled = (float)(value-neutral)/(float)(neutral-min);
|
||||
}
|
||||
// Bound
|
||||
if ( valueScaled > 1.0 )
|
||||
{
|
||||
valueScaled = 1.0;
|
||||
}
|
||||
else if ( valueScaled < -1.0 )
|
||||
{
|
||||
valueScaled = -1.0;
|
||||
}
|
||||
return valueScaled;
|
||||
}
|
@ -33,6 +33,8 @@
|
||||
#include "examplemodevent.h"
|
||||
#include "examplemodperiodic.h"
|
||||
#include "examplemodthread.h"
|
||||
#include "manualcontrol.h"
|
||||
#include "actuator.h"
|
||||
|
||||
/* Task Priorities */
|
||||
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
|
||||
@ -130,10 +132,12 @@ void OpenPilotInit()
|
||||
//ExampleModThreadInitialize();
|
||||
//ExampleModEventInitialize();
|
||||
GpsInitialize();
|
||||
ManualControlInitialize();
|
||||
ActuatorInitialize();
|
||||
|
||||
/* Create test tasks */
|
||||
//xTaskCreate(TaskTesting, (signed portCHAR *)"Testing", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
|
||||
xTaskCreate(TaskHIDTest, (signed portCHAR *)"HIDTest", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
|
||||
//xTaskCreate(TaskHIDTest, (signed portCHAR *)"HIDTest", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
|
||||
//xTaskCreate(TaskServos, (signed portCHAR *)"Servos", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
|
||||
//xTaskCreate(TaskSDCard, (signed portCHAR *)"SDCard", configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 2), NULL);
|
||||
}
|
||||
|
100
flight/OpenPilot/UAVObjects/actuatorcommand.c
Normal file
100
flight/OpenPilot/UAVObjects/actuatorcommand.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuatorcommand.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ActuatorCommand object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: actuatorcommand.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "actuatorcommand.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t ActuatorCommandInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(ACTUATORCOMMAND_OBJID, ACTUATORCOMMAND_NAME, ACTUATORCOMMAND_METANAME, 0,
|
||||
ACTUATORCOMMAND_ISSINGLEINST, ACTUATORCOMMAND_ISSETTINGS, ACTUATORCOMMAND_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
ActuatorCommandData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(ActuatorCommandData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 1000;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle ActuatorCommandHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
100
flight/OpenPilot/UAVObjects/actuatordesired.c
Normal file
100
flight/OpenPilot/UAVObjects/actuatordesired.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuatordesired.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ActuatorDesired object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: actuatordesired.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "actuatordesired.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t ActuatorDesiredInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(ACTUATORDESIRED_OBJID, ACTUATORDESIRED_NAME, ACTUATORDESIRED_METANAME, 0,
|
||||
ACTUATORDESIRED_ISSINGLEINST, ACTUATORDESIRED_ISSETTINGS, ACTUATORDESIRED_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
ActuatorDesiredData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(ActuatorDesiredData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 1000;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle ActuatorDesiredHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
140
flight/OpenPilot/UAVObjects/actuatorsettings.c
Normal file
140
flight/OpenPilot/UAVObjects/actuatorsettings.c
Normal file
@ -0,0 +1,140 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuatorsettings.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ActuatorSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: actuatorsettings.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "actuatorsettings.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t ActuatorSettingsInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(ACTUATORSETTINGS_OBJID, ACTUATORSETTINGS_NAME, ACTUATORSETTINGS_METANAME, 0,
|
||||
ACTUATORSETTINGS_ISSINGLEINST, ACTUATORSETTINGS_ISSETTINGS, ACTUATORSETTINGS_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
ActuatorSettingsData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(ActuatorSettingsData));
|
||||
data.FixedWingRoll1 = 8;
|
||||
data.FixedWingRoll2 = 8;
|
||||
data.FixedWingPitch1 = 8;
|
||||
data.FixedWingPitch2 = 8;
|
||||
data.FixedWingYaw = 8;
|
||||
data.FixedWingThrottle = 8;
|
||||
data.VTOLMotorN = 8;
|
||||
data.VTOLMotorNE = 8;
|
||||
data.VTOLMotorE = 8;
|
||||
data.VTOLMotorSE = 8;
|
||||
data.VTOLMotorS = 8;
|
||||
data.VTOLMotorSW = 8;
|
||||
data.VTOLMotorW = 8;
|
||||
data.VTOLMotorNW = 8;
|
||||
data.ChannelUpdateFreq[0] = 50;
|
||||
data.ChannelUpdateFreq[1] = 50;
|
||||
data.ChannelMax[0] = 2000;
|
||||
data.ChannelMax[1] = 2000;
|
||||
data.ChannelMax[2] = 2000;
|
||||
data.ChannelMax[3] = 2000;
|
||||
data.ChannelMax[4] = 2000;
|
||||
data.ChannelMax[5] = 2000;
|
||||
data.ChannelMax[6] = 2000;
|
||||
data.ChannelMax[7] = 2000;
|
||||
data.ChannelNeutral[0] = 1500;
|
||||
data.ChannelNeutral[1] = 1500;
|
||||
data.ChannelNeutral[2] = 1500;
|
||||
data.ChannelNeutral[3] = 1500;
|
||||
data.ChannelNeutral[4] = 1500;
|
||||
data.ChannelNeutral[5] = 1500;
|
||||
data.ChannelNeutral[6] = 1500;
|
||||
data.ChannelNeutral[7] = 1500;
|
||||
data.ChannelMin[0] = 1000;
|
||||
data.ChannelMin[1] = 1000;
|
||||
data.ChannelMin[2] = 1000;
|
||||
data.ChannelMin[3] = 1000;
|
||||
data.ChannelMin[4] = 1000;
|
||||
data.ChannelMin[5] = 1000;
|
||||
data.ChannelMin[6] = 1000;
|
||||
data.ChannelMin[7] = 1000;
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.telemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle ActuatorSettingsHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
100
flight/OpenPilot/UAVObjects/attitudedesired.c
Normal file
100
flight/OpenPilot/UAVObjects/attitudedesired.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file attitudedesired.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the AttitudeDesired object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: attitudedesired.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "attitudedesired.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t AttitudeDesiredInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(ATTITUDEDESIRED_OBJID, ATTITUDEDESIRED_NAME, ATTITUDEDESIRED_METANAME, 0,
|
||||
ATTITUDEDESIRED_ISSINGLEINST, ATTITUDEDESIRED_ISSETTINGS, ATTITUDEDESIRED_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
AttitudeDesiredData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(AttitudeDesiredData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 1000;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle AttitudeDesiredHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
74
flight/OpenPilot/UAVObjects/inc/actuatorcommand.h
Normal file
74
flight/OpenPilot/UAVObjects/inc/actuatorcommand.h
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuatorcommand.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ActuatorCommand object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: actuatorcommand.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 ACTUATORCOMMAND_H
|
||||
#define ACTUATORCOMMAND_H
|
||||
|
||||
// Object constants
|
||||
#define ACTUATORCOMMAND_OBJID 3909877022U
|
||||
#define ACTUATORCOMMAND_NAME "ActuatorCommand"
|
||||
#define ACTUATORCOMMAND_METANAME "ActuatorCommandMeta"
|
||||
#define ACTUATORCOMMAND_ISSINGLEINST 1
|
||||
#define ACTUATORCOMMAND_ISSETTINGS 0
|
||||
#define ACTUATORCOMMAND_NUMBYTES sizeof(ActuatorCommandData)
|
||||
|
||||
// Object access macros
|
||||
#define ActuatorCommandGet(dataOut) UAVObjGetData(ActuatorCommandHandle(), dataOut)
|
||||
#define ActuatorCommandSet(dataIn) UAVObjSetData(ActuatorCommandHandle(), dataIn)
|
||||
#define ActuatorCommandInstGet(instId, dataOut) UAVObjGetInstanceData(ActuatorCommandHandle(), instId, dataOut)
|
||||
#define ActuatorCommandInstSet(instId, dataIn) UAVObjSetInstanceData(ActuatorCommandHandle(), instId, dataIn)
|
||||
#define ActuatorCommandConnectQueue(queue) UAVObjConnectQueue(ActuatorCommandHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define ActuatorCommandConnectCallback(cb) UAVObjConnectCallback(ActuatorCommandHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define ActuatorCommandCreateInstance() UAVObjCreateInstance(ActuatorCommandHandle())
|
||||
#define ActuatorCommandRequestUpdate() UAVObjRequestUpdate(ActuatorCommandHandle())
|
||||
#define ActuatorCommandRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(ActuatorCommandHandle(), instId)
|
||||
#define ActuatorCommandUpdated() UAVObjUpdated(ActuatorCommandHandle())
|
||||
#define ActuatorCommandInstUpdated(instId) UAVObjUpdated(ActuatorCommandHandle(), instId)
|
||||
#define ActuatorCommandGetMetadata(dataOut) UAVObjGetMetadata(ActuatorCommandHandle(), dataOut)
|
||||
#define ActuatorCommandSetMetadata(dataIn) UAVObjSetMetadata(ActuatorCommandHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
int16_t Channel[8];
|
||||
|
||||
} __attribute__((packed)) ActuatorCommandData;
|
||||
|
||||
// Field information
|
||||
// Field Channel information
|
||||
/* Number of elements for field Channel */
|
||||
#define ACTUATORCOMMAND_CHANNEL_NUMELEM 8
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t ActuatorCommandInitialize();
|
||||
UAVObjHandle ActuatorCommandHandle();
|
||||
|
||||
#endif // ACTUATORCOMMAND_H
|
78
flight/OpenPilot/UAVObjects/inc/actuatordesired.h
Normal file
78
flight/OpenPilot/UAVObjects/inc/actuatordesired.h
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuatordesired.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ActuatorDesired object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: actuatordesired.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 ACTUATORDESIRED_H
|
||||
#define ACTUATORDESIRED_H
|
||||
|
||||
// Object constants
|
||||
#define ACTUATORDESIRED_OBJID 123085850U
|
||||
#define ACTUATORDESIRED_NAME "ActuatorDesired"
|
||||
#define ACTUATORDESIRED_METANAME "ActuatorDesiredMeta"
|
||||
#define ACTUATORDESIRED_ISSINGLEINST 1
|
||||
#define ACTUATORDESIRED_ISSETTINGS 0
|
||||
#define ACTUATORDESIRED_NUMBYTES sizeof(ActuatorDesiredData)
|
||||
|
||||
// Object access macros
|
||||
#define ActuatorDesiredGet(dataOut) UAVObjGetData(ActuatorDesiredHandle(), dataOut)
|
||||
#define ActuatorDesiredSet(dataIn) UAVObjSetData(ActuatorDesiredHandle(), dataIn)
|
||||
#define ActuatorDesiredInstGet(instId, dataOut) UAVObjGetInstanceData(ActuatorDesiredHandle(), instId, dataOut)
|
||||
#define ActuatorDesiredInstSet(instId, dataIn) UAVObjSetInstanceData(ActuatorDesiredHandle(), instId, dataIn)
|
||||
#define ActuatorDesiredConnectQueue(queue) UAVObjConnectQueue(ActuatorDesiredHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define ActuatorDesiredConnectCallback(cb) UAVObjConnectCallback(ActuatorDesiredHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define ActuatorDesiredCreateInstance() UAVObjCreateInstance(ActuatorDesiredHandle())
|
||||
#define ActuatorDesiredRequestUpdate() UAVObjRequestUpdate(ActuatorDesiredHandle())
|
||||
#define ActuatorDesiredRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(ActuatorDesiredHandle(), instId)
|
||||
#define ActuatorDesiredUpdated() UAVObjUpdated(ActuatorDesiredHandle())
|
||||
#define ActuatorDesiredInstUpdated(instId) UAVObjUpdated(ActuatorDesiredHandle(), instId)
|
||||
#define ActuatorDesiredGetMetadata(dataOut) UAVObjGetMetadata(ActuatorDesiredHandle(), dataOut)
|
||||
#define ActuatorDesiredSetMetadata(dataIn) UAVObjSetMetadata(ActuatorDesiredHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float Roll;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
float Throttle;
|
||||
|
||||
} __attribute__((packed)) ActuatorDesiredData;
|
||||
|
||||
// Field information
|
||||
// Field Roll information
|
||||
// Field Pitch information
|
||||
// Field Yaw information
|
||||
// Field Throttle information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t ActuatorDesiredInitialize();
|
||||
UAVObjHandle ActuatorDesiredHandle();
|
||||
|
||||
#endif // ACTUATORDESIRED_H
|
142
flight/OpenPilot/UAVObjects/inc/actuatorsettings.h
Normal file
142
flight/OpenPilot/UAVObjects/inc/actuatorsettings.h
Normal file
@ -0,0 +1,142 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file actuatorsettings.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ActuatorSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: actuatorsettings.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 ACTUATORSETTINGS_H
|
||||
#define ACTUATORSETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define ACTUATORSETTINGS_OBJID 3054509114U
|
||||
#define ACTUATORSETTINGS_NAME "ActuatorSettings"
|
||||
#define ACTUATORSETTINGS_METANAME "ActuatorSettingsMeta"
|
||||
#define ACTUATORSETTINGS_ISSINGLEINST 1
|
||||
#define ACTUATORSETTINGS_ISSETTINGS 1
|
||||
#define ACTUATORSETTINGS_NUMBYTES sizeof(ActuatorSettingsData)
|
||||
|
||||
// Object access macros
|
||||
#define ActuatorSettingsGet(dataOut) UAVObjGetData(ActuatorSettingsHandle(), dataOut)
|
||||
#define ActuatorSettingsSet(dataIn) UAVObjSetData(ActuatorSettingsHandle(), dataIn)
|
||||
#define ActuatorSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(ActuatorSettingsHandle(), instId, dataOut)
|
||||
#define ActuatorSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(ActuatorSettingsHandle(), instId, dataIn)
|
||||
#define ActuatorSettingsConnectQueue(queue) UAVObjConnectQueue(ActuatorSettingsHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define ActuatorSettingsConnectCallback(cb) UAVObjConnectCallback(ActuatorSettingsHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define ActuatorSettingsCreateInstance() UAVObjCreateInstance(ActuatorSettingsHandle())
|
||||
#define ActuatorSettingsRequestUpdate() UAVObjRequestUpdate(ActuatorSettingsHandle())
|
||||
#define ActuatorSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(ActuatorSettingsHandle(), instId)
|
||||
#define ActuatorSettingsUpdated() UAVObjUpdated(ActuatorSettingsHandle())
|
||||
#define ActuatorSettingsInstUpdated(instId) UAVObjUpdated(ActuatorSettingsHandle(), instId)
|
||||
#define ActuatorSettingsGetMetadata(dataOut) UAVObjGetMetadata(ActuatorSettingsHandle(), dataOut)
|
||||
#define ActuatorSettingsSetMetadata(dataIn) UAVObjSetMetadata(ActuatorSettingsHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t FixedWingRoll1;
|
||||
uint8_t FixedWingRoll2;
|
||||
uint8_t FixedWingPitch1;
|
||||
uint8_t FixedWingPitch2;
|
||||
uint8_t FixedWingYaw;
|
||||
uint8_t FixedWingThrottle;
|
||||
uint8_t VTOLMotorN;
|
||||
uint8_t VTOLMotorNE;
|
||||
uint8_t VTOLMotorE;
|
||||
uint8_t VTOLMotorSE;
|
||||
uint8_t VTOLMotorS;
|
||||
uint8_t VTOLMotorSW;
|
||||
uint8_t VTOLMotorW;
|
||||
uint8_t VTOLMotorNW;
|
||||
int16_t ChannelUpdateFreq[2];
|
||||
int16_t ChannelMax[8];
|
||||
int16_t ChannelNeutral[8];
|
||||
int16_t ChannelMin[8];
|
||||
|
||||
} __attribute__((packed)) ActuatorSettingsData;
|
||||
|
||||
// Field information
|
||||
// Field FixedWingRoll1 information
|
||||
/* Enumeration options for field FixedWingRoll1 */
|
||||
typedef enum { ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL1=0, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL2=1, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL3=2, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL4=3, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL5=4, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL6=5, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL7=6, ACTUATORSETTINGS_FIXEDWINGROLL1_CHANNEL8=7, ACTUATORSETTINGS_FIXEDWINGROLL1_NONE=8, } ActuatorSettingsFixedWingRoll1Options;
|
||||
// Field FixedWingRoll2 information
|
||||
/* Enumeration options for field FixedWingRoll2 */
|
||||
typedef enum { ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL1=0, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL2=1, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL3=2, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL4=3, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL5=4, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL6=5, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL7=6, ACTUATORSETTINGS_FIXEDWINGROLL2_CHANNEL8=7, ACTUATORSETTINGS_FIXEDWINGROLL2_NONE=8, } ActuatorSettingsFixedWingRoll2Options;
|
||||
// Field FixedWingPitch1 information
|
||||
/* Enumeration options for field FixedWingPitch1 */
|
||||
typedef enum { ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL1=0, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL2=1, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL3=2, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL4=3, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL5=4, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL6=5, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL7=6, ACTUATORSETTINGS_FIXEDWINGPITCH1_CHANNEL8=7, ACTUATORSETTINGS_FIXEDWINGPITCH1_NONE=8, } ActuatorSettingsFixedWingPitch1Options;
|
||||
// Field FixedWingPitch2 information
|
||||
/* Enumeration options for field FixedWingPitch2 */
|
||||
typedef enum { ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL1=0, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL2=1, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL3=2, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL4=3, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL5=4, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL6=5, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL7=6, ACTUATORSETTINGS_FIXEDWINGPITCH2_CHANNEL8=7, ACTUATORSETTINGS_FIXEDWINGPITCH2_NONE=8, } ActuatorSettingsFixedWingPitch2Options;
|
||||
// Field FixedWingYaw information
|
||||
/* Enumeration options for field FixedWingYaw */
|
||||
typedef enum { ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL1=0, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL2=1, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL3=2, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL4=3, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL5=4, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL6=5, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL7=6, ACTUATORSETTINGS_FIXEDWINGYAW_CHANNEL8=7, ACTUATORSETTINGS_FIXEDWINGYAW_NONE=8, } ActuatorSettingsFixedWingYawOptions;
|
||||
// Field FixedWingThrottle information
|
||||
/* Enumeration options for field FixedWingThrottle */
|
||||
typedef enum { ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL1=0, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL2=1, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL3=2, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL4=3, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL5=4, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL6=5, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL7=6, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_CHANNEL8=7, ACTUATORSETTINGS_FIXEDWINGTHROTTLE_NONE=8, } ActuatorSettingsFixedWingThrottleOptions;
|
||||
// Field VTOLMotorN information
|
||||
/* Enumeration options for field VTOLMotorN */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORN_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORN_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORN_NONE=8, } ActuatorSettingsVTOLMotorNOptions;
|
||||
// Field VTOLMotorNE information
|
||||
/* Enumeration options for field VTOLMotorNE */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORNE_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORNE_NONE=8, } ActuatorSettingsVTOLMotorNEOptions;
|
||||
// Field VTOLMotorE information
|
||||
/* Enumeration options for field VTOLMotorE */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORE_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORE_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORE_NONE=8, } ActuatorSettingsVTOLMotorEOptions;
|
||||
// Field VTOLMotorSE information
|
||||
/* Enumeration options for field VTOLMotorSE */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORSE_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORSE_NONE=8, } ActuatorSettingsVTOLMotorSEOptions;
|
||||
// Field VTOLMotorS information
|
||||
/* Enumeration options for field VTOLMotorS */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORS_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORS_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORS_NONE=8, } ActuatorSettingsVTOLMotorSOptions;
|
||||
// Field VTOLMotorSW information
|
||||
/* Enumeration options for field VTOLMotorSW */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORSW_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORSW_NONE=8, } ActuatorSettingsVTOLMotorSWOptions;
|
||||
// Field VTOLMotorW information
|
||||
/* Enumeration options for field VTOLMotorW */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORW_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORW_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORW_NONE=8, } ActuatorSettingsVTOLMotorWOptions;
|
||||
// Field VTOLMotorNW information
|
||||
/* Enumeration options for field VTOLMotorNW */
|
||||
typedef enum { ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL1=0, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL2=1, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL3=2, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL4=3, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL5=4, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL6=5, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL7=6, ACTUATORSETTINGS_VTOLMOTORNW_CHANNEL8=7, ACTUATORSETTINGS_VTOLMOTORNW_NONE=8, } ActuatorSettingsVTOLMotorNWOptions;
|
||||
// Field ChannelUpdateFreq information
|
||||
/* Number of elements for field ChannelUpdateFreq */
|
||||
#define ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM 2
|
||||
// Field ChannelMax information
|
||||
/* Number of elements for field ChannelMax */
|
||||
#define ACTUATORSETTINGS_CHANNELMAX_NUMELEM 8
|
||||
// Field ChannelNeutral information
|
||||
/* Number of elements for field ChannelNeutral */
|
||||
#define ACTUATORSETTINGS_CHANNELNEUTRAL_NUMELEM 8
|
||||
// Field ChannelMin information
|
||||
/* Number of elements for field ChannelMin */
|
||||
#define ACTUATORSETTINGS_CHANNELMIN_NUMELEM 8
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t ActuatorSettingsInitialize();
|
||||
UAVObjHandle ActuatorSettingsHandle();
|
||||
|
||||
#endif // ACTUATORSETTINGS_H
|
78
flight/OpenPilot/UAVObjects/inc/attitudedesired.h
Normal file
78
flight/OpenPilot/UAVObjects/inc/attitudedesired.h
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file attitudedesired.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the AttitudeDesired object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: attitudedesired.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 ATTITUDEDESIRED_H
|
||||
#define ATTITUDEDESIRED_H
|
||||
|
||||
// Object constants
|
||||
#define ATTITUDEDESIRED_OBJID 1412270808U
|
||||
#define ATTITUDEDESIRED_NAME "AttitudeDesired"
|
||||
#define ATTITUDEDESIRED_METANAME "AttitudeDesiredMeta"
|
||||
#define ATTITUDEDESIRED_ISSINGLEINST 1
|
||||
#define ATTITUDEDESIRED_ISSETTINGS 0
|
||||
#define ATTITUDEDESIRED_NUMBYTES sizeof(AttitudeDesiredData)
|
||||
|
||||
// Object access macros
|
||||
#define AttitudeDesiredGet(dataOut) UAVObjGetData(AttitudeDesiredHandle(), dataOut)
|
||||
#define AttitudeDesiredSet(dataIn) UAVObjSetData(AttitudeDesiredHandle(), dataIn)
|
||||
#define AttitudeDesiredInstGet(instId, dataOut) UAVObjGetInstanceData(AttitudeDesiredHandle(), instId, dataOut)
|
||||
#define AttitudeDesiredInstSet(instId, dataIn) UAVObjSetInstanceData(AttitudeDesiredHandle(), instId, dataIn)
|
||||
#define AttitudeDesiredConnectQueue(queue) UAVObjConnectQueue(AttitudeDesiredHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define AttitudeDesiredConnectCallback(cb) UAVObjConnectCallback(AttitudeDesiredHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define AttitudeDesiredCreateInstance() UAVObjCreateInstance(AttitudeDesiredHandle())
|
||||
#define AttitudeDesiredRequestUpdate() UAVObjRequestUpdate(AttitudeDesiredHandle())
|
||||
#define AttitudeDesiredRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(AttitudeDesiredHandle(), instId)
|
||||
#define AttitudeDesiredUpdated() UAVObjUpdated(AttitudeDesiredHandle())
|
||||
#define AttitudeDesiredInstUpdated(instId) UAVObjUpdated(AttitudeDesiredHandle(), instId)
|
||||
#define AttitudeDesiredGetMetadata(dataOut) UAVObjGetMetadata(AttitudeDesiredHandle(), dataOut)
|
||||
#define AttitudeDesiredSetMetadata(dataIn) UAVObjSetMetadata(AttitudeDesiredHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float Roll;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
float Throttle;
|
||||
|
||||
} __attribute__((packed)) AttitudeDesiredData;
|
||||
|
||||
// Field information
|
||||
// Field Roll information
|
||||
// Field Pitch information
|
||||
// Field Yaw information
|
||||
// Field Throttle information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t AttitudeDesiredInitialize();
|
||||
UAVObjHandle AttitudeDesiredHandle();
|
||||
|
||||
#endif // ATTITUDEDESIRED_H
|
90
flight/OpenPilot/UAVObjects/inc/manualcontrolcommand.h
Normal file
90
flight/OpenPilot/UAVObjects/inc/manualcontrolcommand.h
Normal file
@ -0,0 +1,90 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file manualcontrolcommand.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ManualControlCommand object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: manualcontrolcommand.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 MANUALCONTROLCOMMAND_H
|
||||
#define MANUALCONTROLCOMMAND_H
|
||||
|
||||
// Object constants
|
||||
#define MANUALCONTROLCOMMAND_OBJID 990495372U
|
||||
#define MANUALCONTROLCOMMAND_NAME "ManualControlCommand"
|
||||
#define MANUALCONTROLCOMMAND_METANAME "ManualControlCommandMeta"
|
||||
#define MANUALCONTROLCOMMAND_ISSINGLEINST 1
|
||||
#define MANUALCONTROLCOMMAND_ISSETTINGS 0
|
||||
#define MANUALCONTROLCOMMAND_NUMBYTES sizeof(ManualControlCommandData)
|
||||
|
||||
// Object access macros
|
||||
#define ManualControlCommandGet(dataOut) UAVObjGetData(ManualControlCommandHandle(), dataOut)
|
||||
#define ManualControlCommandSet(dataIn) UAVObjSetData(ManualControlCommandHandle(), dataIn)
|
||||
#define ManualControlCommandInstGet(instId, dataOut) UAVObjGetInstanceData(ManualControlCommandHandle(), instId, dataOut)
|
||||
#define ManualControlCommandInstSet(instId, dataIn) UAVObjSetInstanceData(ManualControlCommandHandle(), instId, dataIn)
|
||||
#define ManualControlCommandConnectQueue(queue) UAVObjConnectQueue(ManualControlCommandHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define ManualControlCommandConnectCallback(cb) UAVObjConnectCallback(ManualControlCommandHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define ManualControlCommandCreateInstance() UAVObjCreateInstance(ManualControlCommandHandle())
|
||||
#define ManualControlCommandRequestUpdate() UAVObjRequestUpdate(ManualControlCommandHandle())
|
||||
#define ManualControlCommandRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(ManualControlCommandHandle(), instId)
|
||||
#define ManualControlCommandUpdated() UAVObjUpdated(ManualControlCommandHandle())
|
||||
#define ManualControlCommandInstUpdated(instId) UAVObjUpdated(ManualControlCommandHandle(), instId)
|
||||
#define ManualControlCommandGetMetadata(dataOut) UAVObjGetMetadata(ManualControlCommandHandle(), dataOut)
|
||||
#define ManualControlCommandSetMetadata(dataIn) UAVObjSetMetadata(ManualControlCommandHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t Connected;
|
||||
float Roll;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
float Throttle;
|
||||
uint8_t FlightMode;
|
||||
int16_t Channel[8];
|
||||
|
||||
} __attribute__((packed)) ManualControlCommandData;
|
||||
|
||||
// Field information
|
||||
// Field Connected information
|
||||
/* Enumeration options for field Connected */
|
||||
typedef enum { MANUALCONTROLCOMMAND_CONNECTED_FALSE=0, MANUALCONTROLCOMMAND_CONNECTED_TRUE=1, } ManualControlCommandConnectedOptions;
|
||||
// Field Roll information
|
||||
// Field Pitch information
|
||||
// Field Yaw information
|
||||
// Field Throttle information
|
||||
// Field FlightMode information
|
||||
/* Enumeration options for field FlightMode */
|
||||
typedef enum { MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL=0, MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED=1, MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO=2, } ManualControlCommandFlightModeOptions;
|
||||
// Field Channel information
|
||||
/* Number of elements for field Channel */
|
||||
#define MANUALCONTROLCOMMAND_CHANNEL_NUMELEM 8
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t ManualControlCommandInitialize();
|
||||
UAVObjHandle ManualControlCommandHandle();
|
||||
|
||||
#endif // MANUALCONTROLCOMMAND_H
|
106
flight/OpenPilot/UAVObjects/inc/manualcontrolsettings.h
Normal file
106
flight/OpenPilot/UAVObjects/inc/manualcontrolsettings.h
Normal file
@ -0,0 +1,106 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file manualcontrolsettings.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ManualControlSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: manualcontrolsettings.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 MANUALCONTROLSETTINGS_H
|
||||
#define MANUALCONTROLSETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define MANUALCONTROLSETTINGS_OBJID 2933673028U
|
||||
#define MANUALCONTROLSETTINGS_NAME "ManualControlSettings"
|
||||
#define MANUALCONTROLSETTINGS_METANAME "ManualControlSettingsMeta"
|
||||
#define MANUALCONTROLSETTINGS_ISSINGLEINST 1
|
||||
#define MANUALCONTROLSETTINGS_ISSETTINGS 1
|
||||
#define MANUALCONTROLSETTINGS_NUMBYTES sizeof(ManualControlSettingsData)
|
||||
|
||||
// Object access macros
|
||||
#define ManualControlSettingsGet(dataOut) UAVObjGetData(ManualControlSettingsHandle(), dataOut)
|
||||
#define ManualControlSettingsSet(dataIn) UAVObjSetData(ManualControlSettingsHandle(), dataIn)
|
||||
#define ManualControlSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(ManualControlSettingsHandle(), instId, dataOut)
|
||||
#define ManualControlSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(ManualControlSettingsHandle(), instId, dataIn)
|
||||
#define ManualControlSettingsConnectQueue(queue) UAVObjConnectQueue(ManualControlSettingsHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define ManualControlSettingsConnectCallback(cb) UAVObjConnectCallback(ManualControlSettingsHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define ManualControlSettingsCreateInstance() UAVObjCreateInstance(ManualControlSettingsHandle())
|
||||
#define ManualControlSettingsRequestUpdate() UAVObjRequestUpdate(ManualControlSettingsHandle())
|
||||
#define ManualControlSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(ManualControlSettingsHandle(), instId)
|
||||
#define ManualControlSettingsUpdated() UAVObjUpdated(ManualControlSettingsHandle())
|
||||
#define ManualControlSettingsInstUpdated(instId) UAVObjUpdated(ManualControlSettingsHandle(), instId)
|
||||
#define ManualControlSettingsGetMetadata(dataOut) UAVObjGetMetadata(ManualControlSettingsHandle(), dataOut)
|
||||
#define ManualControlSettingsSetMetadata(dataIn) UAVObjSetMetadata(ManualControlSettingsHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t InputMode;
|
||||
uint8_t Roll;
|
||||
uint8_t Pitch;
|
||||
uint8_t Yaw;
|
||||
uint8_t Throttle;
|
||||
uint8_t FlightMode;
|
||||
int16_t ChannelMax[8];
|
||||
int16_t ChannelNeutral[8];
|
||||
int16_t ChannelMin[8];
|
||||
|
||||
} __attribute__((packed)) ManualControlSettingsData;
|
||||
|
||||
// Field information
|
||||
// Field InputMode information
|
||||
/* Enumeration options for field InputMode */
|
||||
typedef enum { MANUALCONTROLSETTINGS_INPUTMODE_PWM=0, MANUALCONTROLSETTINGS_INPUTMODE_PPM=1, MANUALCONTROLSETTINGS_INPUTMODE_SPEKTRUM=2, } ManualControlSettingsInputModeOptions;
|
||||
// Field Roll information
|
||||
/* Enumeration options for field Roll */
|
||||
typedef enum { MANUALCONTROLSETTINGS_ROLL_CHANNEL1=0, MANUALCONTROLSETTINGS_ROLL_CHANNEL2=1, MANUALCONTROLSETTINGS_ROLL_CHANNEL3=2, MANUALCONTROLSETTINGS_ROLL_CHANNEL4=3, MANUALCONTROLSETTINGS_ROLL_CHANNEL5=4, MANUALCONTROLSETTINGS_ROLL_CHANNEL6=5, MANUALCONTROLSETTINGS_ROLL_CHANNEL7=6, MANUALCONTROLSETTINGS_ROLL_CHANNEL8=7, MANUALCONTROLSETTINGS_ROLL_NONE=8, } ManualControlSettingsRollOptions;
|
||||
// Field Pitch information
|
||||
/* Enumeration options for field Pitch */
|
||||
typedef enum { MANUALCONTROLSETTINGS_PITCH_CHANNEL1=0, MANUALCONTROLSETTINGS_PITCH_CHANNEL2=1, MANUALCONTROLSETTINGS_PITCH_CHANNEL3=2, MANUALCONTROLSETTINGS_PITCH_CHANNEL4=3, MANUALCONTROLSETTINGS_PITCH_CHANNEL5=4, MANUALCONTROLSETTINGS_PITCH_CHANNEL6=5, MANUALCONTROLSETTINGS_PITCH_CHANNEL7=6, MANUALCONTROLSETTINGS_PITCH_CHANNEL8=7, MANUALCONTROLSETTINGS_PITCH_NONE=8, } ManualControlSettingsPitchOptions;
|
||||
// Field Yaw information
|
||||
/* Enumeration options for field Yaw */
|
||||
typedef enum { MANUALCONTROLSETTINGS_YAW_CHANNEL1=0, MANUALCONTROLSETTINGS_YAW_CHANNEL2=1, MANUALCONTROLSETTINGS_YAW_CHANNEL3=2, MANUALCONTROLSETTINGS_YAW_CHANNEL4=3, MANUALCONTROLSETTINGS_YAW_CHANNEL5=4, MANUALCONTROLSETTINGS_YAW_CHANNEL6=5, MANUALCONTROLSETTINGS_YAW_CHANNEL7=6, MANUALCONTROLSETTINGS_YAW_CHANNEL8=7, MANUALCONTROLSETTINGS_YAW_NONE=8, } ManualControlSettingsYawOptions;
|
||||
// Field Throttle information
|
||||
/* Enumeration options for field Throttle */
|
||||
typedef enum { MANUALCONTROLSETTINGS_THROTTLE_CHANNEL1=0, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL2=1, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL3=2, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL4=3, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL5=4, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL6=5, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL7=6, MANUALCONTROLSETTINGS_THROTTLE_CHANNEL8=7, MANUALCONTROLSETTINGS_THROTTLE_NONE=8, } ManualControlSettingsThrottleOptions;
|
||||
// Field FlightMode information
|
||||
/* Enumeration options for field FlightMode */
|
||||
typedef enum { MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL1=0, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL2=1, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL3=2, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL4=3, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL5=4, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL6=5, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL7=6, MANUALCONTROLSETTINGS_FLIGHTMODE_CHANNEL8=7, MANUALCONTROLSETTINGS_FLIGHTMODE_NONE=8, } ManualControlSettingsFlightModeOptions;
|
||||
// Field ChannelMax information
|
||||
/* Number of elements for field ChannelMax */
|
||||
#define MANUALCONTROLSETTINGS_CHANNELMAX_NUMELEM 8
|
||||
// Field ChannelNeutral information
|
||||
/* Number of elements for field ChannelNeutral */
|
||||
#define MANUALCONTROLSETTINGS_CHANNELNEUTRAL_NUMELEM 8
|
||||
// Field ChannelMin information
|
||||
/* Number of elements for field ChannelMin */
|
||||
#define MANUALCONTROLSETTINGS_CHANNELMIN_NUMELEM 8
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t ManualControlSettingsInitialize();
|
||||
UAVObjHandle ManualControlSettingsHandle();
|
||||
|
||||
#endif // MANUALCONTROLSETTINGS_H
|
76
flight/OpenPilot/UAVObjects/inc/stabilizationsettings.h
Normal file
76
flight/OpenPilot/UAVObjects/inc/stabilizationsettings.h
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file stabilizationsettings.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the StabilizationSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: stabilizationsettings.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 STABILIZATIONSETTINGS_H
|
||||
#define STABILIZATIONSETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define STABILIZATIONSETTINGS_OBJID 1855169608U
|
||||
#define STABILIZATIONSETTINGS_NAME "StabilizationSettings"
|
||||
#define STABILIZATIONSETTINGS_METANAME "StabilizationSettingsMeta"
|
||||
#define STABILIZATIONSETTINGS_ISSINGLEINST 1
|
||||
#define STABILIZATIONSETTINGS_ISSETTINGS 1
|
||||
#define STABILIZATIONSETTINGS_NUMBYTES sizeof(StabilizationSettingsData)
|
||||
|
||||
// Object access macros
|
||||
#define StabilizationSettingsGet(dataOut) UAVObjGetData(StabilizationSettingsHandle(), dataOut)
|
||||
#define StabilizationSettingsSet(dataIn) UAVObjSetData(StabilizationSettingsHandle(), dataIn)
|
||||
#define StabilizationSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(StabilizationSettingsHandle(), instId, dataOut)
|
||||
#define StabilizationSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(StabilizationSettingsHandle(), instId, dataIn)
|
||||
#define StabilizationSettingsConnectQueue(queue) UAVObjConnectQueue(StabilizationSettingsHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define StabilizationSettingsConnectCallback(cb) UAVObjConnectCallback(StabilizationSettingsHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define StabilizationSettingsCreateInstance() UAVObjCreateInstance(StabilizationSettingsHandle())
|
||||
#define StabilizationSettingsRequestUpdate() UAVObjRequestUpdate(StabilizationSettingsHandle())
|
||||
#define StabilizationSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(StabilizationSettingsHandle(), instId)
|
||||
#define StabilizationSettingsUpdated() UAVObjUpdated(StabilizationSettingsHandle())
|
||||
#define StabilizationSettingsInstUpdated(instId) UAVObjUpdated(StabilizationSettingsHandle(), instId)
|
||||
#define StabilizationSettingsGetMetadata(dataOut) UAVObjGetMetadata(StabilizationSettingsHandle(), dataOut)
|
||||
#define StabilizationSettingsSetMetadata(dataIn) UAVObjSetMetadata(StabilizationSettingsHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float RollMax;
|
||||
float PitchMax;
|
||||
float ThrottleMax;
|
||||
|
||||
} __attribute__((packed)) StabilizationSettingsData;
|
||||
|
||||
// Field information
|
||||
// Field RollMax information
|
||||
// Field PitchMax information
|
||||
// Field ThrottleMax information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t StabilizationSettingsInitialize();
|
||||
UAVObjHandle StabilizationSettingsHandle();
|
||||
|
||||
#endif // STABILIZATIONSETTINGS_H
|
@ -33,7 +33,7 @@
|
||||
#define SYSTEMALARMS_H
|
||||
|
||||
// Object constants
|
||||
#define SYSTEMALARMS_OBJID 2311311458U
|
||||
#define SYSTEMALARMS_OBJID 2311311520U
|
||||
#define SYSTEMALARMS_NAME "SystemAlarms"
|
||||
#define SYSTEMALARMS_METANAME "SystemAlarmsMeta"
|
||||
#define SYSTEMALARMS_ISSINGLEINST 1
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t Alarm[6];
|
||||
uint8_t Alarm[8];
|
||||
|
||||
} __attribute__((packed)) SystemAlarmsData;
|
||||
|
||||
@ -66,9 +66,9 @@ typedef struct {
|
||||
/* Enumeration options for field Alarm */
|
||||
typedef enum { SYSTEMALARMS_ALARM_OK=0, SYSTEMALARMS_ALARM_WARNING=1, SYSTEMALARMS_ALARM_ERROR=2, SYSTEMALARMS_ALARM_CRITICAL=3, } SystemAlarmsAlarmOptions;
|
||||
/* Array element names for field Alarm */
|
||||
typedef enum { SYSTEMALARMS_ALARM_OUTOFMEMORY=0, SYSTEMALARMS_ALARM_STACKOVERFLOW=1, SYSTEMALARMS_ALARM_CPUOVERLOAD=2, SYSTEMALARMS_ALARM_EVENTSYSTEM=3, SYSTEMALARMS_ALARM_SDCARD=4, SYSTEMALARMS_ALARM_TELEMETRY=5, } SystemAlarmsAlarmElem;
|
||||
typedef enum { SYSTEMALARMS_ALARM_OUTOFMEMORY=0, SYSTEMALARMS_ALARM_STACKOVERFLOW=1, SYSTEMALARMS_ALARM_CPUOVERLOAD=2, SYSTEMALARMS_ALARM_EVENTSYSTEM=3, SYSTEMALARMS_ALARM_SDCARD=4, SYSTEMALARMS_ALARM_TELEMETRY=5, SYSTEMALARMS_ALARM_MANUALCONTROL=6, SYSTEMALARMS_ALARM_ACTUATOR=7, } SystemAlarmsAlarmElem;
|
||||
/* Number of elements for field Alarm */
|
||||
#define SYSTEMALARMS_ALARM_NUMELEM 6
|
||||
#define SYSTEMALARMS_ALARM_NUMELEM 8
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
74
flight/OpenPilot/UAVObjects/inc/systemsettings.h
Normal file
74
flight/OpenPilot/UAVObjects/inc/systemsettings.h
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file systemsettings.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the SystemSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: systemsettings.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 SYSTEMSETTINGS_H
|
||||
#define SYSTEMSETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define SYSTEMSETTINGS_OBJID 59202798U
|
||||
#define SYSTEMSETTINGS_NAME "SystemSettings"
|
||||
#define SYSTEMSETTINGS_METANAME "SystemSettingsMeta"
|
||||
#define SYSTEMSETTINGS_ISSINGLEINST 1
|
||||
#define SYSTEMSETTINGS_ISSETTINGS 1
|
||||
#define SYSTEMSETTINGS_NUMBYTES sizeof(SystemSettingsData)
|
||||
|
||||
// Object access macros
|
||||
#define SystemSettingsGet(dataOut) UAVObjGetData(SystemSettingsHandle(), dataOut)
|
||||
#define SystemSettingsSet(dataIn) UAVObjSetData(SystemSettingsHandle(), dataIn)
|
||||
#define SystemSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(SystemSettingsHandle(), instId, dataOut)
|
||||
#define SystemSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(SystemSettingsHandle(), instId, dataIn)
|
||||
#define SystemSettingsConnectQueue(queue) UAVObjConnectQueue(SystemSettingsHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define SystemSettingsConnectCallback(cb) UAVObjConnectCallback(SystemSettingsHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define SystemSettingsCreateInstance() UAVObjCreateInstance(SystemSettingsHandle())
|
||||
#define SystemSettingsRequestUpdate() UAVObjRequestUpdate(SystemSettingsHandle())
|
||||
#define SystemSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(SystemSettingsHandle(), instId)
|
||||
#define SystemSettingsUpdated() UAVObjUpdated(SystemSettingsHandle())
|
||||
#define SystemSettingsInstUpdated(instId) UAVObjUpdated(SystemSettingsHandle(), instId)
|
||||
#define SystemSettingsGetMetadata(dataOut) UAVObjGetMetadata(SystemSettingsHandle(), dataOut)
|
||||
#define SystemSettingsSetMetadata(dataIn) UAVObjSetMetadata(SystemSettingsHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t AirframeType;
|
||||
|
||||
} __attribute__((packed)) SystemSettingsData;
|
||||
|
||||
// Field information
|
||||
// Field AirframeType information
|
||||
/* Enumeration options for field AirframeType */
|
||||
typedef enum { SYSTEMSETTINGS_AIRFRAMETYPE_FIXEDWING=0, SYSTEMSETTINGS_AIRFRAMETYPE_FIXEDWINGELEVON=1, SYSTEMSETTINGS_AIRFRAMETYPE_VTOL=2, } SystemSettingsAirframeTypeOptions;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t SystemSettingsInitialize();
|
||||
UAVObjHandle SystemSettingsHandle();
|
||||
|
||||
#endif // SYSTEMSETTINGS_H
|
100
flight/OpenPilot/UAVObjects/manualcontrolcommand.c
Normal file
100
flight/OpenPilot/UAVObjects/manualcontrolcommand.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file manualcontrolcommand.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ManualControlCommand object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: manualcontrolcommand.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t ManualControlCommandInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(MANUALCONTROLCOMMAND_OBJID, MANUALCONTROLCOMMAND_NAME, MANUALCONTROLCOMMAND_METANAME, 0,
|
||||
MANUALCONTROLCOMMAND_ISSINGLEINST, MANUALCONTROLCOMMAND_ISSETTINGS, MANUALCONTROLCOMMAND_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
ManualControlCommandData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(ManualControlCommandData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 3000;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle ManualControlCommandHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
130
flight/OpenPilot/UAVObjects/manualcontrolsettings.c
Normal file
130
flight/OpenPilot/UAVObjects/manualcontrolsettings.c
Normal file
@ -0,0 +1,130 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file manualcontrolsettings.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the ManualControlSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: manualcontrolsettings.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t ManualControlSettingsInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(MANUALCONTROLSETTINGS_OBJID, MANUALCONTROLSETTINGS_NAME, MANUALCONTROLSETTINGS_METANAME, 0,
|
||||
MANUALCONTROLSETTINGS_ISSINGLEINST, MANUALCONTROLSETTINGS_ISSETTINGS, MANUALCONTROLSETTINGS_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
ManualControlSettingsData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(ManualControlSettingsData));
|
||||
data.InputMode = 0;
|
||||
data.Roll = 0;
|
||||
data.Pitch = 1;
|
||||
data.Yaw = 2;
|
||||
data.Throttle = 3;
|
||||
data.FlightMode = 4;
|
||||
data.ChannelMax[0] = 2000;
|
||||
data.ChannelMax[1] = 2000;
|
||||
data.ChannelMax[2] = 2000;
|
||||
data.ChannelMax[3] = 2000;
|
||||
data.ChannelMax[4] = 2000;
|
||||
data.ChannelMax[5] = 2000;
|
||||
data.ChannelMax[6] = 2000;
|
||||
data.ChannelMax[7] = 2000;
|
||||
data.ChannelNeutral[0] = 1500;
|
||||
data.ChannelNeutral[1] = 1500;
|
||||
data.ChannelNeutral[2] = 1500;
|
||||
data.ChannelNeutral[3] = 1500;
|
||||
data.ChannelNeutral[4] = 1500;
|
||||
data.ChannelNeutral[5] = 1500;
|
||||
data.ChannelNeutral[6] = 1500;
|
||||
data.ChannelNeutral[7] = 1500;
|
||||
data.ChannelMin[0] = 1000;
|
||||
data.ChannelMin[1] = 1000;
|
||||
data.ChannelMin[2] = 1000;
|
||||
data.ChannelMin[3] = 1000;
|
||||
data.ChannelMin[4] = 1000;
|
||||
data.ChannelMin[5] = 1000;
|
||||
data.ChannelMin[6] = 1000;
|
||||
data.ChannelMin[7] = 1000;
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.telemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle ManualControlSettingsHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
103
flight/OpenPilot/UAVObjects/stabilizationsettings.c
Normal file
103
flight/OpenPilot/UAVObjects/stabilizationsettings.c
Normal file
@ -0,0 +1,103 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file stabilizationsettings.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the StabilizationSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: stabilizationsettings.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "stabilizationsettings.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t StabilizationSettingsInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(STABILIZATIONSETTINGS_OBJID, STABILIZATIONSETTINGS_NAME, STABILIZATIONSETTINGS_METANAME, 0,
|
||||
STABILIZATIONSETTINGS_ISSINGLEINST, STABILIZATIONSETTINGS_ISSETTINGS, STABILIZATIONSETTINGS_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
StabilizationSettingsData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(StabilizationSettingsData));
|
||||
data.RollMax = 35;
|
||||
data.PitchMax = 35;
|
||||
data.ThrottleMax = 100;
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.telemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle StabilizationSettingsHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
101
flight/OpenPilot/UAVObjects/systemsettings.c
Normal file
101
flight/OpenPilot/UAVObjects/systemsettings.c
Normal file
@ -0,0 +1,101 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file systemsettings.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the SystemSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: systemsettings.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "systemsettings.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t SystemSettingsInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(SYSTEMSETTINGS_OBJID, SYSTEMSETTINGS_NAME, SYSTEMSETTINGS_METANAME, 0,
|
||||
SYSTEMSETTINGS_ISSINGLEINST, SYSTEMSETTINGS_ISSETTINGS, SYSTEMSETTINGS_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
SystemSettingsData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(SystemSettingsData));
|
||||
data.AirframeType = 0;
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.telemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle SystemSettingsHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,14 +28,22 @@
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "actuatorcommand.h"
|
||||
#include "actuatordesired.h"
|
||||
#include "actuatorsettings.h"
|
||||
#include "attitudedesired.h"
|
||||
#include "exampleobject1.h"
|
||||
#include "exampleobject2.h"
|
||||
#include "examplesettings.h"
|
||||
#include "flighttelemetrystats.h"
|
||||
#include "gcstelemetrystats.h"
|
||||
#include "gpsobject.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
#include "objectpersistence.h"
|
||||
#include "stabilizationsettings.h"
|
||||
#include "systemalarms.h"
|
||||
#include "systemsettings.h"
|
||||
#include "systemstats.h"
|
||||
#include "telemetrysettings.h"
|
||||
|
||||
@ -46,14 +54,22 @@
|
||||
*/
|
||||
void UAVObjectsInitializeAll()
|
||||
{
|
||||
ActuatorCommandInitialize();
|
||||
ActuatorDesiredInitialize();
|
||||
ActuatorSettingsInitialize();
|
||||
AttitudeDesiredInitialize();
|
||||
ExampleObject1Initialize();
|
||||
ExampleObject2Initialize();
|
||||
ExampleSettingsInitialize();
|
||||
FlightTelemetryStatsInitialize();
|
||||
GCSTelemetryStatsInitialize();
|
||||
GpsObjectInitialize();
|
||||
ManualControlCommandInitialize();
|
||||
ManualControlSettingsInitialize();
|
||||
ObjectPersistenceInitialize();
|
||||
StabilizationSettingsInitialize();
|
||||
SystemAlarmsInitialize();
|
||||
SystemSettingsInitialize();
|
||||
SystemStatsInitialize();
|
||||
TelemetrySettingsInitialize();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user