From ab7e57ad2b4f65dc125911ffa9572af127113c62 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Fri, 19 Aug 2011 09:52:05 -0500 Subject: [PATCH] Initialize objects for guidance in the correct place. Init some objects in pios_board_posix since AHRSComms not around. --- flight/Modules/AHRSComms/ahrs_comms.c | 11 ++++++----- flight/Modules/FlightPlan/flightplan.c | 6 +++++- flight/Modules/GPS/GPS.c | 2 +- flight/Modules/Guidance/guidance.c | 8 ++++++++ flight/OpenPilot/System/pios_board_posix.c | 8 ++++++++ 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/flight/Modules/AHRSComms/ahrs_comms.c b/flight/Modules/AHRSComms/ahrs_comms.c index b2afc17cc..c3fb45fae 100644 --- a/flight/Modules/AHRSComms/ahrs_comms.c +++ b/flight/Modules/AHRSComms/ahrs_comms.c @@ -73,11 +73,7 @@ static void ahrscommsTask(void *parameters); */ int32_t AHRSCommsStart(void) { - // Start main task - AhrsStatusInitialize(); - AHRSCalibrationInitialize(); - AttitudeRawInitialize(); - + // Start main task xTaskCreate(ahrscommsTask, (signed char *)"AHRSComms", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle); TaskMonitorAdd(TASKINFO_RUNNING_AHRSCOMMS, taskHandle); PIOS_WDG_RegisterFlag(PIOS_WDG_AHRS); @@ -91,6 +87,11 @@ int32_t AHRSCommsStart(void) */ int32_t AHRSCommsInitialize(void) { + AhrsStatusInitialize(); + AHRSCalibrationInitialize(); + AttitudeRawInitialize(); + VelocityActualInitialize(); + PositionActualInitialize(); return 0; } diff --git a/flight/Modules/FlightPlan/flightplan.c b/flight/Modules/FlightPlan/flightplan.c index 5537c8f15..e919dd41e 100644 --- a/flight/Modules/FlightPlan/flightplan.c +++ b/flight/Modules/FlightPlan/flightplan.c @@ -74,7 +74,11 @@ int32_t FlightPlanStart() int32_t FlightPlanInitialize() { taskHandle = NULL; - + + FlightPlanStatusInitialize(); + FlightPlanControlInitialize(); + FlightPlanSettingsInitialize(); + // Listen for object updates FlightPlanControlConnectCallback(&objectUpdatedCb); diff --git a/flight/Modules/GPS/GPS.c b/flight/Modules/GPS/GPS.c index c08964342..60ff80184 100644 --- a/flight/Modules/GPS/GPS.c +++ b/flight/Modules/GPS/GPS.c @@ -127,7 +127,7 @@ int32_t GPSInitialize(void) GPSPositionInitialize(); GPSTimeInitialize(); HomeLocationInitialize(); - + // TODO: Get gps settings object gpsPort = PIOS_COM_GPS; diff --git a/flight/Modules/Guidance/guidance.c b/flight/Modules/Guidance/guidance.c index 348210675..d1626923c 100644 --- a/flight/Modules/Guidance/guidance.c +++ b/flight/Modules/Guidance/guidance.c @@ -97,6 +97,14 @@ int32_t GuidanceStart() */ int32_t GuidanceInitialize() { + + GuidanceSettingsInitialize(); + PositionDesiredInitialize(); + ManualControlCommandInitialize(); + FlightStatusInitialize(); + NedAccelInitialize(); + VelocityDesiredInitialize(); + // Create object queue queue = xQueueCreate(MAX_QUEUE_SIZE, sizeof(UAVObjEvent)); diff --git a/flight/OpenPilot/System/pios_board_posix.c b/flight/OpenPilot/System/pios_board_posix.c index fa2cec9de..2285533aa 100644 --- a/flight/OpenPilot/System/pios_board_posix.c +++ b/flight/OpenPilot/System/pios_board_posix.c @@ -29,6 +29,10 @@ #include #include +#include "attituderaw.h" +#include "positionactual.h" +#include "velocityactual.h" + #include "pios_rcvr_priv.h" struct pios_rcvr_channel_map pios_rcvr_channel_to_id_map[PIOS_RCVR_MAX_CHANNELS]; @@ -171,6 +175,10 @@ void PIOS_Board_Init(void) { #endif /* PIOS_INCLUDE_GPS */ #endif + // Initialize these here as posix has no AHRSComms + AttitudeRawInitialize(); + VelocityActualInitialize(); + PositionActualInitialize(); }