1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Added a (fake) pios_servo module in PiOS.posix, this makes it possible to compile the Actuator module and see servo output values, or at least

what they would be on a real board. Also fixed a typo in stabilization.c which made me lose time when trying to understand the code...




git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2260 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-12-20 16:38:17 +00:00 committed by edouard
parent 801568269c
commit d8edab8371
10 changed files with 131 additions and 4 deletions

View File

@ -57,7 +57,7 @@ FLASH_TOOL = OPENOCD
USE_THUMB_MODE = YES
# List of modules to include
MODULES = Actuator Telemetry GPS ManualControl Altitude AHRSComms Stabilization Watchdog FirmwareIAP
MODULES = Actuator Telemetry GPS ManualControl Altitude AHRSComms Stabilization Guidance Watchdog FirmwareIAP
#MODULES = Telemetry Example
#MODULES = Telemetry MK/MKSerial

View File

@ -53,8 +53,8 @@ FLASH_TOOL = OPENOCD
USE_THUMB_MODE = YES
# List of modules to include
MODULES = Telemetry Stabilization Guidance ManualControl
#MODULES = Telemetry GPS ManualControl Actuator Altitude Attitude Stabilization
MODULES = Telemetry Actuator Stabilization Guidance ManualControl
#MODULES = Telemetry ManualControl Actuator Attitude Stabilization
#MODULES = Telemetry Example
#MODULES = Telemetry MK/MKSerial
@ -173,6 +173,7 @@ SRC += $(PIOSPOSIX)/pios_delay.c
SRC += $(PIOSPOSIX)/pios_sdcard.c
SRC += $(PIOSPOSIX)/pios_udp.c
SRC += $(PIOSPOSIX)/pios_com.c
SRC += $(PIOSPOSIX)/pios_servo.c
#
## RTOS
SRC += $(RTOSSRCDIR)/list.c

View File

@ -30,6 +30,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
#include "actuator.h"
#include "actuatorsettings.h"

View File

@ -32,6 +32,8 @@
#ifndef ACTUATOR_H
#define ACTUATOR_H
#include <stdbool.h>
int32_t ActuatorInitialize();
#endif // ACTUATOR_H

View File

@ -130,7 +130,7 @@ static void stabilizationTask(void* parameters)
stabilization_updated = 1;
// Wait until the ActuatorDesired object is updated, if a timeout then go to failsafe
// Wait until the AttitudeRaw object is updated, if a timeout then go to failsafe
if ( xQueueReceive(queue, &ev, FAILSAFE_TIMEOUT_MS / portTICK_RATE_MS) != pdTRUE )
{
AlarmsSet(SYSTEMALARMS_ALARM_STABILIZATION,SYSTEMALARMS_ALARM_WARNING);

View File

@ -37,6 +37,8 @@
#define PIOS_INCLUDE_FREERTOS
#define PIOS_INCLUDE_COM
#define PIOS_INCLUDE_UDP
#define PIOS_INCLUDE_SERVO
/* Defaults for Logging */
#define LOG_FILENAME "PIOS.LOG"

View File

@ -30,5 +30,8 @@
#define FILEINFO FILE*
#define PIOS_SERVO_NUM_OUTPUTS 8
#define PIOS_SERVO_NUM_TIMERS PIOS_SERVO_NUM_OUTPUTS
#endif

View File

@ -0,0 +1,43 @@
/**
******************************************************************************
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_SERVO RC Servo Functions
* @{
*
* @file pios_servo.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief RC Servo functions header.
* @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 PIOS_SERVO_H
#define PIOS_SERVO_H
/* Public Functions */
extern void PIOS_Servo_Init(void);
extern void PIOS_Servo_SetHz(uint16_t onetofour, uint16_t fivetoeight);
extern void PIOS_Servo_Set(uint8_t Servo, uint16_t Position);
#endif /* PIOS_SERVO_H */
/**
* @}
* @}
*/

View File

@ -58,6 +58,7 @@
#include <pios_sdcard.h>
#include <pios_udp.h>
#include <pios_com.h>
#include <pios_servo.h>
#define NELEMENTS(x) (sizeof(x) / sizeof(*(x)))

View File

@ -0,0 +1,74 @@
/**
******************************************************************************
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_SERVO RC Servo Functions
* @brief Code to do set RC servo output
* @{
*
* @file pios_servo.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief RC Servo routines (STM32 dependent)
* @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
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_SERVO)
/* Private Function Prototypes */
/* Local Variables */
static volatile uint16_t ServoPosition[PIOS_SERVO_NUM_TIMERS];
/**
* Initialise Servos
*/
void PIOS_Servo_Init(void)
{
}
/**
* Set the servo update rate (Max 500Hz)
* \param[in] onetofour Rate for outputs 1 to 4 (Hz)
* \param[in] fivetoeight Rate for outputs 5 to 8 (Hz)
*/
void PIOS_Servo_SetHz(uint16_t onetofour, uint16_t fivetoeight)
{
}
/**
* Set servo position
* \param[in] Servo Servo number (0-7)
* \param[in] Position Servo position in milliseconds
*/
void PIOS_Servo_Set(uint8_t Servo, uint16_t Position)
{
#ifndef PIOS_ENABLE_DEBUG_PINS
/* Make sure servo exists */
if (Servo < PIOS_SERVO_NUM_OUTPUTS && Servo >= 0) {
/* Update the position */
ServoPosition[Servo] = Position;
}
#endif // PIOS_ENABLE_DEBUG_PINS
}
#endif