diff --git a/apps/fac/LICENSE b/apps/fac/LICENSE new file mode 100644 index 000000000..78f2e7081 --- /dev/null +++ b/apps/fac/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2015, Windhover Labs +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of CmdIn nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/apps/fac/docs/dox_src/detailed_design/cfs_fac.dox b/apps/fac/docs/dox_src/detailed_design/cfs_fac.dox new file mode 100644 index 000000000..d99d541ac --- /dev/null +++ b/apps/fac/docs/dox_src/detailed_design/cfs_fac.dox @@ -0,0 +1,372 @@ +/*==========================================================================*/ +/* NOTE: */ +/* Additional notes to the Author can be found in comment blocks such */ +/* as this one. These comment blocks will not appear in the doxygen */ +/* output and do not need to be removed but can be if so desired. */ +/* All text found within the pages that is surrounded by "()" is */ +/* merely a suggestion as to the appropriate content the Author should */ +/* insert at that location. */ +/*==========================================================================*/ +/** + \mainpage FAC cFS Application (FAC) User's Guide + + +**/ + +/** + \page cfsfacrevhist FAC Application User's Guide Revision History + + This document is generated against #FAC_MAJOR_VERSION #FAC_MINOR_VERSION #FAC_REVISION. + + Next: \ref cfsfacintro + +**/ + +/*==========================================================================*/ +/* NOTE: The Author may wish to examine the Acronym list and ensure the */ +/* Application's abbreviation is put in alphabetical order. */ +/*==========================================================================*/ +/** + \page cfsfacintro FAC Application Introduction + +

Scope

+ + This document provides a complete specification for the commands and telemetry associated + with the FAC Application (FAC) software. The document is intended primarily + for users of the software (operations personal, test engineers, and maintenance personnel). + The last section of the document, the deployment guide section, is intended for mission + developers when deploying and configuring this application software for a mission + flight software build environment. + +

Applicable Documents

+ + + + + + + + +
Document ID Document Title
TBD FAC Application Requirements Document
TBD FAC Application Design Document
+ + +

Acronyms

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Acronym Description
API Application Programming Interface
CCSDS Consultative Committee for Space Data Systems
C&DH Command and Data Handling
CFE Core Flight Executive
CFS Core Flight System
Cmd Command
CPU Central Processing Unit
FSW Flight Software
HK Housekeeping telemetry, or CFS Housekeeping Application
HW, H/W Hardware
ICD Interface Control Document
ISR Interrupt Service Routine
OS Operating System
OSAL Operating System Abstraction Layer
Pkts Packets
RAM Random-Access Memory
RTOS Real Time Operating System
SB Software Bus Service
SW, S/W Software
TBD To Be Determined
TBL Table
TLM Telemetry
UTC Universal Coordinated Time (time scale)
+ + Prev: \ref cfsfacrevhist
+ Next: \ref cfsfacovr +**/ + +/** + \page cfsfacovr FAC Application Overview + + The FAC Application (FAC) application does some cool stuff. + + (Insert paragraph providing application purpose and a high level description of + application capabilites) + + FAC Design Overview + ==== + + (Insert text and/or diagrams to describe high-level design. Remember your audience is + not necessarily going to be a software engineer!) + + (Inserting Diagrams) + ---- + + (Diagrams can be inserted using the following formatting: + \image html My_Diagram_Image_Filename.jpg "My Diagram Label"
+ The referenced jpg file should be put into the same directory as this file.) + + Prev: \ref cfsfacintro
+ Next: \ref cfsfacopr +**/ + +/** + \page cfsfacopr FAC Application Operation + + (Insert intended operational scenarios. This should include references to appropriate commands + and telemetry points as needed. Detailed explanation of telemetry could also be useful.) + + 1. The application version number + ---- + + The application version number is displayed in the initialization event and the + no-op event. + + 2. Table Handling + ---- + + TODO High-level stuff on tables goes here. + + 3. Sending the No-op Command + ---- + + TODO Discuss the No-Op command here. + + 4. Sending the reset counters command + ---- + + TODO Discuss the reset counters command here. + + 5. Monitoring the command counter + ---- + + TODO Discuss the counter here. + + 6. Monitoring the command error counter + ---- + + TODO Discuss the counter behavior here. + + Next: \ref cfsfacreq
+ Prev: \ref cfsfacovr +**/ + +/** + \page cfsfacreq FAC Application Requirements + + The following are FAC application requirements. + + (Insert high level requirements and add a reference to where detailed requirements can be found) + + Next: \ref cfsfacdg
+ Prev: \ref cfsfacopr +**/ + +/** + \page cfsfacdg FAC Application Deployment Guide + + (Basic Instructions to the Author) + ==== + + (Insert text describing steps required to integrate the application with a CFS system. This should + include: + 1) References to message IDs that need to be inserted into a CFS Scheduler table + 2) References to telemetry that can be generated + 3) Additional description of application configuration parameters that may need to be modified. + For example, questions that a systems integrator needs to have answered before the application + can be successfully integrated + 4) References to the application's performance ID) + + Initial Integration + ==== + + The first step in deploying the FAC application is to do stuff. + + Application Tailoring to the Mission + ---- + + The fac_mission_cfg.h file, the fac_msgids.h, and the fac_perfids.h files + are tailored for the mission. These are built into the application during + compilation. + + Application Tailoring to the Platform + ---- + + In the fac_platform_cfg.h file, there are configuration parameters that control + FAC application behavior. This should be tailored to the specific platform + needs. This behavior is built into the application during compilation. + + CFS Scheduler Support + ---- + + TODO Discuss any commands that must be included in the CFS Scheduler Table + and any related tailoring/configuration. + + Next: \ref cfsfaccmds
+ Prev: \ref cfsfacreq +**/ + +/*==========================================================================*/ +/* NOTE: The Author does not need to add any material to the following page.*/ +/* It is filled automatically by doxygen. */ +/*==========================================================================*/ +/** + \page cfsfaccmds FAC Application Commands + + + + + +
\ref cfsfactlm \ref cfsfactbl \ref cfsfaccfg
+ + The following is a list of commands that are processed by the FAC Application: +**/ + +/*==========================================================================*/ +/* NOTE: The Author does not need to add any material to the following page.*/ +/* It is filled automatically by doxygen. */ +/*==========================================================================*/ +/** + \page cfsfactlm FAC Application Telemetry + + + + + +
\ref cfsfaccmds \ref cfsfactbl \ref cfsfaccfg
+ + The following is a list of telemetry that is generated by the FAC Application: +**/ + +/** + \page cfsfactbl FAC Application Table Definitions + + + + + +
\ref cfsfaccmds \ref cfsfactlm \ref cfsfaccfg
+ + (Include text describing data structures used in application tables. Further text can be used to + describe the process of populating the table if necessary. Default values may also be described) + +**/ + +/*==========================================================================*/ +/* NOTE: The Author does not need to add any material to the following page.*/ +/* It is filled automatically by doxygen. */ +/*==========================================================================*/ +/** + \page cfsfaccfg FAC Application Configuration Parameters + + + + + +
\ref cfsfaccmds \ref cfsfactlm \ref cfsfactbl
+ + The following are configuration parameters used to configure the FAC + Application either for each platform or for a mission as a whole. + +**/ + +/** + \page cfsfaccons FAC Application Operational Constraints + + (Instructions to the author) + ==== + + (Insert text that describes: + 1) situations that would prevent the application from starting + 2) causes for the application to terminate prematurely + 3) commands that cannot be issued either out of order or without sufficient wait time, etc) + + Application Termination + ==== + + Potential causes for FAC to terminate prematurely are an error return from the + software bus in the application main loop or error return from one of the cFE table + services functions when FAC tries to do table management (check for updates, dump + requests etc.) during each housekeeping cycle. + + Critical Data Store Operation + ==== + + When using the Critical Data Store (CDS), the results tables and housekeeping data + will only be restored if the application was shut down through cFE Executive Services + and exited clean. If this is not the case, default values will be used + (see \ref cfsfacfaqs). + + Next: \ref cfsfacfaqs
+ Prev: \ref cfsfactbl +**/ + +/** + \page cfsfacfaqs FAC Application Frequently Asked Questions + + (Insert text that categorizes a group of questions, if necessary, here. + For example, "General".) + + General + ==== + + (Q) + What is the basic flow of the application? +

+ The FAC application uses a common application format. When the app starts, + initialization is performed, then the app enters an infinite loop waiting for + commands from the software bus. + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Insert text that categorizes another group of questions, if necessary, here) + ==== + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + +**/ diff --git a/apps/fac/docs/dox_src/mnem_maps/cfs_fac_cmd_mnem_map b/apps/fac/docs/dox_src/mnem_maps/cfs_fac_cmd_mnem_map new file mode 100644 index 000000000..dbb2303f6 --- /dev/null +++ b/apps/fac/docs/dox_src/mnem_maps/cfs_fac_cmd_mnem_map @@ -0,0 +1,16 @@ +#--------------------------------------------------------------------------- +# Each of the following assignment statements should have the documentation +# mnemonic on the left followed by the mission specific command mnemonic +# on the right of the equals operator. +# +# FORMATTING DETAILS TO REMEMBER! +# 1) ALIASES MUST have "+=" as the operator +# 2) There CANNOT be spaces around the "=" operator on assignment statements +# 3) If there are multiple mnemonics for a particular data point, they should +# be separated by the following ", \b \c " and enclosed in double quotes to +# maintain proper formatting in the documentation. For example: +# ES_RESET="$sc_$cpu_ES_ProcessorReset, \b \c $sc_$cpu_ES_PowerOnReset" +#--------------------------------------------------------------------------- +ALIASES += FAC_NOOP=$sc_$cpu_FAC_NOOP +ALIASES += FAC_TLMRST=$sc_$cpu_FAC_ResetCtrs + diff --git a/apps/fac/docs/dox_src/mnem_maps/cfs_fac_tlm_mnem_map b/apps/fac/docs/dox_src/mnem_maps/cfs_fac_tlm_mnem_map new file mode 100644 index 000000000..d2e8754bd --- /dev/null +++ b/apps/fac/docs/dox_src/mnem_maps/cfs_fac_tlm_mnem_map @@ -0,0 +1,17 @@ +#--------------------------------------------------------------------------- +# Each of the following assignment statements should have the documentation +# mnemonic on the left followed by the mission specific telemetry mnemonic +# on the right of the equals operator. +# +# FORMATTING DETAILS TO REMEMBER! +# 1) ALIASES MUST have "+=" as the operator +# 2) There CANNOT be spaces around the "=" operator on assignment statements +# 3) If there are multiple mnemonics for a particular data point, they should +# be separated by the following ", \b \c " and enclosed in double quotes to +# maintain proper formatting in the documentation. For example: +# ES_RESET="$sc_$cpu_ES_ProcessorReset, \b \c $sc_$cpu_ES_PowerOnReset" +#--------------------------------------------------------------------------- +ALIASES += FAC_CMDACPTCNT=$sc_$cpu_FAC_CMDACTPCNT +ALIASES += FAC_CMDRJCTCNT=$sc_$cpu_FAC_CMDRJCTCNT + + diff --git a/apps/fac/docs/dox_src/users_guide/CFS_FAC_Context.jpg b/apps/fac/docs/dox_src/users_guide/CFS_FAC_Context.jpg new file mode 100644 index 000000000..9b4f3a23e Binary files /dev/null and b/apps/fac/docs/dox_src/users_guide/CFS_FAC_Context.jpg differ diff --git a/apps/fac/docs/dox_src/users_guide/cfs_fac.dox b/apps/fac/docs/dox_src/users_guide/cfs_fac.dox new file mode 100644 index 000000000..d99d541ac --- /dev/null +++ b/apps/fac/docs/dox_src/users_guide/cfs_fac.dox @@ -0,0 +1,372 @@ +/*==========================================================================*/ +/* NOTE: */ +/* Additional notes to the Author can be found in comment blocks such */ +/* as this one. These comment blocks will not appear in the doxygen */ +/* output and do not need to be removed but can be if so desired. */ +/* All text found within the pages that is surrounded by "()" is */ +/* merely a suggestion as to the appropriate content the Author should */ +/* insert at that location. */ +/*==========================================================================*/ +/** + \mainpage FAC cFS Application (FAC) User's Guide + + +**/ + +/** + \page cfsfacrevhist FAC Application User's Guide Revision History + + This document is generated against #FAC_MAJOR_VERSION #FAC_MINOR_VERSION #FAC_REVISION. + + Next: \ref cfsfacintro + +**/ + +/*==========================================================================*/ +/* NOTE: The Author may wish to examine the Acronym list and ensure the */ +/* Application's abbreviation is put in alphabetical order. */ +/*==========================================================================*/ +/** + \page cfsfacintro FAC Application Introduction + +

Scope

+ + This document provides a complete specification for the commands and telemetry associated + with the FAC Application (FAC) software. The document is intended primarily + for users of the software (operations personal, test engineers, and maintenance personnel). + The last section of the document, the deployment guide section, is intended for mission + developers when deploying and configuring this application software for a mission + flight software build environment. + +

Applicable Documents

+ + + + + + + + +
Document ID Document Title
TBD FAC Application Requirements Document
TBD FAC Application Design Document
+ + +

Acronyms

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Acronym Description
API Application Programming Interface
CCSDS Consultative Committee for Space Data Systems
C&DH Command and Data Handling
CFE Core Flight Executive
CFS Core Flight System
Cmd Command
CPU Central Processing Unit
FSW Flight Software
HK Housekeeping telemetry, or CFS Housekeeping Application
HW, H/W Hardware
ICD Interface Control Document
ISR Interrupt Service Routine
OS Operating System
OSAL Operating System Abstraction Layer
Pkts Packets
RAM Random-Access Memory
RTOS Real Time Operating System
SB Software Bus Service
SW, S/W Software
TBD To Be Determined
TBL Table
TLM Telemetry
UTC Universal Coordinated Time (time scale)
+ + Prev: \ref cfsfacrevhist
+ Next: \ref cfsfacovr +**/ + +/** + \page cfsfacovr FAC Application Overview + + The FAC Application (FAC) application does some cool stuff. + + (Insert paragraph providing application purpose and a high level description of + application capabilites) + + FAC Design Overview + ==== + + (Insert text and/or diagrams to describe high-level design. Remember your audience is + not necessarily going to be a software engineer!) + + (Inserting Diagrams) + ---- + + (Diagrams can be inserted using the following formatting: + \image html My_Diagram_Image_Filename.jpg "My Diagram Label"
+ The referenced jpg file should be put into the same directory as this file.) + + Prev: \ref cfsfacintro
+ Next: \ref cfsfacopr +**/ + +/** + \page cfsfacopr FAC Application Operation + + (Insert intended operational scenarios. This should include references to appropriate commands + and telemetry points as needed. Detailed explanation of telemetry could also be useful.) + + 1. The application version number + ---- + + The application version number is displayed in the initialization event and the + no-op event. + + 2. Table Handling + ---- + + TODO High-level stuff on tables goes here. + + 3. Sending the No-op Command + ---- + + TODO Discuss the No-Op command here. + + 4. Sending the reset counters command + ---- + + TODO Discuss the reset counters command here. + + 5. Monitoring the command counter + ---- + + TODO Discuss the counter here. + + 6. Monitoring the command error counter + ---- + + TODO Discuss the counter behavior here. + + Next: \ref cfsfacreq
+ Prev: \ref cfsfacovr +**/ + +/** + \page cfsfacreq FAC Application Requirements + + The following are FAC application requirements. + + (Insert high level requirements and add a reference to where detailed requirements can be found) + + Next: \ref cfsfacdg
+ Prev: \ref cfsfacopr +**/ + +/** + \page cfsfacdg FAC Application Deployment Guide + + (Basic Instructions to the Author) + ==== + + (Insert text describing steps required to integrate the application with a CFS system. This should + include: + 1) References to message IDs that need to be inserted into a CFS Scheduler table + 2) References to telemetry that can be generated + 3) Additional description of application configuration parameters that may need to be modified. + For example, questions that a systems integrator needs to have answered before the application + can be successfully integrated + 4) References to the application's performance ID) + + Initial Integration + ==== + + The first step in deploying the FAC application is to do stuff. + + Application Tailoring to the Mission + ---- + + The fac_mission_cfg.h file, the fac_msgids.h, and the fac_perfids.h files + are tailored for the mission. These are built into the application during + compilation. + + Application Tailoring to the Platform + ---- + + In the fac_platform_cfg.h file, there are configuration parameters that control + FAC application behavior. This should be tailored to the specific platform + needs. This behavior is built into the application during compilation. + + CFS Scheduler Support + ---- + + TODO Discuss any commands that must be included in the CFS Scheduler Table + and any related tailoring/configuration. + + Next: \ref cfsfaccmds
+ Prev: \ref cfsfacreq +**/ + +/*==========================================================================*/ +/* NOTE: The Author does not need to add any material to the following page.*/ +/* It is filled automatically by doxygen. */ +/*==========================================================================*/ +/** + \page cfsfaccmds FAC Application Commands + + + + + +
\ref cfsfactlm \ref cfsfactbl \ref cfsfaccfg
+ + The following is a list of commands that are processed by the FAC Application: +**/ + +/*==========================================================================*/ +/* NOTE: The Author does not need to add any material to the following page.*/ +/* It is filled automatically by doxygen. */ +/*==========================================================================*/ +/** + \page cfsfactlm FAC Application Telemetry + + + + + +
\ref cfsfaccmds \ref cfsfactbl \ref cfsfaccfg
+ + The following is a list of telemetry that is generated by the FAC Application: +**/ + +/** + \page cfsfactbl FAC Application Table Definitions + + + + + +
\ref cfsfaccmds \ref cfsfactlm \ref cfsfaccfg
+ + (Include text describing data structures used in application tables. Further text can be used to + describe the process of populating the table if necessary. Default values may also be described) + +**/ + +/*==========================================================================*/ +/* NOTE: The Author does not need to add any material to the following page.*/ +/* It is filled automatically by doxygen. */ +/*==========================================================================*/ +/** + \page cfsfaccfg FAC Application Configuration Parameters + + + + + +
\ref cfsfaccmds \ref cfsfactlm \ref cfsfactbl
+ + The following are configuration parameters used to configure the FAC + Application either for each platform or for a mission as a whole. + +**/ + +/** + \page cfsfaccons FAC Application Operational Constraints + + (Instructions to the author) + ==== + + (Insert text that describes: + 1) situations that would prevent the application from starting + 2) causes for the application to terminate prematurely + 3) commands that cannot be issued either out of order or without sufficient wait time, etc) + + Application Termination + ==== + + Potential causes for FAC to terminate prematurely are an error return from the + software bus in the application main loop or error return from one of the cFE table + services functions when FAC tries to do table management (check for updates, dump + requests etc.) during each housekeeping cycle. + + Critical Data Store Operation + ==== + + When using the Critical Data Store (CDS), the results tables and housekeeping data + will only be restored if the application was shut down through cFE Executive Services + and exited clean. If this is not the case, default values will be used + (see \ref cfsfacfaqs). + + Next: \ref cfsfacfaqs
+ Prev: \ref cfsfactbl +**/ + +/** + \page cfsfacfaqs FAC Application Frequently Asked Questions + + (Insert text that categorizes a group of questions, if necessary, here. + For example, "General".) + + General + ==== + + (Q) + What is the basic flow of the application? +

+ The FAC application uses a common application format. When the app starts, + initialization is performed, then the app enters an infinite loop waiting for + commands from the software bus. + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Insert text that categorizes another group of questions, if necessary, here) + ==== + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + + (Q) + (Insert text of frequently asked question here) +

+ (Insert text of answer to question above here) + + +**/ diff --git a/apps/fac/fsw/for_build/CMakeLists.txt b/apps/fac/fsw/for_build/CMakeLists.txt new file mode 100644 index 000000000..b7498198d --- /dev/null +++ b/apps/fac/fsw/for_build/CMakeLists.txt @@ -0,0 +1,156 @@ +############################################################################# +# +# Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name Windhover Labs nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################# + +buildliner_add_app_def(fac + FILE FAC + SOURCES + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_app.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_app.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_fac.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_cmds_utils.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_cmds_utils.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_data_utils.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_data_utils.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_symbols.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_Controller.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_Controller.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_PitchController.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_PitchController.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_RollController.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_RollController.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_WheelController.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_WheelController.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_YawController.cpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ECL_YawController.hpp + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_events.h + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_msg.h + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_private_ids.h + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_private_types.h + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_tbldefs.h + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/fac_version.h + + INCLUDES + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/src/ + + DESIGN_DOCS ${PROJECT_SOURCE_DIR}/apps/fac/fsw/for_build/detail_doxy.in + +# MSG_OVERRIDES ${CMAKE_CURRENT_SOURCE_DIR}/fac_msg_overrides.json + +# COMMANDER_PLUGIN +# ${CMAKE_CURRENT_SOURCE_DIR}/../../cdr + + REFERENCE_CONFIG + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/mission_inc + ${PROJECT_SOURCE_DIR}/apps/fac/fsw/platform_inc +) + +buildliner_add_app_unit_test(FAC-UT + UTASSERT + NO_HELGRIND + NO_MASSIF + + SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_app_test.c + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_app_test.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cds_tbl_test.c + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cds_tbl_test.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cmds_test.c + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cmds_test.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_config_tbl_test.c + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_config_tbl_test.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_testrunner.c + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_test_utils.c + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_test_utils.h + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_app.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_app.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_fac.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_cmds_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_cmds_utils.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_data_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_data_utils.hpp + + INCLUDES + ${CMAKE_CURRENT_SOURCE_DIR}/../src/ + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/ + + WRAPPERS + socket + bind + sendto + + VALGRIND_SUPPRESSION_FILE + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_custom.supp + + REFERENCE_CUSTOM_SOURCE + ${CMAKE_CURRENT_SOURCE_DIR}/../tables/fac_config.c +) + +#buildliner_add_app_unit_test(FAC-CUSTOM-UT +# UTASSERT +# NO_HELGRIND +# NO_MASSIF + +# SOURCES +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_app_test.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_app_test.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cds_tbl_test.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cds_tbl_test.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cmds_test.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_cmds_test.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_config_tbl_test.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_config_tbl_test.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_testrunner.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_test_utils.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_test_utils.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_app.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_app.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_cds_utils.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_cds_utils.h +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_config_utils.c +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/fac_config_utils.h + +# INCLUDES +# ${CMAKE_CURRENT_SOURCE_DIR}/../src/ +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/ + +# WRAPPERS +# socket +# bind +# sendto + +# VALGRIND_SUPPRESSION_FILE +# ${CMAKE_CURRENT_SOURCE_DIR}/../unit_test/fac_custom.supp + +# REFERENCE_CUSTOM_SOURCE +# ${CMAKE_CURRENT_SOURCE_DIR}/../tables/fac_config.c +#) diff --git a/apps/fac/fsw/for_build/detail_doxy.in b/apps/fac/fsw/for_build/detail_doxy.in new file mode 100644 index 000000000..0c09a30c0 --- /dev/null +++ b/apps/fac/fsw/for_build/detail_doxy.in @@ -0,0 +1,255 @@ +# Doxyfile 1.5.4 +@INCLUDE_PATH=@APP_DEFINITION_DIR@/../../docs/dox_src/mnem_maps +@INCLUDE=cfs_fac_cmd_mnem_map +@INCLUDE=cfs_fac_tlm_mnem_map +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +#DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "CFS Fixedwing Attitude Control App (FAC) Application on @BUILD_CONFIG_NAME@ Detailed Design" +PROJECT_NUMBER = +OUTPUT_DIRECTORY = @CFS_DOCS_HTML_DIR@/detailed_design/apps/fac +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +#QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES += "event=\xrefitem cfeevents \"Event Message\" \"cFE Event Message Cross Reference\" " +ALIASES += "retdesc= " +ALIASES += "retcode= " +ALIASES += endcode= +ALIASES += "returns=\return " +ALIASES += endreturns=
+ALIASES += "retstmt= " +ALIASES += endstmt= +ALIASES += "faccmd=\xrefitem cfsfaccmds \"Name\" \"Fixedwing Attitude Control App Commands\" " +ALIASES += "factlm=\xrefitem cfsfactlm \"Name\" \"Fixedwing Attitude Control App Telemetry\" " +ALIASES += "faccmdmnemonic=\xrefitem cfsfaccmdmnems \"Command Mnemonic(s)\" \"FAC Command Mnemonic Cross Reference\" \b \c " +ALIASES += "factlmmnemonic=\xrefitem cfsfactlmmnems \"Telemetry Mnemonic(s)\" \"FAC Telemetry Mnemonic Cross Reference\" \b \c " +ALIASES += "faccfg=\xrefitem cfsfaccfg \"Purpose\" \"CFS Fixedwing Attitude Control App Configuration Parameters\" " +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +#CPP_CLI_SUPPORT = NO +#SIP_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#TYPEDEF_HIDES_STRUCT = NO +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +#EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = YES +WARN_FORMAT = "$file:$line: $text " +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @APP_DEFINITION_DIR@/../../docs/dox_src/users_guide/cfs_fac.dox +INPUT += @DEFINITION_SOURCES@ +INPUT += @CONFIG_SOURCES@ +#INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.h +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +#EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = "./" +IMAGE_PATH += @APP_DEFINITION_DIR@/../../docs/dox_src/detailed_design/" +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = @CFS_DOCS_HTML_DIR@/detailed_design/apps/fac +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +#HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = CFS_Help.chm +HHC_LOCATION = "C:/Program Files/HTML Help Workshop/hhc.exe" +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = @CFS_DOCS_LATEX_DIR@/detailed_design/apps/fac +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = YES +PAPER_TYPE = letter +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = @CFS_DOCS_DIR@/detailed_design/rtf/apps/fac +COMPACT_RTF = YES +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = __PPC__ \ + MESSAGE_FORMAT_IS_CCSDS \ + CFE_TIME_CFG_SRC_TIME \ + CFE_TIME_CFG_SRC_GPS \ + CFE_TIME_CFG_SRC_MET +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = @CFS_DOCS_HTML_DIR@/detailed_design/cfe/cfe.tag=../../../cfe/detailed_design/ +GENERATE_TAGFILE = @CFS_DOCS_HTML_DIR@/detailed_design/apps/fac/fac.tag +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +#MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = NO +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = YES +GRAPHICAL_HIERARCHY = NO +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +#DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/apps/fac/fsw/for_build/fac_custom_msg_overrides.json b/apps/fac/fsw/for_build/fac_custom_msg_overrides.json new file mode 100644 index 000000000..0d700b573 --- /dev/null +++ b/apps/fac/fsw/for_build/fac_custom_msg_overrides.json @@ -0,0 +1,17 @@ +{ + "Airliner": { + "apps": { + "FAC": { + "operations": { + "Noop": {"airliner_mid": "0x1000" }, + "Reset": {"airliner_mid": "0x1000" }, + "FAC_HkTlm_t": {"airliner_mid": "0x0000" }, + "SendHk": {"airliner_mid": "0x1000" }, + "Wakeup": {"airliner_mid": "0x1000" } + }, + "config": { + } + } + } + } +} diff --git a/apps/fac/fsw/for_build/fac_msg_overrides.json b/apps/fac/fsw/for_build/fac_msg_overrides.json new file mode 100644 index 000000000..fa9a1d339 --- /dev/null +++ b/apps/fac/fsw/for_build/fac_msg_overrides.json @@ -0,0 +1,41 @@ +{ + "Airliner": { + "apps": { + "FAC": { + "operations": { + "Noop": { "airliner_cc": 0, "macro": "FAC_CMD_MID", "airliner_msg": "FAC_NoArgCmd_t" }, + "Reset": { "airliner_cc": 1, "macro": "FAC_CMD_MID", "airliner_msg": "FAC_NoArgCmd_t" }, + "FAC_HkTlm_t": { "macro": "FAC_HK_TLM_MID", "airliner_msg": "FAC_HkTlm_t" }, + "SendHk": { "airliner_cc": 0, "macro": "FAC_SEND_HK_MID", "airliner_msg": "FAC_NoArgCmd_t"}, + "Wakeup": { "airliner_cc": 0, "macro": "FAC_WAKEUP_MID", "airliner_msg": "FAC_NoArgCmd_t"} + }, + "scheduler": { + "activities": [ + "FAC_SEND_HK_MID", + "FAC_WAKEUP_MID" + ] + }, + "events": [ + {"macro": "FAC_INF_EID", "id": 1}, + {"macro": "FAC_INIT_INF_EID", "id": 2}, + {"macro": "FAC_CONFIG_TABLE_INF_EID", "id": 3}, + {"macro": "FAC_CDS_INF_EID", "id": 4}, + {"macro": "FAC_CMD_INF_EID", "id": 5}, + {"macro": "FAC_ERR_EID", "id": 6}, + {"macro": "FAC_INIT_ERR_EID", "id": 7}, + {"macro": "FAC_CONFIG_TABLE_ERR_EID", "id": 8}, + {"macro": "FAC_CDS_ERR_EID", "id": 9}, + {"macro": "FAC_CMD_ERR_EID", "id": 10}, + {"macro": "FAC_PIPE_ERR_EID", "id": 11}, + {"macro": "FAC_MSGID_ERR_EID", "id": 12}, + {"macro": "FAC_MSGLEN_ERR_EID", "id": 13} + ], + "config": { + }, + "tables": [ + {"id": "CONFIG_TBL", "title": "FAC Configuration", "isDumpTable": false} + ] + } + } + } +} diff --git a/apps/fac/fsw/for_build/user_doxy.in b/apps/fac/fsw/for_build/user_doxy.in new file mode 100644 index 000000000..d949714d5 --- /dev/null +++ b/apps/fac/fsw/for_build/user_doxy.in @@ -0,0 +1,261 @@ +# Doxyfile 1.5.4 +@INCLUDE_PATH=@CFS_MISSION@/apps/fac/docs/dox_src/mnem_maps +@INCLUDE=cfs_fac_cmd_mnem_map +@INCLUDE=cfs_fac_tlm_mnem_map +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +#DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "Fixedwing Attitude Control App (FAC) Application on @BUILD_CONFIG_NAME@ User's Guide" +PROJECT_NUMBER = +OUTPUT_DIRECTORY = @CFS_DOCS_HTML_DIR@/users_guide/apps/fac +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = @CFS_MISSION@ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +#QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES += "event=\xrefitem cfsfacevents \"Event Message\" \"Fixedwing Attitude Control App Event Message Cross Reference\" " +ALIASES += "retdesc= " +ALIASES += "retcode= " +ALIASES += endcode= +ALIASES += "returns=\return " +ALIASES += endreturns=
+ALIASES += "retstmt= " +ALIASES += endstmt= +ALIASES += "faccmd=\xrefitem cfsfaccmds \"Name\" \"Fixedwing Attitude Control App Commands\" " +ALIASES += "factlm=\xrefitem cfsfactlm \"Name\" \"Fixedwing Attitude Control App Telemetry\" " +ALIASES += "faccmdmnemonic=\xrefitem cfsfaccmdmnems \"Command Mnemonic(s)\" \"Fixedwing Attitude Control App Command Mnemonic Cross Reference\" \b \c " +ALIASES += "factlmmnemonic=\xrefitem cfsfactlmmnems \"Telemetry Mnemonic(s)\" \"Fixedwing Attitude Control App Telemetry Mnemonic Cross Reference\" \b \c " +ALIASES += "faccfg=\xrefitem cfsfaccfg \"Purpose\" \"Fixedwing Attitude Control App Configuration Parameters\" " +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +#CPP_CLI_SUPPORT = NO +#SIP_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#TYPEDEF_HIDES_STRUCT = NO +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +#EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = YES +WARN_FORMAT = "$file:$line: $text " +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CFS_MISSION@/apps/fac/docs/dox_src/users_guide/cfs_fac.dox +INPUT += @CFS_MISSION@/config/mission_inc/fac_mission_cfg.h +INPUT += @CFS_MISSION@/config/mission_inc/fac_perfids.h +INPUT += @CFS_MISSION@/config/mission_inc/fac_msgids.h +INPUT += @CFS_MISSION@/config/@BUILD_CONFIG_NAME@/inc/fac_platform_cfg.h +INPUT += @CFS_MISSION@/apps/fac/fsw/src/fac_events.h +INPUT += @CFS_MISSION@/apps/fac/fsw/src/fac_msg.h +INPUT += @CFS_MISSION@/apps/fac/fsw/src/fac_tbldefs.h + +#INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.h +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +#EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = "./" +IMAGE_PATH += "@CFS_MISSION@/apps/fac/docs/dox_src/users_guide/" +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = @CFS_DOCS_HTML_DIR@/users_guide/apps/fac +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +#HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = CFS_Help.chm +HHC_LOCATION = "C:/Program Files/HTML Help Workshop/hhc.exe" +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = @CFS_DOCS_LATEX_DIR@/users_guide/apps/fac +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = YES +PAPER_TYPE = letter +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = @CFS_DOCS_DIR@/users_guide/rtf/apps/fac +COMPACT_RTF = YES +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = __PPC__ \ + MESSAGE_FORMAT_IS_CCSDS \ + CFE_TIME_CFG_SRC_TIME \ + CFE_TIME_CFG_SRC_GPS \ + CFE_TIME_CFG_SRC_MET +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = @CFS_DOCS_HTML_DIR@/detailed_design/cfe/cfe.tag=../../../cfe/detailed_design/ +GENERATE_TAGFILE = @CFS_DOCS_HTML_DIR@/users_guide/apps/fac/fac.tag +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +#MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = NO +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = NO +INCLUDED_BY_GRAPH = NO +CALL_GRAPH = YES +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = NO +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +#DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/apps/fac/fsw/mission_inc/fac_mission_cfg.h b/apps/fac/fsw/mission_inc/fac_mission_cfg.h new file mode 100644 index 000000000..26054f142 --- /dev/null +++ b/apps/fac/fsw/mission_inc/fac_mission_cfg.h @@ -0,0 +1,57 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_MISSION_CFG_H +#define FAC_MISSION_CFG_H + + +/* +** FAC Mission Configuration Parameter Definitions +*/ + +/* TODO: Add mission configuration parameter definitions here, if necessary. */ + +#define FAC_SB_TIMEOUT CFE_SB_PEND_FOREVER /* Can be a value in milliseconds */ + +#define FAC_HK_TLM_MSG (344) /* FAC_HK_TLM_MID: 0x0B58 */ +#define FAC_OUT_DATA_MSG (345) /* FAC_OUT_DATA_MID: 0x0B59 */ +#define FAC_CMD_MSG (346) /* FAC_CMD_MID: 0x1B5A */ +#define FAC_SEND_HK_MSG (347) /* FAC_SEND_HK_MID: 0x1B5B */ +#define FAC_WAKEUP_MSG (348) /* FAC_WAKEUP_MID: 0x1B5C */ + + +#endif /* FAC_MISSION_CFG_H */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/fac/fsw/mission_inc/fac_perfids.h b/apps/fac/fsw/mission_inc/fac_perfids.h new file mode 100644 index 000000000..0d77e3ff9 --- /dev/null +++ b/apps/fac/fsw/mission_inc/fac_perfids.h @@ -0,0 +1,46 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_PERFIDS_H +#define FAC_PERFIDS_H + + +/** \brief Performance ID for the TO main task */ +#define FAC_MAIN_TASK_PERF_ID (50) + + +#endif /* FAC_PERFIDS_H */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/fac/fsw/platform_inc/fac_msgids.h b/apps/fac/fsw/platform_inc/fac_msgids.h new file mode 100644 index 000000000..942b57349 --- /dev/null +++ b/apps/fac/fsw/platform_inc/fac_msgids.h @@ -0,0 +1,8 @@ +#ifndef FAC_MSGIDS_H +#define FAC_MSGIDS_H + + +#include "msg_ids.h" + + +#endif /* FAC_MSGIDS_H */ diff --git a/apps/fac/fsw/platform_inc/fac_platform_cfg.h b/apps/fac/fsw/platform_inc/fac_platform_cfg.h new file mode 100644 index 000000000..813c4fcce --- /dev/null +++ b/apps/fac/fsw/platform_inc/fac_platform_cfg.h @@ -0,0 +1,145 @@ +#ifndef FAC_PLATFORM_CFG_H +#define FAC_PLATFORM_CFG_H + + +/* +** fac Platform Configuration Parameter Definitions +*/ + +/** \brief Mission specific version number for FAC application +** +** \par Description: +** An application version number consists of four parts: +** major version number, minor version number, revision +** number and mission specific revision number. The mission +** specific revision number is defined here and the other +** parts are defined in "fac_version.h". +** +** \par Limits: +** Must be defined as a numeric value that is greater than +** or equal to zero. +*/ +#define FAC_MISSION_REV (0) + +/** \brief Pipe depth for the Scheduler pipe +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH. +*/ +#define FAC_SCH_PIPE_DEPTH (2) + +/** \brief Pipe name for the Scheduler pipe +** +** \par Limits: +** Note, this name must fit in OS_MAX_API_NAME. +*/ +#define FAC_SCH_PIPE_NAME ("FAC_SCH_PIPE") + +/** \brief The SB pend behavior type for the Scheduler pipe. +** +** \par Limits: +** One of: CFE_SB_POLL, CFE_SB_PEND_FOREVER, or the +** number of milliseconds to wait for a new message (recommended). +** Note, using CFE_SB_PEND_FOREVER may cause an unresponsive +** application if no messages arrive on this pipe. +*/ +#define FAC_SCH_PIPE_PEND_TIME (2000) + +/** \brief The number of WAKEUP messages to reserve on the Scheduler pipe. +** +** \par Limits: +** minimum of 1, max limited to CFE_SB_MAX_PIPE_DEPTH-1. Note the +** FAC_SCH_PIPE_WAKEUP_RESERVED and FAC_SCH_PIPE_SEND_HK_RESERVED +** must be less than FAC_SCH_PIPE_DEPTH. +*/ +#define FAC_SCH_PIPE_WAKEUP_RESERVED (1) + +/** \brief The number of SEND_HK messages to reserve on the Scheduler pipe. +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH. Note the +** FAC_SCH_PIPE_WAKEUP_RESERVED and FAC_SCH_PIPE_SEND_HK_RESERVED +** must be less than FAC_SCH_PIPE_DEPTH. +*/ +#define FAC_SCH_PIPE_SEND_HK_RESERVED (1) + +/** \brief Pipe depth for the command pipe +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH. +*/ +#define FAC_CMD_PIPE_DEPTH (4) + +/** \brief Pipe name for the Scheduler pipe +** +** \par Limits: +** Note, this name must fit in OS_MAX_API_NAME. +*/ +#define FAC_CMD_PIPE_NAME ("FAC_CMD_PIPE") + +/** \brief The SB pend behavior type for the Command pipe. +** +** \par Limits: +** One of: CFE_SB_POLL, CFE_SB_PEND_FOREVER, or the +** number of milliseconds to wait for a new message (recommended). +** Note, using CFE_SB_PEND_FOREVER may cause an unresponsive +** application if no messages arrive on this pipe. +*/ +#define FAC_CMD_PIPE_PEND_TIME (2000) + +/** \brief Pipe depth for the data pipe +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH(256). +*/ +#define FAC_DATA_PIPE_DEPTH (4) + +/** \brief Pipe name for the Scheduler pipe +** +** \par Limits: +** Note, this name must fit in OS_MAX_API_NAME. +*/ +#define FAC_DATA_PIPE_NAME ("FAC_DATA_PIPE") + +/** \brief The SB pend behavior type for the Data pipe. +** +** \par Limits: +** One of: CFE_SB_POLL, CFE_SB_PEND_FOREVER, or the +** number of milliseconds to wait for a new message (recommended). +** Note, using CFE_SB_PEND_FOREVER may cause an unresponsive +** application if no messages arrive on this pipe. +*/ +#define FAC_DATA_PIPE_PEND_TIME (2000) +#define FAC_DATA_PIPE_RESERVED (1) + +/** \brief The config table default filename +** +** \par Limits: +** The length of each string, including the NULL terminator cannot exceed +** the #OS_MAX_PATH_LEN value. +*/ +#define FAC_CONFIG_TABLE_FILENAME ("/cf/apps/fac_config.tbl") +/** \brief The timeout value, in milliseconds, to wait for ES application startup sync. +** +** \par Limits: +** This parameter must be at least 1000 (ms). +*/ +#define FAC_STARTUP_TIMEOUT_MSEC (1000) + +/* TODO: Add Doxygen markup. */ +#define FAC_CUSTOM_DEV_PATH "/tmp/ttyS0" + +#define FAC_CDS_TASK_PRIORITY (20) + +#define FAC_CDS_TASK_NAME "FAC_CDS_TASK" + +#define FAC_CMDS_TASK_PRIORITY (100) + +#define FAC_CMDS_TASK_NAME "FAC_CMDS_TASK" + + +#endif /* FAC_PLATFORM_CFG_H */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/fac/fsw/src/ECL_Controller.cpp b/apps/fac/fsw/src/ECL_Controller.cpp new file mode 100644 index 000000000..05e0a84a6 --- /dev/null +++ b/apps/fac/fsw/src/ECL_Controller.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "ECL_Controller.hpp" + + +ECL_Controller::ECL_Controller(const char *name) +{ + init(); +} + + +void ECL_Controller::init(void) +{ + _last_run = 0; + _tc = 0.1f; + _k_p = 0.0f; + _k_i = 0.0f; + _k_ff = 0.0f; + _integrator_max = 0.0f; + _max_rate = 0.0f; + _last_output = 0.0f; + _integrator = 0.0f; + _rate_error = 0.0f; + _rate_setpoint = 0.0f; + _bodyrate_setpoint = 0.0f; +} + +void ECL_Controller::reset_integrator() +{ + _integrator = 0.0f; +} + +void ECL_Controller::set_time_constant(float time_constant) +{ + if (time_constant > 0.1f && time_constant < 3.0f) { + _tc = time_constant; + } +} + +void ECL_Controller::set_k_p(float k_p) +{ + _k_p = k_p; +} + +void ECL_Controller::set_k_i(float k_i) +{ + _k_i = k_i; +} + +void ECL_Controller::set_k_ff(float k_ff) +{ + _k_ff = k_ff; +} + +void ECL_Controller::set_integrator_max(float max) +{ + _integrator_max = max; +} + +void ECL_Controller::set_max_rate(float max_rate) +{ + _max_rate = max_rate; +} + +float ECL_Controller::get_rate_error() +{ + return _rate_error; +} + +float ECL_Controller::get_desired_rate() +{ + return _rate_setpoint; +} + +float ECL_Controller::get_desired_bodyrate() +{ + return _bodyrate_setpoint; +} + +float ECL_Controller::constrain_airspeed(float airspeed, float minspeed, float maxspeed) +{ + float airspeed_result = airspeed; + + if (!isfinite(airspeed)) { + /* airspeed is NaN, +- INF or not available, pick center of band */ + airspeed_result = 0.5f * (minspeed + maxspeed); + + } else if (airspeed < minspeed) { + airspeed_result = minspeed; + } + + return airspeed_result; +} diff --git a/apps/fac/fsw/src/ECL_Controller.hpp b/apps/fac/fsw/src/ECL_Controller.hpp new file mode 100644 index 000000000..778cae86b --- /dev/null +++ b/apps/fac/fsw/src/ECL_Controller.hpp @@ -0,0 +1,106 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef ECL_CONTROLLER_HPP +#define ECL_CONTROLLER_HPP + +#include +#include "cfe.h" + +struct ECL_ControlData { + float roll; + float pitch; + float yaw; + float body_x_rate; + float body_y_rate; + float body_z_rate; + float roll_setpoint; + float pitch_setpoint; + float yaw_setpoint; + float roll_rate_setpoint; + float pitch_rate_setpoint; + float yaw_rate_setpoint; + float airspeed_min; + float airspeed_max; + float airspeed; + float scaler; + float groundspeed; + float groundspeed_scaler; + bool lock_integrator; +}; + +class ECL_Controller +{ +public: + ECL_Controller(const char *name); + ~ECL_Controller() = default; + + virtual float control_attitude(const struct ECL_ControlData &ctl_data) = 0; + virtual float control_euler_rate(const struct ECL_ControlData &ctl_data) = 0; + virtual float control_bodyrate(const struct ECL_ControlData &ctl_data) = 0; + + /* Setters */ + void set_time_constant(float time_constant); + void set_k_p(float k_p); + void set_k_i(float k_i); + void set_k_ff(float k_ff); + void set_integrator_max(float max); + void set_max_rate(float max_rate); + void set_bodyrate_setpoint(float rate) {_bodyrate_setpoint = rate;} + + /* Getters */ + float get_rate_error(); + float get_desired_rate(); + float get_desired_bodyrate(); + + void reset_integrator(); + + void init(void); + +protected: + uint64 _last_run; + float _tc; + float _k_p; + float _k_i; + float _k_ff; + float _integrator_max; + float _max_rate; + float _last_output; + float _integrator; + float _rate_error; + float _rate_setpoint; + float _bodyrate_setpoint; + float constrain_airspeed(float airspeed, float minspeed, float maxspeed); +}; + +#endif diff --git a/apps/fac/fsw/src/ECL_PitchController.cpp b/apps/fac/fsw/src/ECL_PitchController.cpp new file mode 100644 index 000000000..cbd098318 --- /dev/null +++ b/apps/fac/fsw/src/ECL_PitchController.cpp @@ -0,0 +1,153 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "ECL_PitchController.hpp" + +#include "math/Limits.hpp" +#include "math/Vector2F.hpp" +#include "math/Euler.hpp" +#include "math/Quaternion.hpp" +#include "px4lib.h" + + + +ECL_PitchController::ECL_PitchController() : + ECL_Controller("pitch"), + _max_rate_neg(0.0f), + _roll_ff(0.0f) +{ + +} + +float ECL_PitchController::control_attitude(const struct ECL_ControlData &ctl_data) +{ + + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.pitch_setpoint) && + isfinite(ctl_data.roll) && + isfinite(ctl_data.pitch) && + isfinite(ctl_data.airspeed))) + { + /* TODO: Replace with CFE EVS Event message. */ + //warnx("not controlling pitch"); + return _rate_setpoint; + } + + /* Calculate the error */ + float pitch_error = ctl_data.pitch_setpoint - ctl_data.pitch; + + /* Apply P controller: rate setpoint from current error and time constant */ + _rate_setpoint = pitch_error / _tc; + + /* limit the rate */ + if (_max_rate > 0.01f && _max_rate_neg > 0.01f) { + if (_rate_setpoint > 0.0f) { + _rate_setpoint = (_rate_setpoint > _max_rate) ? _max_rate : _rate_setpoint; + + } else { + _rate_setpoint = (_rate_setpoint < -_max_rate_neg) ? -_max_rate_neg : _rate_setpoint; + } + + } + + return _rate_setpoint; +} + +float ECL_PitchController::control_bodyrate(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.roll) && + isfinite(ctl_data.pitch) && + isfinite(ctl_data.body_y_rate) && + isfinite(ctl_data.body_z_rate) && + isfinite(ctl_data.yaw_rate_setpoint) && + isfinite(ctl_data.airspeed_min) && + isfinite(ctl_data.airspeed_max) && + isfinite(ctl_data.scaler))) { + return math::constrain(_last_output, -1.0f, 1.0f); + } + + /* get the usual dt estimate */ + uint64 dt_micros = PX4LIB_GetPX4ElapsedTimeUs(_last_run); + _last_run = PX4LIB_GetPX4TimeUs(); + float dt = (float)dt_micros * 1e-6f; + + /* lock integral for long intervals */ + bool lock_integrator = ctl_data.lock_integrator; + + if (dt_micros > 500000) { + lock_integrator = true; + } + + _rate_error = _bodyrate_setpoint - ctl_data.body_y_rate; + + if (!lock_integrator && _k_i > 0.0f) { + + float id = _rate_error * dt * ctl_data.scaler; + + /* + * anti-windup: do not allow integrator to increase if actuator is at limit + */ + if (_last_output < -1.0f) { + /* only allow motion to center: increase value */ + id = math::max(id, 0.0f); + + } else if (_last_output > 1.0f) { + /* only allow motion to center: decrease value */ + id = math::min(id, 0.0f); + } + + _integrator += id * _k_i; + } + + /* integrator limit */ + //xxx: until start detection is available: integral part in control signal is limited here + float integrator_constrained = math::constrain(_integrator, -_integrator_max, _integrator_max); + + /* Apply PI rate controller and store non-limited output */ + _last_output = _bodyrate_setpoint * _k_ff * ctl_data.scaler + + _rate_error * _k_p * ctl_data.scaler * ctl_data.scaler + + integrator_constrained; //scaler is proportional to 1/airspeed + + return math::constrain(_last_output, -1.0f, 1.0f); +} + +float ECL_PitchController::control_euler_rate(const struct ECL_ControlData &ctl_data) +{ + /* Transform setpoint to body angular rates (jacobian) */ + _bodyrate_setpoint = cosf(ctl_data.roll) * _rate_setpoint + + cosf(ctl_data.pitch) * sinf(ctl_data.roll) * ctl_data.yaw_rate_setpoint; + + return control_bodyrate(ctl_data); +} + diff --git a/apps/fac/fsw/src/ECL_PitchController.hpp b/apps/fac/fsw/src/ECL_PitchController.hpp new file mode 100644 index 000000000..445272872 --- /dev/null +++ b/apps/fac/fsw/src/ECL_PitchController.hpp @@ -0,0 +1,71 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef ECL_PITCHCONTROLLER_HPP +#define ECL_PITCHCONTROLLER_HPP + +#include "ECL_Controller.hpp" + +class ECL_PitchController : + public ECL_Controller +{ +public: + ECL_PitchController(); + ~ECL_PitchController() = default; + + float control_attitude(const struct ECL_ControlData &ctl_data); + float control_euler_rate(const struct ECL_ControlData &ctl_data); + float control_bodyrate(const struct ECL_ControlData &ctl_data); + + /* Additional Setters */ + void set_max_rate_pos(float max_rate_pos) + { + _max_rate = max_rate_pos; + } + + void set_max_rate_neg(float max_rate_neg) + { + _max_rate_neg = max_rate_neg; + } + + void set_roll_ff(float roll_ff) + { + _roll_ff = roll_ff; + } + + protected: + float _max_rate_neg; + float _roll_ff; +}; + +#endif diff --git a/apps/fac/fsw/src/ECL_RollController.cpp b/apps/fac/fsw/src/ECL_RollController.cpp new file mode 100644 index 000000000..fbd68fc40 --- /dev/null +++ b/apps/fac/fsw/src/ECL_RollController.cpp @@ -0,0 +1,133 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "ECL_RollController.hpp" + +#include "math/Limits.hpp" +#include "px4lib.h" + +ECL_RollController::ECL_RollController() : + ECL_Controller("roll") +{ +} + +float ECL_RollController::control_attitude(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.roll_setpoint) && isfinite(ctl_data.roll))) { + return _rate_setpoint; + } + + /* Calculate error */ + float roll_error = ctl_data.roll_setpoint - ctl_data.roll; + + /* Apply P controller */ + _rate_setpoint = roll_error / _tc; + + /* limit the rate */ //XXX: move to body angluar rates + + if (_max_rate > 0.01f) { + _rate_setpoint = (_rate_setpoint > _max_rate) ? _max_rate : _rate_setpoint; + _rate_setpoint = (_rate_setpoint < -_max_rate) ? -_max_rate : _rate_setpoint; + } + + return _rate_setpoint; +} + +float ECL_RollController::control_bodyrate(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.pitch) && + isfinite(ctl_data.body_x_rate) && + isfinite(ctl_data.body_z_rate) && + isfinite(ctl_data.yaw_rate_setpoint) && + isfinite(ctl_data.airspeed_min) && + isfinite(ctl_data.airspeed_max) && + isfinite(ctl_data.scaler))) { + return math::constrain(_last_output, -1.0f, 1.0f); + } + + /* get the usual dt estimate */ + uint64 dt_micros = PX4LIB_GetPX4ElapsedTimeUs(_last_run); + _last_run = PX4LIB_GetPX4TimeUs(); + float dt = (float)dt_micros * 1e-6f; + + /* lock integral for long intervals */ + bool lock_integrator = ctl_data.lock_integrator; + + if (dt_micros > 500000) { + lock_integrator = true; + } + + /* Calculate body angular rate error */ + _rate_error = _bodyrate_setpoint - ctl_data.body_x_rate; //body angular rate error + + if (!lock_integrator && _k_i > 0.0f) { + + float id = _rate_error * dt * ctl_data.scaler; + + /* + * anti-windup: do not allow integrator to increase if actuator is at limit + */ + if (_last_output < -1.0f) { + /* only allow motion to center: increase value */ + id = math::max(id, 0.0f); + + } else if (_last_output > 1.0f) { + /* only allow motion to center: decrease value */ + id = math::min(id, 0.0f); + } + + _integrator += id * _k_i; + } + + /* integrator limit */ + //xxx: until start detection is available: integral part in control signal is limited here + float integrator_constrained = math::constrain(_integrator, -_integrator_max, _integrator_max); + + /* Apply PI rate controller and store non-limited output */ + _last_output = _bodyrate_setpoint * _k_ff * ctl_data.scaler + + _rate_error * _k_p * ctl_data.scaler * ctl_data.scaler + + integrator_constrained; //scaler is proportional to 1/airspeed + + return math::constrain(_last_output, -1.0f, 1.0f); +} + +float ECL_RollController::control_euler_rate(const struct ECL_ControlData &ctl_data) +{ + /* Transform setpoint to body angular rates (jacobian) */ + _bodyrate_setpoint = ctl_data.roll_rate_setpoint - sinf(ctl_data.pitch) * ctl_data.yaw_rate_setpoint; + + return control_bodyrate(ctl_data); + +} diff --git a/apps/fac/fsw/src/ECL_RollController.hpp b/apps/fac/fsw/src/ECL_RollController.hpp new file mode 100644 index 000000000..6f51a4c12 --- /dev/null +++ b/apps/fac/fsw/src/ECL_RollController.hpp @@ -0,0 +1,51 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef ECL_ROLLCONTROLLER_HPP +#define ECL_ROLLCONTROLLER_HPP + +#include "ECL_Controller.hpp" + +class ECL_RollController : + public ECL_Controller +{ +public: + ECL_RollController(); + ~ECL_RollController() = default; + + float control_attitude(const struct ECL_ControlData &ctl_data); + float control_euler_rate(const struct ECL_ControlData &ctl_data); + float control_bodyrate(const struct ECL_ControlData &ctl_data); +}; + +#endif diff --git a/apps/fac/fsw/src/ECL_WheelController.cpp b/apps/fac/fsw/src/ECL_WheelController.cpp new file mode 100644 index 000000000..5d3ff03d1 --- /dev/null +++ b/apps/fac/fsw/src/ECL_WheelController.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "ECL_WheelController.hpp" + +#include "math/Limits.hpp" +#include "px4lib.h" +#include "geo/geo.h" + + +ECL_WheelController::ECL_WheelController() : + ECL_Controller("wheel") +{ +} + +float ECL_WheelController::control_bodyrate(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.body_z_rate) && + isfinite(ctl_data.groundspeed) && + isfinite(ctl_data.groundspeed_scaler))) { + return math::constrain(_last_output, -1.0f, 1.0f); + } + + /* get the usual dt estimate */ + uint64 dt_micros = PX4LIB_GetPX4ElapsedTimeUs(_last_run); + _last_run = PX4LIB_GetPX4TimeUs(); + float dt = (float)dt_micros * 1e-6f; + + /* lock integral for long intervals */ + bool lock_integrator = ctl_data.lock_integrator; + + if (dt_micros > 500000) { + lock_integrator = true; + } + + /* input conditioning */ + float min_speed = 1.0f; + + /* Calculate body angular rate error */ + _rate_error = _rate_setpoint - ctl_data.body_z_rate; //body angular rate error + + if (!lock_integrator && _k_i > 0.0f && ctl_data.groundspeed > min_speed) { + + float id = _rate_error * dt * ctl_data.groundspeed_scaler; + + /* + * anti-windup: do not allow integrator to increase if actuator is at limit + */ + if (_last_output < -1.0f) { + /* only allow motion to center: increase value */ + id = math::max(id, 0.0f); + + } else if (_last_output > 1.0f) { + /* only allow motion to center: decrease value */ + id = math::min(id, 0.0f); + } + + _integrator += id * _k_i; + } + + /* integrator limit */ + //xxx: until start detection is available: integral part in control signal is limited here + float integrator_constrained = math::constrain(_integrator, -_integrator_max, _integrator_max); + + /* Apply PI rate controller and store non-limited output */ + _last_output = _rate_setpoint * _k_ff * ctl_data.groundspeed_scaler + + ctl_data.groundspeed_scaler * ctl_data.groundspeed_scaler * (_rate_error * _k_p + integrator_constrained); + + return math::constrain(_last_output, -1.0f, 1.0f); +} + + +float ECL_WheelController::control_attitude(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.yaw_setpoint) && + isfinite(ctl_data.yaw))) { + return _rate_setpoint; + } + + /* Calculate the error */ + float yaw_error = _wrap_pi(ctl_data.yaw_setpoint - ctl_data.yaw); + + /* Apply P controller: rate setpoint from current error and time constant */ + _rate_setpoint = yaw_error / _tc; + + /* limit the rate */ + if (_max_rate > 0.01f) { + if (_rate_setpoint > 0.0f) { + _rate_setpoint = (_rate_setpoint > _max_rate) ? _max_rate : _rate_setpoint; + + } else { + _rate_setpoint = (_rate_setpoint < -_max_rate) ? -_max_rate : _rate_setpoint; + } + + } + + return _rate_setpoint; +} diff --git a/apps/fac/fsw/src/ECL_WheelController.hpp b/apps/fac/fsw/src/ECL_WheelController.hpp new file mode 100644 index 000000000..f72f92571 --- /dev/null +++ b/apps/fac/fsw/src/ECL_WheelController.hpp @@ -0,0 +1,53 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef ECL_WHEELCONTROLLER_HPP +#define ECL_WHEELCONTROLLER_HPP + +#include "ECL_Controller.hpp" + +class ECL_WheelController : + public ECL_Controller +{ +public: + ECL_WheelController(); + ~ECL_WheelController() = default; + + float control_attitude(const struct ECL_ControlData &ctl_data); + + float control_bodyrate(const struct ECL_ControlData &ctl_data); + + float control_euler_rate(const struct ECL_ControlData &ctl_data) {return 0;} +}; + +#endif diff --git a/apps/fac/fsw/src/ECL_YawController.cpp b/apps/fac/fsw/src/ECL_YawController.cpp new file mode 100644 index 000000000..d1673314a --- /dev/null +++ b/apps/fac/fsw/src/ECL_YawController.cpp @@ -0,0 +1,217 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "ECL_YawController.hpp" + +#include "math/Limits.hpp" +#include "px4lib.h" + + + + +ECL_YawController::ECL_YawController() : + ECL_Controller("yaw"), + _coordinated_min_speed(1.0f), + _max_rate(0.0f), /* disable by default */ + _coordinated_method(0) +{ +} + +float ECL_YawController::control_attitude(const struct ECL_ControlData &ctl_data) +{ + switch (_coordinated_method) { + case COORD_METHOD_OPEN: + return control_attitude_impl_openloop(ctl_data); + + case COORD_METHOD_CLOSEACC: + return control_attitude_impl_accclosedloop(ctl_data); + + default: + static uint64 last_print = 0; + + if (PX4LIB_GetPX4ElapsedTimeUs(last_print) > 5e6) { + /* TODO: Replace with CFE EVS event message */ + //warnx("invalid param setting FW_YCO_METHOD"); + last_print = PX4LIB_GetPX4TimeUs(); + } + } + + return _rate_setpoint; +} + +float ECL_YawController::control_attitude_impl_openloop(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.roll) && + isfinite(ctl_data.pitch) && + isfinite(ctl_data.roll_rate_setpoint) && + isfinite(ctl_data.pitch_rate_setpoint))) { + return _rate_setpoint; + } + + float constrained_roll; + bool inverted = false; + + /* roll is used as feedforward term and inverted flight needs to be considered */ + if (fabsf(ctl_data.roll) < math::radians(90.0f)) { + /* not inverted, but numerically still potentially close to infinity */ + constrained_roll = math::constrain(ctl_data.roll, math::radians(-80.0f), math::radians(80.0f)); + + } else { + inverted = true; + + // inverted flight, constrain on the two extremes of -pi..+pi to avoid infinity + //note: the ranges are extended by 10 deg here to avoid numeric resolution effects + if (ctl_data.roll > 0.0f) { + /* right hemisphere */ + constrained_roll = math::constrain(ctl_data.roll, math::radians(100.0f), math::radians(180.0f)); + + } else { + /* left hemisphere */ + constrained_roll = math::constrain(ctl_data.roll, math::radians(-180.0f), math::radians(-100.0f)); + } + } + + constrained_roll = math::constrain(constrained_roll, -fabsf(ctl_data.roll_setpoint), fabsf(ctl_data.roll_setpoint)); + + + if (!inverted) { + /* Calculate desired yaw rate from coordinated turn constraint / (no side forces) */ + _rate_setpoint = tanf(constrained_roll) * cosf(ctl_data.pitch) * 9.81f / (ctl_data.airspeed < ctl_data.airspeed_min ? + ctl_data.airspeed_min : ctl_data.airspeed); + } + + /* limit the rate */ //XXX: move to body angluar rates + + if (_max_rate > 0.01f) { + _rate_setpoint = (_rate_setpoint > _max_rate) ? _max_rate : _rate_setpoint; + _rate_setpoint = (_rate_setpoint < -_max_rate) ? -_max_rate : _rate_setpoint; + } + + if (!isfinite(_rate_setpoint)) { + /* TODO: Replace with CFE EVS event message. */ + //warnx("yaw rate sepoint not finite"); + _rate_setpoint = 0.0f; + } + + return _rate_setpoint; +} + +float ECL_YawController::control_bodyrate(const struct ECL_ControlData &ctl_data) +{ + /* Do not calculate control signal with bad inputs */ + if (!(isfinite(ctl_data.roll) && isfinite(ctl_data.pitch) && isfinite(ctl_data.body_y_rate) && + isfinite(ctl_data.body_z_rate) && isfinite(ctl_data.pitch_rate_setpoint) && + isfinite(ctl_data.airspeed_min) && isfinite(ctl_data.airspeed_max) && + isfinite(ctl_data.scaler))) { + return math::constrain(_last_output, -1.0f, 1.0f); + } + + /* get the usual dt estimate */ + uint64 dt_micros = PX4LIB_GetPX4ElapsedTimeUs(_last_run); + _last_run = PX4LIB_GetPX4TimeUs(); + float dt = (float)dt_micros * 1e-6f; + + /* lock integral for long intervals */ + bool lock_integrator = ctl_data.lock_integrator; + + if (dt_micros > 500000) { + lock_integrator = true; + } + + /* input conditioning */ + float airspeed = ctl_data.airspeed; + + if (!isfinite(airspeed)) { + /* airspeed is NaN, +- INF or not available, pick center of band */ + airspeed = 0.5f * (ctl_data.airspeed_min + ctl_data.airspeed_max); + + } else if (airspeed < ctl_data.airspeed_min) { + airspeed = ctl_data.airspeed_min; + } + + /* Close the acceleration loop if _coordinated_method wants this: change body_rate setpoint */ + if (_coordinated_method == COORD_METHOD_CLOSEACC) { + // XXX lateral acceleration needs to go into integrator with a gain + //_bodyrate_setpoint -= (ctl_data.acc_body_y / (airspeed * cosf(ctl_data.pitch))); + } + + /* Calculate body angular rate error */ + _rate_error = _bodyrate_setpoint - ctl_data.body_z_rate; // body angular rate error + + if (!lock_integrator && _k_i > 0.0f && airspeed > 0.5f * ctl_data.airspeed_min) { + + float id = _rate_error * dt; + + /* + * anti-windup: do not allow integrator to increase if actuator is at limit + */ + if (_last_output < -1.0f) { + /* only allow motion to center: increase value */ + id = math::max(id, 0.0f); + + } else if (_last_output > 1.0f) { + /* only allow motion to center: decrease value */ + id = math::min(id, 0.0f); + } + + _integrator += id * _k_i; + } + + /* integrator limit */ + //xxx: until start detection is available: integral part in control signal is limited here + float integrator_constrained = math::constrain(_integrator, -_integrator_max, _integrator_max); + + /* Apply PI rate controller and store non-limited output */ + _last_output = (_bodyrate_setpoint * _k_ff + _rate_error * _k_p + integrator_constrained) * ctl_data.scaler * + ctl_data.scaler; //scaler is proportional to 1/airspeed + + + return math::constrain(_last_output, -1.0f, 1.0f); +} + +float ECL_YawController::control_attitude_impl_accclosedloop(const struct ECL_ControlData &ctl_data) +{ + /* dont set a rate setpoint */ + return 0.0f; +} + +float ECL_YawController::control_euler_rate(const struct ECL_ControlData &ctl_data) +{ + /* Transform setpoint to body angular rates (jacobian) */ + _bodyrate_setpoint = -sinf(ctl_data.roll) * ctl_data.pitch_rate_setpoint + + cosf(ctl_data.roll) * cosf(ctl_data.pitch) * _rate_setpoint; + + return control_bodyrate(ctl_data); + +} diff --git a/apps/fac/fsw/src/ECL_YawController.hpp b/apps/fac/fsw/src/ECL_YawController.hpp new file mode 100644 index 000000000..30ecd92de --- /dev/null +++ b/apps/fac/fsw/src/ECL_YawController.hpp @@ -0,0 +1,77 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef ECL_YAWCONTROLLER_HPP +#define ECL_YAWCONTROLLER_HPP + +#include "ECL_Controller.hpp" + +class ECL_YawController : + public ECL_Controller +{ +public: + ECL_YawController(); + ~ECL_YawController() = default; + + float control_attitude(const struct ECL_ControlData &ctl_data); + float control_euler_rate(const struct ECL_ControlData &ctl_data); + float control_bodyrate(const struct ECL_ControlData &ctl_data); + + /* Additional setters */ + void set_coordinated_min_speed(float coordinated_min_speed) + { + _coordinated_min_speed = coordinated_min_speed; + } + + void set_coordinated_method(int32_t coordinated_method) + { + _coordinated_method = coordinated_method; + } + + enum { + COORD_METHOD_OPEN = 0, + COORD_METHOD_CLOSEACC = 1 + }; + +protected: + float _coordinated_min_speed; + float _max_rate; + + int32_t _coordinated_method; + + float control_attitude_impl_openloop(const struct ECL_ControlData &ctl_data); + + float control_attitude_impl_accclosedloop(const struct ECL_ControlData &ctl_data); +}; + +#endif diff --git a/apps/fac/fsw/src/ReadMe.txt b/apps/fac/fsw/src/ReadMe.txt new file mode 100644 index 000000000..0d896c755 --- /dev/null +++ b/apps/fac/fsw/src/ReadMe.txt @@ -0,0 +1,73 @@ +####################################################################################### +# +# File: ReadMe.txt +# Desc: Description of the FAC cFS application +# +####################################################################################### + +A CFS application runs as a child thread in non-realtime OS, like Linux, and as a task +in realtime OS, like VxWorks. + +Once invoked (automatically done by the CFE services), the application first initializes +its data, including creations and registrations of message pipes and tables, subscriptions +to other applications' output data, etc. It waits for the cFE startup sync. Once +that is received it enters a main loop, awaiting for messages to respond to. +(From hereon, this will be referring to as listening mode.) + +App Behavior: +============= +When in listening mode, there are 2 specific messages the application should respond to: + +1) FAC_WAKEUP_MID + + This message is normally sent by the CFS message scheduler. Only upon receiving + this message would the application start doing work. When woken up, the application + will first process and respond to all incoming commands. Then, it will process + all incoming data. Next, it performs 1-cycle worth of data processing. And last, + it sends out its output data (FAC_OUT_DATA_MID) before going back to the + The application's output data is published at its running rate. It should contain + data to be recorded on-board (not downlinked) and data to be consumed by other + applications. + +2) FAC_SEND_HK_MID + + This message is normally sent by the CFS message scheduler. Upon receiving this + message, the application sends out its latest housekepping data (FAC_HK_TLM_MID) + to be downlinked to the ground. Then it goes back to the listening mode. + + The application's housekeeping data is published only upon receiving an + FAC_SEND_HK_MID message. It should contain ONLY essential data that the ground + system needs in order to run the mission effectively. + +Commands: +========= + +In addition to the WAKEUP and SEND_HK commands, this app has a NOOP command and +a RESET command. + +The NOOP command increments the command counter in the housekeeping data. +The RESET command resets the command and command error counters in the +housekeeping data. + +Tables: +========= +This application has two tables, a "config" table and a "CDS" table. The +config table holds the app configuration data that affects app behavior. It + is loaded from a table file. + +The CDS table is data preserved across processor resets in the cFE CDS. +This CDS data is generated by the app and not loaded from a table file. + +cFE Softare Bus Pipes: +====================== +This application has three cFE Software Bus pipes for receiving messages. They +are kept separate because this app's design prioritizes responsiveness to +the FAC_WAKEUP_MID and FAC_SEND_HK_MID commands over other +messages. + +The "scheduling" pipe subscribes to the above wakeup and send housekeeping +commands. + +The "command" pipe subscribes to other app command messages. + +The "data" pipe subscribes to other incoming data messages for processing. diff --git a/apps/fac/fsw/src/fac_app.cpp b/apps/fac/fsw/src/fac_app.cpp new file mode 100644 index 000000000..bcaf2b80d --- /dev/null +++ b/apps/fac/fsw/src/fac_app.cpp @@ -0,0 +1,1004 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +#include +#include + +#include + +#include "fac_tbldefs.h" +#include "fac_app.hpp" +#include "fac_fac.hpp" +#include "fac_data_utils.hpp" +#include "fac_cmds_utils.hpp" +#include "fac_msg.h" +#include "fac_version.h" + +#include + +FAC_AppData_t FAC_AppData; +FAC_CurrentValueTable_t CVT; + +FixedwingAttitudeControl objFAC; +AppCommandProcess objCmds; +AppDataProcess objData; + + +FixedwingAttitudeControl::FixedwingAttitudeControl() +{ + FAC_AppData.uiAppRunStatus = CFE_ES_APP_RUN; + FAC_AppData.bAppAwaken = FALSE; + + FAC_AppData.ConfigTblHdl = 0; + FAC_AppData.ConfigTblPtr = NULL; +} + +FixedwingAttitudeControl::~FixedwingAttitudeControl() +{ + FAC_AppData.uiAppRunStatus = CFE_ES_APP_EXIT; + FAC_AppData.bAppAwaken = FALSE; + + FAC_AppData.ConfigTblHdl = 0; + FAC_AppData.ConfigTblPtr = NULL; +} + +int32 FixedwingAttitudeControl::VerifySchCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 usExpectedLen) +{ + uint16 usMsgLen = 0; + int32 iStatus = CFE_SUCCESS; + + if (MsgPtr != NULL) + { + usMsgLen = CFE_SB_GetTotalMsgLength(MsgPtr); + + if (usExpectedLen != usMsgLen) + { + iStatus = FAC_ERR_MSG_LENGTH; + CFE_SB_MsgId_t MsgId = CFE_SB_GetMsgId(MsgPtr); + uint16 usCmdCode = CFE_SB_GetCmdCode(MsgPtr); + + CFE_EVS_SendEvent(FAC_MSGLEN_ERR_EID, CFE_EVS_ERROR, + "Rcvd invalid msgLen: msgId=0x%08X, cmdCode=%d, " + "msgLen=%d, expectedLen=%d", MsgId, usCmdCode, + usMsgLen, usExpectedLen); + } + } + else + { + iStatus = FAC_ERR_INVALID_POINTER; + } + + return (iStatus); +} + +void FixedwingAttitudeControl::ReportHousekeeping() +{ + int32 iStatus = CFE_SUCCESS; + + /* TODO: Add code to update housekeeping data, if needed, here. */ + + CFE_SB_TimeStampMsg((CFE_SB_Msg_t*)&FAC_AppData.HkTlm); + iStatus = CFE_SB_SendMsg((CFE_SB_Msg_t*)&FAC_AppData.HkTlm); + if (iStatus != CFE_SUCCESS) + { + /* TODO: Decide what to do if the send message fails. */ + } + + return; +} +int32 FixedwingAttitudeControl::SendHkMsg(CFE_SB_Msg_t *MsgPtr, CFE_SB_MsgId_t MsgId) +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = VerifySchCmdLength(MsgPtr, sizeof(FAC_NoArgCmd_t)); + if (iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "Recvd FAC_SEND_HK_MID msgId (0x%04X)", + (unsigned short)MsgId); + if (FAC_AppData.bAppAwaken == TRUE) + { + ReportHousekeeping(); + } + } + else if (iStatus == FAC_ERR_INVALID_POINTER) + { + CFE_EVS_SendEvent(FAC_ERR_EID, CFE_EVS_ERROR, "Invalid Msg Pointer (0x%04X)", + (unsigned short)MsgId); + FAC_AppData.HkTlm.usCmdErrCnt++; + } + else + { + FAC_AppData.HkTlm.usCmdErrCnt++; + } + + return (iStatus); +} + +int32 FixedwingAttitudeControl::WakeupValidate(CFE_SB_Msg_t *MsgPtr, CFE_SB_MsgId_t MsgId) +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = VerifySchCmdLength(MsgPtr, sizeof(FAC_NoArgCmd_t)); + if (iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "Recvd FAC_WAKEUP_MID msgId (0x%04X)", + (unsigned short)MsgId); + + FAC_AppData.bAppAwaken = TRUE; + + /* TODO: Add more code here to handle other things when app wakes up */ + } + else if (iStatus == FAC_ERR_INVALID_POINTER) + { + CFE_EVS_SendEvent(FAC_ERR_EID, CFE_EVS_ERROR, "Invalid Msg Pointer (0x%04X)", + (unsigned short)MsgId); + FAC_AppData.HkTlm.usCmdErrCnt++; + goto WakeupMsg_Exit_Tag; + } + else + { + FAC_AppData.HkTlm.usCmdErrCnt++; + goto WakeupMsg_Exit_Tag; + } + +WakeupMsg_Exit_Tag: + return (iStatus); +} + +int32 FixedwingAttitudeControl::RcvSchMsg(int32 iBlocking) +{ + int32 iStatus = CFE_SUCCESS; + CFE_SB_Msg_t* MsgPtr = NULL; + CFE_SB_MsgId_t MsgId; + + /* Stop Performance Log entry */ + CFE_ES_PerfLogExit(FAC_MAIN_TASK_PERF_ID); + + /* Wait for WakeUp messages from scheduler */ + iStatus = CFE_SB_RcvMsg(&MsgPtr, SchPipeId, iBlocking); + + /* Start Performance Log entry */ + CFE_ES_PerfLogEntry(FAC_MAIN_TASK_PERF_ID); // check when iStatus was failed + + if (iStatus == CFE_SUCCESS) + { + MsgId = CFE_SB_GetMsgId(MsgPtr); + switch (MsgId) + { + case FAC_WAKEUP_MID: + iStatus = WakeupValidate(MsgPtr, MsgId); // can be removed later + if (iStatus != CFE_SUCCESS) + { + goto RcvSchMsg_Exit_Tag; + } + + iStatus = Execute(); + if (iStatus != CFE_SUCCESS) + { + goto RcvSchMsg_Exit_Tag; + } + + /* The last thing to do at the end of this Wakeup cycle should be to + * automatically publish new output. */ + objData.SendOutData(); + break; + + case FAC_SEND_HK_MID: + iStatus = SendHkMsg(MsgPtr, MsgId); + if (iStatus != CFE_SUCCESS) + { + goto RcvSchMsg_Exit_Tag; + } + break; + + default: + CFE_EVS_SendEvent(FAC_MSGID_ERR_EID, CFE_EVS_ERROR, + "Recvd invalid SCH msgId (0x%04X)", + (unsigned short)MsgId); + FAC_AppData.HkTlm.usCmdErrCnt++; + break; + } + } + else if (iStatus == CFE_SB_NO_MESSAGE) + { + /* TODO: If there's no incoming message, you can do something here, or + * nothing. Note, this section is dead code only if the iBlocking arg + * is CFE_SB_PEND_FOREVER. */ + iStatus = CFE_SUCCESS; + } + else if (iStatus == CFE_SB_TIME_OUT) + { + /* TODO: If there's no incoming message within a specified time (via the + * iBlocking arg, you can do something here, or nothing. + * Note, this section is dead code only if the iBlocking arg + * is CFE_SB_PEND_FOREVER. */ + iStatus = CFE_SUCCESS; + } + else + { + /* TODO: This is an example of exiting on an error (either CFE_SB_BAD_ARGUMENT, + * or CFE_SB_PIPE_RD_ERROR). + */ + CFE_EVS_SendEvent(FAC_PIPE_ERR_EID, CFE_EVS_ERROR, + "SB pipe read error (0x%08X), app will exit", + (unsigned int)iStatus); + FAC_AppData.uiAppRunStatus= CFE_ES_APP_ERROR; + } + +RcvSchMsg_Exit_Tag: + return (iStatus); +} + +int32 FixedwingAttitudeControl::Execute() +{ + int32 status = CFE_SUCCESS; + + +// static uint64_t last_run = 0; +// float deltaT = (hrt_absolute_time() - last_run) / 1000000.0f; +// last_run = hrt_absolute_time(); +// +// /* guard against too large deltaT's */ +// if (deltaT > 1.0f) { +// deltaT = 0.01f; +// } +// +// /* load local copies */ +// orb_copy(ORB_ID(vehicle_attitude), _att_sub, &_att); +// +// /* get current rotation matrix and euler angles from control state quaternions */ +// math::Quaternion q_att(_att.q[0], _att.q[1], _att.q[2], _att.q[3]); +// _R = q_att.to_dcm(); +// +// math::Vector<3> euler_angles; +// euler_angles = _R.to_euler(); +// _roll = euler_angles(0); +// _pitch = euler_angles(1); +// _yaw = euler_angles(2); +// +// if (_vehicle_status.is_vtol && _parameters.vtol_type == vtol_type::TAILSITTER) { +// /* vehicle is a tailsitter, we need to modify the estimated attitude for fw mode +// * +// * Since the VTOL airframe is initialized as a multicopter we need to +// * modify the estimated attitude for the fixed wing operation. +// * Since the neutral position of the vehicle in fixed wing mode is -90 degrees rotated around +// * the pitch axis compared to the neutral position of the vehicle in multicopter mode +// * we need to swap the roll and the yaw axis (1st and 3rd column) in the rotation matrix. +// * Additionally, in order to get the correct sign of the pitch, we need to multiply +// * the new x axis of the rotation matrix with -1 +// * +// * original: modified: +// * +// * Rxx Ryx Rzx -Rzx Ryx Rxx +// * Rxy Ryy Rzy -Rzy Ryy Rxy +// * Rxz Ryz Rzz -Rzz Ryz Rxz +// * */ +// math::Matrix<3, 3> R_adapted = _R; //modified rotation matrix +// +// /* move z to x */ +// R_adapted(0, 0) = _R(0, 2); +// R_adapted(1, 0) = _R(1, 2); +// R_adapted(2, 0) = _R(2, 2); +// +// /* move x to z */ +// R_adapted(0, 2) = _R(0, 0); +// R_adapted(1, 2) = _R(1, 0); +// R_adapted(2, 2) = _R(2, 0); +// +// /* change direction of pitch (convert to right handed system) */ +// R_adapted(0, 0) = -R_adapted(0, 0); +// R_adapted(1, 0) = -R_adapted(1, 0); +// R_adapted(2, 0) = -R_adapted(2, 0); +// euler_angles = R_adapted.to_euler(); //adapted euler angles for fixed wing operation +// +// /* fill in new attitude data */ +// _R = R_adapted; +// _roll = euler_angles(0); +// _pitch = euler_angles(1); +// _yaw = euler_angles(2); +// +// /* lastly, roll- and yawspeed have to be swaped */ +// float helper = _att.rollspeed; +// _att.rollspeed = -_att.yawspeed; +// _att.yawspeed = helper; +// } +// +// _sub_airspeed.update(); +// vehicle_setpoint_poll(); +// vehicle_control_mode_poll(); +// vehicle_manual_poll(); +// global_pos_poll(); +// vehicle_status_poll(); +// vehicle_land_detected_poll(); +// battery_status_poll(); +// +// // the position controller will not emit attitude setpoints in some modes +// // we need to make sure that this flag is reset +// _att_sp.fw_control_yaw = _att_sp.fw_control_yaw && _vcontrol_mode.flag_control_auto_enabled; +// +// /* lock integrator until control is started */ +// bool lock_integrator = !(_vcontrol_mode.flag_control_rates_enabled && !_vehicle_status.is_rotary_wing); +// +// /* Simple handling of failsafe: deploy parachute if failsafe is on */ +// if (_vcontrol_mode.flag_control_termination_enabled) { +// _actuators_airframe.control[7] = 1.0f; +// //warnx("_actuators_airframe.control[1] = 1.0f;"); +// +// } else { +// _actuators_airframe.control[7] = 0.0f; +// //warnx("_actuators_airframe.control[1] = -1.0f;"); +// } +// +// /* if we are in rotary wing mode, do nothing */ +// if (_vehicle_status.is_rotary_wing && !_vehicle_status.is_vtol) { +// continue; +// } +// +// /* default flaps to center */ +// float flap_control = 0.0f; +// +// /* map flaps by default to manual if valid */ +// if (PX4_ISFINITE(_manual.flaps) && _vcontrol_mode.flag_control_manual_enabled +// && fabsf(_parameters.flaps_scale) > 0.01f) { +// flap_control = 0.5f * (_manual.flaps + 1.0f) * _parameters.flaps_scale; +// +// } else if (_vcontrol_mode.flag_control_auto_enabled +// && fabsf(_parameters.flaps_scale) > 0.01f) { +// flap_control = _att_sp.apply_flaps ? 1.0f * _parameters.flaps_scale : 0.0f; +// } +// +// // move the actual control value continuous with time, full flap travel in 1sec +// if (fabsf(_flaps_applied - flap_control) > 0.01f) { +// _flaps_applied += (_flaps_applied - flap_control) < 0 ? deltaT : -deltaT; +// +// } else { +// _flaps_applied = flap_control; +// } +// +// /* default flaperon to center */ +// float flaperon_control = 0.0f; +// +// /* map flaperons by default to manual if valid */ +// if (PX4_ISFINITE(_manual.aux2) && _vcontrol_mode.flag_control_manual_enabled +// && fabsf(_parameters.flaperon_scale) > 0.01f) { +// flaperon_control = 0.5f * (_manual.aux2 + 1.0f) * _parameters.flaperon_scale; +// +// } else if (_vcontrol_mode.flag_control_auto_enabled +// && fabsf(_parameters.flaperon_scale) > 0.01f) { +// flaperon_control = _att_sp.apply_flaps ? 1.0f * _parameters.flaperon_scale : 0.0f; +// } +// +// // move the actual control value continuous with time, full flap travel in 1sec +// if (fabsf(_flaperons_applied - flaperon_control) > 0.01f) { +// _flaperons_applied += (_flaperons_applied - flaperon_control) < 0 ? deltaT : -deltaT; +// +// } else { +// _flaperons_applied = flaperon_control; +// } +// +// // Check if we are in rattitude mode and the pilot is above the threshold on pitch +// if (_vcontrol_mode.flag_control_rattitude_enabled) { +// if (fabsf(_manual.y) > _parameters.rattitude_thres || +// fabsf(_manual.x) > _parameters.rattitude_thres) { +// _vcontrol_mode.flag_control_attitude_enabled = false; +// } +// } +// +// /* decide if in stabilized or full manual control */ +// if (_vcontrol_mode.flag_control_rates_enabled) { +// /* scale around tuning airspeed */ +// float airspeed; +// +// /* if airspeed is non-finite or not valid or if we are asked not to control it, we assume the normal average speed */ +// const bool airspeed_valid = PX4_ISFINITE(_sub_airspeed.get().indicated_airspeed_m_s) +// && ((_sub_airspeed.get().timestamp - hrt_absolute_time()) < 1e6); +// +// if (airspeed_valid) { +// /* prevent numerical drama by requiring 0.5 m/s minimal speed */ +// airspeed = math::max(0.5f, _sub_airspeed.get().indicated_airspeed_m_s); +// +// } else { +// airspeed = _parameters.airspeed_trim; +// perf_count(_nonfinite_input_perf); +// } +// +// /* +// * For scaling our actuators using anything less than the min (close to stall) +// * speed doesn't make any sense - its the strongest reasonable deflection we +// * want to do in flight and its the baseline a human pilot would choose. +// * +// * Forcing the scaling to this value allows reasonable handheld tests. +// */ +// float airspeed_scaling = _parameters.airspeed_trim / ((airspeed < _parameters.airspeed_min) ? _parameters.airspeed_min : +// airspeed); +// +// /* Use min airspeed to calculate ground speed scaling region. +// * Don't scale below gspd_scaling_trim +// */ +// float groundspeed = sqrtf(_global_pos.vel_n * _global_pos.vel_n + +// _global_pos.vel_e * _global_pos.vel_e); +// float gspd_scaling_trim = (_parameters.airspeed_min * 0.6f); +// float groundspeed_scaler = gspd_scaling_trim / ((groundspeed < gspd_scaling_trim) ? gspd_scaling_trim : groundspeed); +// +// // in STABILIZED mode we need to generate the attitude setpoint +// // from manual user inputs +// if (!_vcontrol_mode.flag_control_climb_rate_enabled && !_vcontrol_mode.flag_control_offboard_enabled) { +// _att_sp.timestamp = hrt_absolute_time(); +// _att_sp.roll_body = _manual.y * _parameters.man_roll_max + _parameters.rollsp_offset_rad; +// _att_sp.roll_body = math::constrain(_att_sp.roll_body, -_parameters.man_roll_max, _parameters.man_roll_max); +// _att_sp.pitch_body = -_manual.x * _parameters.man_pitch_max + _parameters.pitchsp_offset_rad; +// _att_sp.pitch_body = math::constrain(_att_sp.pitch_body, -_parameters.man_pitch_max, _parameters.man_pitch_max); +// _att_sp.yaw_body = 0.0f; +// _att_sp.thrust = _manual.z; +// +// Quatf q(Eulerf(_att_sp.roll_body, _att_sp.pitch_body, _att_sp.yaw_body)); +// q.copyTo(_att_sp.q_d); +// _att_sp.q_d_valid = true; +// +// int instance; +// orb_publish_auto(_attitude_setpoint_id, &_attitude_sp_pub, &_att_sp, &instance, ORB_PRIO_DEFAULT); +// } +// +// /* reset integrals where needed */ +// if (_att_sp.roll_reset_integral) { +// _roll_ctrl.reset_integrator(); +// } +// +// if (_att_sp.pitch_reset_integral) { +// _pitch_ctrl.reset_integrator(); +// } +// +// if (_att_sp.yaw_reset_integral) { +// _yaw_ctrl.reset_integrator(); +// _wheel_ctrl.reset_integrator(); +// } +// +// /* Reset integrators if the aircraft is on ground +// * or a multicopter (but not transitioning VTOL) +// */ +// if (_vehicle_land_detected.landed +// || (_vehicle_status.is_rotary_wing && !_vehicle_status.in_transition_mode)) { +// +// _roll_ctrl.reset_integrator(); +// _pitch_ctrl.reset_integrator(); +// _yaw_ctrl.reset_integrator(); +// _wheel_ctrl.reset_integrator(); +// } +// +// float roll_sp = _att_sp.roll_body; +// float pitch_sp = _att_sp.pitch_body; +// float yaw_sp = _att_sp.yaw_body; +// float throttle_sp = _att_sp.thrust; +// +// /* Prepare data for attitude controllers */ +// struct ECL_ControlData control_input = {}; +// control_input.roll = _roll; +// control_input.pitch = _pitch; +// control_input.yaw = _yaw; +// control_input.body_x_rate = _att.rollspeed; +// control_input.body_y_rate = _att.pitchspeed; +// control_input.body_z_rate = _att.yawspeed; +// control_input.roll_setpoint = roll_sp; +// control_input.pitch_setpoint = pitch_sp; +// control_input.yaw_setpoint = yaw_sp; +// control_input.airspeed_min = _parameters.airspeed_min; +// control_input.airspeed_max = _parameters.airspeed_max; +// control_input.airspeed = airspeed; +// control_input.scaler = airspeed_scaling; +// control_input.lock_integrator = lock_integrator; +// control_input.groundspeed = groundspeed; +// control_input.groundspeed_scaler = groundspeed_scaler; +// +// _yaw_ctrl.set_coordinated_method(_parameters.y_coordinated_method); +// +// /* Run attitude controllers */ +// if (_vcontrol_mode.flag_control_attitude_enabled) { +// if (PX4_ISFINITE(roll_sp) && PX4_ISFINITE(pitch_sp)) { +// _roll_ctrl.control_attitude(control_input); +// _pitch_ctrl.control_attitude(control_input); +// _yaw_ctrl.control_attitude(control_input); //runs last, because is depending on output of roll and pitch attitude +// _wheel_ctrl.control_attitude(control_input); +// +// /* Update input data for rate controllers */ +// control_input.roll_rate_setpoint = _roll_ctrl.get_desired_rate(); +// control_input.pitch_rate_setpoint = _pitch_ctrl.get_desired_rate(); +// control_input.yaw_rate_setpoint = _yaw_ctrl.get_desired_rate(); +// +// /* Run attitude RATE controllers which need the desired attitudes from above, add trim */ +// float roll_u = _roll_ctrl.control_euler_rate(control_input); +// _actuators.control[actuator_controls_s::INDEX_ROLL] = (PX4_ISFINITE(roll_u)) ? roll_u + _parameters.trim_roll : +// _parameters.trim_roll; +// +// if (!PX4_ISFINITE(roll_u)) { +// _roll_ctrl.reset_integrator(); +// perf_count(_nonfinite_output_perf); +// +// if (_debug && loop_counter % 10 == 0) { +// warnx("roll_u %.4f", (double)roll_u); +// } +// } +// +// float pitch_u = _pitch_ctrl.control_euler_rate(control_input); +// _actuators.control[actuator_controls_s::INDEX_PITCH] = (PX4_ISFINITE(pitch_u)) ? pitch_u + _parameters.trim_pitch : +// _parameters.trim_pitch; +// +// if (!PX4_ISFINITE(pitch_u)) { +// _pitch_ctrl.reset_integrator(); +// perf_count(_nonfinite_output_perf); +// +// if (_debug && loop_counter % 10 == 0) { +// warnx("pitch_u %.4f, _yaw_ctrl.get_desired_rate() %.4f," +// " airspeed %.4f, airspeed_scaling %.4f," +// " roll_sp %.4f, pitch_sp %.4f," +// " _roll_ctrl.get_desired_rate() %.4f," +// " _pitch_ctrl.get_desired_rate() %.4f" +// " att_sp.roll_body %.4f", +// (double)pitch_u, (double)_yaw_ctrl.get_desired_rate(), +// (double)airspeed, (double)airspeed_scaling, +// (double)roll_sp, (double)pitch_sp, +// (double)_roll_ctrl.get_desired_rate(), +// (double)_pitch_ctrl.get_desired_rate(), +// (double)_att_sp.roll_body); +// } +// } +// +// float yaw_u = 0.0f; +// +// if (_parameters.w_en && _att_sp.fw_control_yaw) { +// yaw_u = _wheel_ctrl.control_bodyrate(control_input); +// +// } else { +// yaw_u = _yaw_ctrl.control_euler_rate(control_input); +// } +// +// _actuators.control[actuator_controls_s::INDEX_YAW] = (PX4_ISFINITE(yaw_u)) ? yaw_u + _parameters.trim_yaw : +// _parameters.trim_yaw; +// +// /* add in manual rudder control in manual modes */ +// if (_vcontrol_mode.flag_control_manual_enabled) { +// _actuators.control[actuator_controls_s::INDEX_YAW] += _manual.r; +// } +// +// if (!PX4_ISFINITE(yaw_u)) { +// _yaw_ctrl.reset_integrator(); +// _wheel_ctrl.reset_integrator(); +// perf_count(_nonfinite_output_perf); +// +// if (_debug && loop_counter % 10 == 0) { +// warnx("yaw_u %.4f", (double)yaw_u); +// } +// } +// +// /* throttle passed through if it is finite and if no engine failure was detected */ +// _actuators.control[actuator_controls_s::INDEX_THROTTLE] = (PX4_ISFINITE(throttle_sp) && +// !(_vehicle_status.engine_failure || +// _vehicle_status.engine_failure_cmd)) ? +// throttle_sp : 0.0f; +// +// /* scale effort by battery status */ +// if (_parameters.bat_scale_en && _battery_status.scale > 0.0f && +// _actuators.control[actuator_controls_s::INDEX_THROTTLE] > 0.1f) { +// _actuators.control[actuator_controls_s::INDEX_THROTTLE] *= _battery_status.scale; +// } +// +// +// if (!PX4_ISFINITE(throttle_sp)) { +// if (_debug && loop_counter % 10 == 0) { +// warnx("throttle_sp %.4f", (double)throttle_sp); +// } +// } +// +// } else { +// perf_count(_nonfinite_input_perf); +// +// if (_debug && loop_counter % 10 == 0) { +// warnx("Non-finite setpoint roll_sp: %.4f, pitch_sp %.4f", (double)roll_sp, (double)pitch_sp); +// } +// } +// +// } else { +// // pure rate control +// _roll_ctrl.set_bodyrate_setpoint(_manual.y * _parameters.acro_max_x_rate_rad); +// _pitch_ctrl.set_bodyrate_setpoint(-_manual.x * _parameters.acro_max_y_rate_rad); +// _yaw_ctrl.set_bodyrate_setpoint(_manual.r * _parameters.acro_max_z_rate_rad); +// +// float roll_u = _roll_ctrl.control_bodyrate(control_input); +// _actuators.control[actuator_controls_s::INDEX_ROLL] = (PX4_ISFINITE(roll_u)) ? roll_u + _parameters.trim_roll : +// _parameters.trim_roll; +// +// float pitch_u = _pitch_ctrl.control_bodyrate(control_input); +// _actuators.control[actuator_controls_s::INDEX_PITCH] = (PX4_ISFINITE(pitch_u)) ? pitch_u + _parameters.trim_pitch : +// _parameters.trim_pitch; +// +// float yaw_u = _yaw_ctrl.control_bodyrate(control_input); +// _actuators.control[actuator_controls_s::INDEX_YAW] = (PX4_ISFINITE(yaw_u)) ? yaw_u + _parameters.trim_yaw : +// _parameters.trim_yaw; +// +// _actuators.control[actuator_controls_s::INDEX_THROTTLE] = (PX4_ISFINITE(throttle_sp) && +// //!(_vehicle_status.engine_failure || +// !_vehicle_status.engine_failure_cmd) ? +// throttle_sp : 0.0f; +// } +// +// /* +// * Lazily publish the rate setpoint (for analysis, the actuators are published below) +// * only once available +// */ +// _rates_sp.roll = _roll_ctrl.get_desired_bodyrate(); +// _rates_sp.pitch = _pitch_ctrl.get_desired_bodyrate(); +// _rates_sp.yaw = _yaw_ctrl.get_desired_bodyrate(); +// +// _rates_sp.timestamp = hrt_absolute_time(); +// +// if (_rate_sp_pub != nullptr) { +// /* publish the attitude rates setpoint */ +// orb_publish(_rates_sp_id, _rate_sp_pub, &_rates_sp); +// +// } else if (_rates_sp_id) { +// /* advertise the attitude rates setpoint */ +// _rate_sp_pub = orb_advertise(_rates_sp_id, &_rates_sp); +// } +// +// } else { +// /* manual/direct control */ +// _actuators.control[actuator_controls_s::INDEX_ROLL] = _manual.y * _parameters.man_roll_scale + _parameters.trim_roll; +// _actuators.control[actuator_controls_s::INDEX_PITCH] = -_manual.x * _parameters.man_pitch_scale + +// _parameters.trim_pitch; +// _actuators.control[actuator_controls_s::INDEX_YAW] = _manual.r * _parameters.man_yaw_scale + _parameters.trim_yaw; +// _actuators.control[actuator_controls_s::INDEX_THROTTLE] = _manual.z; +// } +// +// // Add feed-forward from roll control output to yaw control output +// // This can be used to counteract the adverse yaw effect when rolling the plane +// _actuators.control[actuator_controls_s::INDEX_YAW] += _parameters.roll_to_yaw_ff * math::constrain( +// _actuators.control[actuator_controls_s::INDEX_ROLL], -1.0f, 1.0f); +// +// _actuators.control[actuator_controls_s::INDEX_FLAPS] = _flaps_applied; +// _actuators.control[5] = _manual.aux1; +// _actuators.control[actuator_controls_s::INDEX_AIRBRAKES] = _flaperons_applied; +// // FIXME: this should use _vcontrol_mode.landing_gear_pos in the future +// _actuators.control[7] = _manual.aux3; +// +// /* lazily publish the setpoint only once available */ +// _actuators.timestamp = hrt_absolute_time(); +// _actuators.timestamp_sample = _att.timestamp; +// _actuators_airframe.timestamp = hrt_absolute_time(); +// _actuators_airframe.timestamp_sample = _att.timestamp; +// +// /* Only publish if any of the proper modes are enabled */ +// if (_vcontrol_mode.flag_control_rates_enabled || +// _vcontrol_mode.flag_control_attitude_enabled || +// _vcontrol_mode.flag_control_manual_enabled) { +// /* publish the actuator controls */ +// if (_actuators_0_pub != nullptr) { +// orb_publish(_actuators_id, _actuators_0_pub, &_actuators); +// +// } else if (_actuators_id) { +// _actuators_0_pub = orb_advertise(_actuators_id, &_actuators); +// } +// +// if (_actuators_2_pub != nullptr) { +// /* publish the actuator controls*/ +// orb_publish(ORB_ID(actuator_controls_2), _actuators_2_pub, &_actuators_airframe); +// +// } else { +// /* advertise and publish */ +// _actuators_2_pub = orb_advertise(ORB_ID(actuator_controls_2), &_actuators_airframe); +// } +// } + + + + + return status; +} + +int32 FixedwingAttitudeControl::InitHk() +{ + int32 iStatus = CFE_SUCCESS; + + /* Init housekeeping packet */ +// memset((void*)&FAC_AppData.HkTlm, 0x00, sizeof(FAC_AppData.HkTlm)); // check this + CFE_SB_InitMsg(&FAC_AppData.HkTlm, FAC_HK_TLM_MID, + sizeof(FAC_AppData.HkTlm), TRUE); + + return (iStatus); +} + +int32 FixedwingAttitudeControl::InitSchPipe() +{ + int32 iStatus = CFE_SUCCESS; + + /* Init schedule pipe and subscribe to wakeup messages */ + iStatus = CFE_SB_CreatePipe(&SchPipeId, FAC_SCH_PIPE_DEPTH, FAC_SCH_PIPE_NAME); + if (iStatus == CFE_SUCCESS) + { + iStatus = CFE_SB_SubscribeEx(FAC_WAKEUP_MID, SchPipeId, CFE_SB_Default_Qos, + FAC_SCH_PIPE_WAKEUP_RESERVED); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Sch Pipe failed to subscribe to FAC_WAKEUP_MID. (0x%08X)", + (unsigned int)iStatus); + goto InitSchPipe_Exit_Tag; + } + + iStatus = CFE_SB_SubscribeEx(FAC_SEND_HK_MID, SchPipeId, CFE_SB_Default_Qos, + FAC_SCH_PIPE_SEND_HK_RESERVED); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "CMD Pipe failed to subscribe to FAC_SEND_HK_MID. (0x%08X)", + (unsigned int)iStatus); + goto InitSchPipe_Exit_Tag; + } + } + else + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to create SCH pipe (0x%08X)", + (unsigned int)iStatus); + goto InitSchPipe_Exit_Tag; + } + +InitSchPipe_Exit_Tag: + return (iStatus); +} + +int32 FixedwingAttitudeControl::InitEvent() +{ + int32 iStatus = CFE_SUCCESS; + int32 ind = 0; + + /* Initialize the event filter table. + * Note: 0 is the CFE_EVS_NO_FILTER mask and event 0 is reserved (not used) */ + memset((void*)EventTbl, 0x00, sizeof(EventTbl)); // check this + + /* TODO: Choose the events you want to filter. CFE_EVS_MAX_EVENT_FILTERS + * limits the number of filters per app. An explicit CFE_EVS_NO_FILTER + * (the default) has been provided as an example. */ + EventTbl[ ind].EventID = FAC_RESERVED_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + EventTbl[ ind].EventID = FAC_INF_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + EventTbl[ ind].EventID = FAC_CONFIG_TABLE_ERR_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + EventTbl[ ind].EventID = FAC_CDS_ERR_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + EventTbl[ ind].EventID = FAC_PIPE_ERR_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + EventTbl[ ind].EventID = FAC_MSGID_ERR_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + EventTbl[ ind].EventID = FAC_MSGLEN_ERR_EID; + EventTbl[ind++].Mask = CFE_EVS_NO_FILTER; + + /* Register the table with CFE */ + iStatus = CFE_EVS_Register(EventTbl, FAC_EVT_CNT, CFE_EVS_BINARY_FILTER); + if (iStatus != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("FAC - Failed to register with EVS (0x%08X)\n", + (unsigned int)iStatus); + } + + return (iStatus); +} + +int32 FAC_RcvMsg() +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = objFAC.RcvSchMsg(FAC_SCH_PIPE_PEND_TIME); + if (iStatus != CFE_SUCCESS) + { + goto RcvMsg_Exit_Tag; + } + + iStatus = objCmds.RcvCmdMsg(CFE_SB_POLL); + if (iStatus != CFE_SUCCESS) + { + goto RcvMsg_Exit_Tag; + } + + iStatus = objData.RcvDataMsg(CFE_SB_POLL); + if (iStatus != CFE_SUCCESS) + { + goto RcvMsg_Exit_Tag; + } + +RcvMsg_Exit_Tag: + return iStatus; +} + +/* Startup steps to initialize (or restore from CDS) FAC data structures */ +int32 FAC_InitApp() +{ + int32 iStatus = CFE_SUCCESS; + int8 hasEvents = 0; + + iStatus = objFAC.InitEvent(); + if (iStatus != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("FAC - Failed to init events (0x%08X)\n", + (unsigned int)iStatus); + goto InitApp_Exit_Tag; + } + else + { + hasEvents = 1; + } + + iStatus = objFAC.InitSchPipe(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to init Sch pipe (0x%08X)", + (unsigned int)iStatus); + goto InitApp_Exit_Tag; + } + + iStatus = objCmds.InitCmdsPipe(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to init Cmds pipe (0x%08X)", + (unsigned int)iStatus); + goto InitApp_Exit_Tag; + } + + iStatus = objData.InitDataPipe(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to init Cds pipe (0x%08X)", + (unsigned int)iStatus); + goto InitApp_Exit_Tag; + } + + iStatus = objFAC.InitHk(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to init Hk (0x%08X)", + (unsigned int)iStatus); + goto InitApp_Exit_Tag; + } + + iStatus = objData.InitTables(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to init Tables (0x%08X)", + (unsigned int)iStatus); + goto InitApp_Exit_Tag; + } + +InitApp_Exit_Tag: + if (iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_INF_EID, CFE_EVS_INFORMATION, + "Initialized. Version %d.%d.%d.%d", + FAC_MAJOR_VERSION, + FAC_MINOR_VERSION, + FAC_REVISION, + FAC_MISSION_REV); + } + else + { + if (hasEvents == 1) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Application failed to initialize"); + } + else + { + CFE_ES_WriteToSysLog("FAC - Application failed to initialize\n"); + } + } + + return (iStatus); +} + +extern "C" void FAC_AppMain() +{ + int32 iStatus = CFE_SUCCESS; + + /* Register the application with Executive Services */ + iStatus = CFE_ES_RegisterApp(); + if (iStatus != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("FAC - Failed to register the app (0x%08X)\n", + (unsigned int)iStatus); + } + + /* Start Performance Log entry */ + CFE_ES_PerfLogEntry(FAC_MAIN_TASK_PERF_ID); + + /* Perform application initializations */ + if (iStatus == CFE_SUCCESS) + { + iStatus = FAC_InitApp(); // Constructors + if (iStatus == CFE_SUCCESS) + { + /* Do not perform performance monitoring on startup sync */ + CFE_ES_PerfLogExit(FAC_MAIN_TASK_PERF_ID); + CFE_ES_WaitForStartupSync(FAC_STARTUP_TIMEOUT_MSEC); + CFE_ES_PerfLogEntry(FAC_MAIN_TASK_PERF_ID); + } + else + { + FAC_AppData.uiAppRunStatus = CFE_ES_APP_ERROR; + } + } + + /* Application main loop */ + while (CFE_ES_RunLoop(&FAC_AppData.uiAppRunStatus) == TRUE) + { + iStatus = FAC_RcvMsg(); + if (iStatus == FAC_ERR_INVALID_POINTER) + { + CFE_EVS_SendEvent(FAC_ERR_EID, CFE_EVS_ERROR, + "Application Fatal Error(Invalid pointer)"); + FAC_AppData.uiAppRunStatus = CFE_ES_APP_ERROR; + goto AppMain_Exit_Tag; + } + else if (iStatus != CFE_SUCCESS) + { + /* TODO: Decide what to do for other return values in FAC_RcvMsg(). */ + } + + + /* TODO: This is only a suggestion for when to update and save CDS table. + ** Depends on the nature of the application, the frequency of update + ** and save can be more or less independently. + */ + } + +AppMain_Exit_Tag: + CFE_ES_WriteToSysLog("FAC - Error detected. App will exit (0x%08X)\n", + (unsigned int)iStatus); + + /* Stop Performance Log entry */ + CFE_ES_PerfLogExit(FAC_MAIN_TASK_PERF_ID); + + /* Exit the application */ + CFE_ES_ExitApp(FAC_AppData.uiAppRunStatus); +} diff --git a/apps/fac/fsw/src/fac_app.hpp b/apps/fac/fsw/src/fac_app.hpp new file mode 100644 index 000000000..e8417c536 --- /dev/null +++ b/apps/fac/fsw/src/fac_app.hpp @@ -0,0 +1,98 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_APP_HPP +#define FAC_APP_HPP + +#include "cfe.h" + +#include "fac_platform_cfg.h" +#include "fac_mission_cfg.h" +#include "fac_private_ids.h" +#include "fac_private_types.h" +#include "fac_perfids.h" +#include "fac_msgids.h" +#include "fac_msg.h" +#include "fac_events.h" + + +#define FAC_TIMEOUT_MSEC (1000) + + +typedef struct +{ + uint32 uiAppRunStatus; + boolean bAppAwaken; + + FAC_HkTlm_t HkTlm; + + CFE_TBL_Handle_t ConfigTblHdl; + + FAC_ConfigTbl_t *ConfigTblPtr; +} FAC_AppData_t; + +typedef struct +{ + PX4_AirspeedMsg_t Airspeed; // check : should be vector + PX4_BatteryStatusMsg_t BatteryStatus; + PX4_ManualControlSetpointMsg_t ManualControlSetpoint; + PX4_VehicleAttitudeMsg_t VehicleAttitude; + PX4_VehicleAttitudeSetpointMsg_t VehicleAttitudeSetpoint; + PX4_VehicleControlModeMsg_t VehicleControlMode; + PX4_VehicleGlobalPositionMsg_t VehicleGlobalPosition; + PX4_VehicleLandDetectedMsg_t VehicleLandDetected; + PX4_VehicleStatusMsg_t VehicleStatus; +} FAC_CurrentValueTable_t; + + +/************************************************************************/ +/** \brief CFS Fixedwing Attitude Control App Task (FAC) application +** entry point +** +** \par Description +** CFS Fixedwing Attitude Control App Task application entry point. +** This function performs app initialization, then waits for the +** cFE ES Startup Sync, then executes the RPR main processing loop. +** +** \par Assumptions, External Events, and Notes: +** If there is an unrecoverable failure during initialization the +** main loop is never executed and the application will exit. +** +*************************************************************************/ +#ifdef __cplusplus +extern "C" { +void FAC_AppMain(void); +} +#endif + +#endif /* FAC_APP_HPP */ diff --git a/apps/fac/fsw/src/fac_cmds_utils.cpp b/apps/fac/fsw/src/fac_cmds_utils.cpp new file mode 100644 index 000000000..4b71a824f --- /dev/null +++ b/apps/fac/fsw/src/fac_cmds_utils.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +#include + +#include + +#include "fac_tbldefs.h" +#include "fac_app.hpp" +#include "fac_cmds_utils.hpp" +#include "fac_version.h" + + +extern FAC_AppData_t FAC_AppData; + + +AppCommandProcess::AppCommandProcess() +{ +} + +AppCommandProcess::~AppCommandProcess() +{ +} + +int32 AppCommandProcess::VerifyCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 usExpectedLen) +{ + uint16 usMsgLen = 0; + int32 iStatus = CFE_SUCCESS; + + if (MsgPtr != NULL) + { + usMsgLen = CFE_SB_GetTotalMsgLength(MsgPtr); + + if (usExpectedLen != usMsgLen) + { + iStatus = FAC_ERR_MSG_LENGTH; + CFE_SB_MsgId_t MsgId = CFE_SB_GetMsgId(MsgPtr); + uint16 usCmdCode = CFE_SB_GetCmdCode(MsgPtr); + + CFE_EVS_SendEvent(FAC_MSGLEN_ERR_EID, CFE_EVS_ERROR, + "Rcvd invalid msgLen: msgId=0x%08X, cmdCode=%d, " + "msgLen=%d, expectedLen=%d", MsgId, usCmdCode, + usMsgLen, usExpectedLen); + } +// Add more to check + } + else + { + iStatus = FAC_ERR_INVALID_POINTER; + } + + return (iStatus); +} + +int32 AppCommandProcess::ProcessNewAppCmds(CFE_SB_Msg_t *MsgPtr) +{ + int32 iStatus = CFE_SUCCESS; + uint32 uiCmdCode = 0; + + if (MsgPtr != NULL) + { + uiCmdCode = CFE_SB_GetCmdCode(MsgPtr); + switch (uiCmdCode) + { + case FAC_NOOP_CC: + iStatus = VerifyCmdLength(MsgPtr, sizeof(FAC_NoArgCmd_t)); + if (iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_CMD_INF_EID, CFE_EVS_INFORMATION, + "Recvd NOOP cmd (%u), Version %d.%d.%d.%d", + (unsigned int)uiCmdCode, FAC_MAJOR_VERSION, + FAC_MINOR_VERSION, FAC_REVISION, FAC_MISSION_REV); + FAC_AppData.HkTlm.usCmdCnt++; + } + else if (iStatus == FAC_ERR_INVALID_POINTER) + { + CFE_EVS_SendEvent(FAC_ERR_EID, CFE_EVS_ERROR, + "Invalid Cmd Msg Pointer (0x%08X)", + (unsigned int)iStatus); + FAC_AppData.HkTlm.usCmdErrCnt++; + } + else + { + FAC_AppData.HkTlm.usCmdErrCnt++; + } + break; + + case FAC_RESET_CC: + iStatus = VerifyCmdLength(MsgPtr, sizeof(FAC_NoArgCmd_t)); + if (iStatus == CFE_SUCCESS) + { + FAC_AppData.HkTlm.usCmdCnt = 0; + FAC_AppData.HkTlm.usCmdErrCnt = 0; + CFE_EVS_SendEvent(FAC_CMD_INF_EID, CFE_EVS_INFORMATION, + "Recvd RESET cmd (%u)", (unsigned int)uiCmdCode); + } + else if (iStatus == FAC_ERR_INVALID_POINTER) + { + CFE_EVS_SendEvent(FAC_ERR_EID, CFE_EVS_ERROR, + "Invalid Cmd Msg Pointer (0x%08X)", + (unsigned int)iStatus); + FAC_AppData.HkTlm.usCmdErrCnt++; + } + else + { + FAC_AppData.HkTlm.usCmdErrCnt++; + } + break; + + /* TODO: Add code to process the rest of the FAC commands here */ + + default: + FAC_AppData.HkTlm.usCmdErrCnt++; + CFE_EVS_SendEvent(FAC_MSGID_ERR_EID, CFE_EVS_ERROR, + "Recvd invalid cmdId (%u)", (unsigned int)uiCmdCode); + break; + } + } + else + { + iStatus = FAC_ERR_INVALID_POINTER; // Maybe CFE_OS_INVALID_POINTER + } + + return (iStatus); +} + +int32 AppCommandProcess::RcvCmdMsg(int32 iBlocking) +{ + int32 iStatus = CFE_SUCCESS; + CFE_SB_Msg_t* MsgPtr = NULL; + CFE_SB_MsgId_t MsgId; + + /* Process command messages till the pipe is empty */ + iStatus = CFE_SB_RcvMsg(&MsgPtr, CmdPipeId, iBlocking); + if(iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, // check display level + "RcvCmdMsg:Receivd message (0x%08X)", + (unsigned int)iStatus); + if (FAC_AppData.bAppAwaken == TRUE) + { + MsgId = CFE_SB_GetMsgId(MsgPtr); + switch (MsgId) + { + case FAC_CMD_MID: + iStatus = ProcessNewAppCmds(MsgPtr); + if (iStatus != CFE_SUCCESS) + { + goto RcvCmdMsg_Exit_Tag; + } + break; + + /* TODO: Add code to process other subscribed commands here + ** + ** Example: + ** case CFE_TIME_DATA_CMD_MID: + ** FAC_ProcessTimeDataCmd(MsgPtr); + ** break; + */ + + default: + /* Bump the command error counter for an unknown command. + * (This should only occur if it was subscribed to with this + * pipe, but not handled in this switch-case.) */ + FAC_AppData.HkTlm.usCmdErrCnt++; + CFE_EVS_SendEvent(FAC_MSGID_ERR_EID, CFE_EVS_ERROR, + "Recvd invalid CMD msgId (0x%04X)", + (unsigned short)MsgId); + break; + } + } + } + else if (iStatus == CFE_SB_NO_MESSAGE) + { + iStatus = CFE_SUCCESS; + } + else + { + CFE_EVS_SendEvent(FAC_PIPE_ERR_EID, CFE_EVS_ERROR, + "CMD pipe read error (0x%08X)", (unsigned int)iStatus); + goto RcvCmdMsg_Exit_Tag; + } + +RcvCmdMsg_Exit_Tag: + return iStatus; +} + +int32 AppCommandProcess::InitCmdsPipe() +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = CFE_SB_CreatePipe(&CmdPipeId, FAC_CMD_PIPE_DEPTH, FAC_CMD_PIPE_NAME); + if (iStatus == CFE_SUCCESS) + { + iStatus = CFE_SB_Subscribe(FAC_CMD_MID, CmdPipeId); // Check SubscribeEx + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to subscribe to FAC_CMD_MID. (0x%08X)", + (unsigned int)iStatus); + goto InitCmdsPipe_Exit_Tag; + } + else + { + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "InitCmdsPipe: Successfully subscribed to FAC_CMD_MID (0x%08X)\n", + (unsigned int)iStatus); + } + } + else + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to create CMD pipe (0x%08X)", + (unsigned int)iStatus); + goto InitCmdsPipe_Exit_Tag; + } + +InitCmdsPipe_Exit_Tag: + return iStatus; +} diff --git a/apps/fac/fsw/src/fac_cmds_utils.hpp b/apps/fac/fsw/src/fac_cmds_utils.hpp new file mode 100644 index 000000000..ca9cf9547 --- /dev/null +++ b/apps/fac/fsw/src/fac_cmds_utils.hpp @@ -0,0 +1,56 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_CMDS_UTILS_HPP +#define FAC_CMDS_UTILS_HPP + + +class AppCommandProcess +{ +public: + AppCommandProcess(); + ~AppCommandProcess(); + + int32 InitCmdsPipe(); + int32 RcvCmdMsg(int32 iBlocking); + +private: + CFE_SB_PipeId_t CmdPipeId; + + int32 ProcessNewAppCmds(CFE_SB_Msg_t *MsgPtr); + int32 VerifyCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 usExpectedLen); + +}; + + +#endif diff --git a/apps/fac/fsw/src/fac_data_utils.cpp b/apps/fac/fsw/src/fac_data_utils.cpp new file mode 100644 index 000000000..057e11115 --- /dev/null +++ b/apps/fac/fsw/src/fac_data_utils.cpp @@ -0,0 +1,556 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +#include + +#include + +#include "fac_tbldefs.h" +#include "fac_app.hpp" +#include "fac_data_utils.hpp" +#include "fac_msgids.h" + +#include + + +extern FAC_AppData_t FAC_AppData; + +extern FAC_CurrentValueTable_t CVT; + + +AppDataProcess::AppDataProcess() +{ +} + +AppDataProcess::~AppDataProcess() +{ +} + +void AppDataProcess::SendOutData() +{ + /* TODO: Add code to update output data, if needed, here. */ + + CFE_SB_TimeStampMsg((CFE_SB_Msg_t*)&OutData); + int32 iStatus = CFE_SB_SendMsg((CFE_SB_Msg_t*)&OutData); + if (iStatus != CFE_SUCCESS) + { + /* TODO: Decide what to do if the send message fails. */ + } +} + +void AppDataProcess::ProcessNewConfigTbl() +{ + /* TODO: Add code to set new Config parameters with new values here. + ** + ** Examples: + ** + ** FAC_AppData.latest_sParam = FAC_AppData.ConfigTblPtr->sParam; + ** FAC_AppData.latest_fParam = FAC_AppData.ConfigTblPtr->fParam; + */ +} + +int32 AppDataProcess::AcquireConfigPointers() +{ + int32 iStatus = CFE_SUCCESS; + + /* + ** Release the table + */ + /* TODO: This return value can indicate success, error, or that the info has been + * updated. We ignore this return value in favor of checking CFE_TBL_Manage(), but + * be sure this is the behavior you want. */ + CFE_TBL_ReleaseAddress(FAC_AppData.ConfigTblHdl); + + /* + ** Manage the table + */ + iStatus = CFE_TBL_Manage(FAC_AppData.ConfigTblHdl); + if ((iStatus != CFE_SUCCESS) && (iStatus != CFE_TBL_INFO_UPDATED)) + { + CFE_EVS_SendEvent(FAC_CONFIG_TABLE_ERR_EID, CFE_EVS_ERROR, + "Failed to manage Config table (0x%08X)", + (unsigned int)iStatus); + goto AcquireConfigPointers_Exit_Tag; + } + else + { +#if 0 + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to manage Config Table (0x%08X)", + (unsigned int)iStatus); +#endif + } + + /* + ** Get a pointer to the table + */ + iStatus = CFE_TBL_GetAddress((void**)&FAC_AppData.ConfigTblPtr, FAC_AppData.ConfigTblHdl); + if (iStatus == CFE_SUCCESS) + { +#if 0 + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to get table address @@@@@@@@@ (0x%08X)", + (unsigned int)iStatus); +#endif + } + else if (iStatus == CFE_TBL_INFO_UPDATED) + { +#if 0 + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to get updated table address !!!!!!!!!!!! (0x%08X)", + (unsigned int)iStatus); +#endif + ProcessNewConfigTbl(); + iStatus = CFE_SUCCESS; + } + else + { + FAC_AppData.ConfigTblPtr = NULL; + CFE_EVS_SendEvent(FAC_CONFIG_TABLE_ERR_EID, CFE_EVS_ERROR, + "Failed to get Config table address (0x%08X)", + (unsigned int)iStatus); + FAC_AppData.uiAppRunStatus = CFE_ES_APP_ERROR; + goto AcquireConfigPointers_Exit_Tag; + } + +AcquireConfigPointers_Exit_Tag: + return (iStatus); +} + +int32 AppDataProcess::ValidateConfigTbl(void* ConfigTblPtr) +{ + int32 iStatus = CFE_SUCCESS; + FAC_ConfigTbl_t* CfgTblPtr = (FAC_ConfigTbl_t*)(ConfigTblPtr); + + if (ConfigTblPtr == NULL) + { + iStatus = FAC_ERR_INVALID_POINTER; + goto ValidateConfigTbl_Exit_Tag; + } + + /* TODO: Add code to validate new data values here. + ** + ** Examples: + ** if (CfgTblPtr->iParam <= 16) { + ** (void) CFE_EVS_SendEvent(FAC_CONFIG_TABLE_INF_EID, CFE_EVS_ERROR, + * "Invalid value for Config parameter sParam (%d)", + ** CfgTblPtr->iParam); + ** } + **/ + +ValidateConfigTbl_Exit_Tag: + return (iStatus); +} + +int32 AppDataProcess::VerifyDataMsgLength(CFE_SB_Msg_t *MsgPtr, uint16 usExpectedLen) +{ + uint16 usMsgLen = 0; + int32 iStatus = CFE_SUCCESS; + + if (MsgPtr != NULL) + { + usMsgLen = CFE_SB_GetTotalMsgLength(MsgPtr); + + if (usExpectedLen != usMsgLen) + { + iStatus = FAC_ERR_MSG_LENGTH; + CFE_SB_MsgId_t MsgId = CFE_SB_GetMsgId(MsgPtr); + uint16 usCmdCode = CFE_SB_GetCmdCode(MsgPtr); + + CFE_EVS_SendEvent(FAC_MSGLEN_ERR_EID, CFE_EVS_ERROR, + "Rcvd invalid msgLen: msgId=0x%08X, cmdCode=%d, " + "msgLen=%d, expectedLen=%d", MsgId, usCmdCode, + usMsgLen, usExpectedLen); + } + // Add more to check + } + else + { + iStatus = FAC_ERR_INVALID_POINTER; + + } + + return (iStatus); +} + +int32 AppDataProcess::RcvDataMsg(int32 iBlocking) +{ + int32 iStatus = CFE_SUCCESS; + CFE_SB_Msg_t *DataMsgPtr = NULL; + CFE_SB_MsgId_t DataMsgId; + + iStatus = CFE_SB_RcvMsg(&DataMsgPtr, DataPipeId, iBlocking); + if (iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Receivd message (0x%08X)", + (unsigned int)iStatus); + if (FAC_AppData.bAppAwaken == TRUE) + { + DataMsgId = CFE_SB_GetMsgId(DataMsgPtr); + switch (DataMsgId) + { + case PX4_AIRSPEED_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_AIRSPEED_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.Airspeed, DataMsgPtr, + sizeof(CVT.Airspeed)); // check vector + break; + + case PX4_BATTERY_STATUS_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_BATTERY_STATUS_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.BatteryStatus, DataMsgPtr, + sizeof(CVT.BatteryStatus)); // check vector + break; + + case PX4_MANUAL_CONTROL_SETPOINT_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_MANUAL_CONTROL_SETPOINT_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.ManualControlSetpoint, DataMsgPtr, + sizeof(CVT.ManualControlSetpoint)); + break; + +#if 0 // check + case PX4_PARAMETER_UPDATE_MID: + HandleParameterUpdate(); + break; +#endif + + case PX4_VEHICLE_ATTITUDE_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_VEHICLE_ATTITUDE_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.VehicleAttitude, DataMsgPtr, + sizeof(CVT.VehicleAttitude)); + break; + + case PX4_VEHICLE_ATTITUDE_SETPOINT_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_VEHICLE_ATTITUDE_SETPOINT_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.VehicleAttitudeSetpoint, DataMsgPtr, + sizeof(CVT.VehicleAttitudeSetpoint)); + break; + + case PX4_VEHICLE_CONTROL_MODE_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_VEHICLE_CONTROL_MODE_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.VehicleControlMode, DataMsgPtr, + sizeof(CVT.VehicleControlMode)); + break; + + + case PX4_VEHICLE_GLOBAL_POSITION_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_VEHICLE_GLOBAL_POSITION_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.VehicleGlobalPosition, DataMsgPtr, + sizeof(CVT.VehicleGlobalPosition)); + break; + + case PX4_VEHICLE_LAND_DETECTED_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_VEHICLE_LAND_DETECTED_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.VehicleLandDetected, DataMsgPtr, + sizeof(CVT.VehicleLandDetected)); + break; + + case PX4_VEHICLE_STATUS_MID: + CFE_EVS_SendEvent(FAC_INF_EID, CFE_EVS_INFORMATION, + "RcvDataMsg:Rcvd PX4_VEHICLE_STATUS_MID 0x%04X (0x%08X)", + (unsigned short)DataMsgId, (unsigned int)iStatus); + CFE_PSP_MemCpy(&CVT.VehicleStatus, DataMsgPtr, + sizeof(CVT.VehicleStatus)); + break; + + default: + CFE_EVS_SendEvent(FAC_MSGID_ERR_EID, CFE_EVS_ERROR, + "Recvd invalid Data msgId (0x%04X)", + (unsigned short)DataMsgId); + goto RcvDataMsg_Exit_Tag; + } + } + } + else if (iStatus == CFE_SB_NO_MESSAGE) + { + iStatus = CFE_SUCCESS; + } + else + { + CFE_EVS_SendEvent(FAC_PIPE_ERR_EID, CFE_EVS_ERROR, + "Data pipe read error (0x%08X)", (unsigned int)iStatus); + goto RcvDataMsg_Exit_Tag; + } + + iStatus = AcquireConfigPointers(); // Decide where to execute this + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_CONFIG_TABLE_ERR_EID, CFE_EVS_ERROR, + "AcquireConfigPointers error (0x%08X)", + (unsigned int)iStatus); + goto RcvDataMsg_Exit_Tag; + } + else + { +#if 0 + CFE_EVS_SendEvent(FAC_CONFIG_TABLE_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to AcquireConfigPointers ********** (0x%08X)", + (unsigned int)iStatus); +#endif + } + +RcvDataMsg_Exit_Tag: + return iStatus; +} + +int32 AppDataProcess::Subscribe(CFE_SB_MsgId_t MsgId) +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = CFE_SB_SubscribeEx(MsgId, DataPipeId, CFE_SB_Default_Qos, FAC_DATA_PIPE_RESERVED); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to subscribe to MID:0x%04X (0x%08X)", + (unsigned short)MsgId, (unsigned int)iStatus); + } + + return (iStatus); +} + +int32 AppDataProcess::InitConfigTbl() +{ + int32 iStatus = CFE_SUCCESS; + + /* Register Config table */ + iStatus = CFE_TBL_Register(&FAC_AppData.ConfigTblHdl, FAC_CONFIG_TABLENAME, + sizeof(FAC_ConfigTbl_t), CFE_TBL_OPT_DEFAULT, + ValidateConfigTbl); + if (iStatus == CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to register Config table (0x%08X)", + (unsigned int)iStatus); + } + else if (iStatus == CFE_TBL_INFO_RECOVERED_TBL) + { + CFE_EVS_SendEvent(FAC_INIT_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to recover Config table (0x%08X)", + (unsigned int)iStatus); + } + else if (iStatus == CFE_TBL_WARN_NOT_CRITICAL) + { + CFE_EVS_SendEvent(FAC_INIT_INF_EID, CFE_EVS_INFORMATION, + "Not Critical Initialization Error of Config table (0x%08X)", + (unsigned int)iStatus); + } + else + { + /* Note, a critical table could return another nominal code. If this table is + * made critical this logic would have to change. */ + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to register Config table (0x%08X)", + (unsigned int)iStatus); + goto InitConfigTbl_Exit_Tag; + } + + /* Load Config table file */ + iStatus = CFE_TBL_Load(FAC_AppData.ConfigTblHdl, CFE_TBL_SRC_FILE, FAC_CONFIG_TABLE_FILENAME); + if (iStatus != CFE_SUCCESS) + { + /* Note, CFE_SUCCESS is for a successful full table load. If a partial table + load is desired then this logic would have to change. */ + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to load Config Table (0x%08X)", + (unsigned int)iStatus); + goto InitConfigTbl_Exit_Tag; + } + else + { + CFE_EVS_SendEvent(FAC_INIT_INF_EID, CFE_EVS_INFORMATION, + "Succeeded to load Config Table (0x%08X)", + (unsigned int)iStatus); + } + +InitConfigTbl_Exit_Tag: + return (iStatus); +} + +int32 AppDataProcess::InitTables() +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = InitData(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to initialize Data (0x%08X)", + (unsigned int)iStatus); + goto InitTables_Exit_Tag; + } + + iStatus = InitConfigTbl(); + if (iStatus != CFE_SUCCESS) + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to init config tables (0x%08X)", + (unsigned int)iStatus); + goto InitTables_Exit_Tag; + } + +InitTables_Exit_Tag: + return iStatus; +} + +int32 AppDataProcess::InitData() +{ + int32 iStatus = CFE_SUCCESS; + + /* Init input data */ + memset((void*)&InData, 0x00, sizeof(InData)); + + /* Init output data */ +// memset((void*)&OutData, 0x00, sizeof(OutData)); // Check for memset + /* memset entire OutData length and set the stream ID and length and + * restore sequence count if not TRUE + */ +// check cfe function for length + CFE_SB_InitMsg(&OutData, FAC_OUT_DATA_MID, sizeof(OutData), TRUE); // check length + + CFE_SB_InitMsg(&CVT.Airspeed, PX4_AIRSPEED_MID, sizeof(CVT.Airspeed), TRUE); + CFE_SB_InitMsg(&CVT.BatteryStatus, PX4_BATTERY_STATUS_MID, + sizeof(CVT.BatteryStatus), TRUE); + CFE_SB_InitMsg(&CVT.ManualControlSetpoint, PX4_MANUAL_CONTROL_SETPOINT_MID, + sizeof(CVT.ManualControlSetpoint), TRUE); + CFE_SB_InitMsg(&CVT.VehicleAttitude, PX4_VEHICLE_ATTITUDE_MID, + sizeof(CVT.VehicleAttitude), TRUE); + CFE_SB_InitMsg(&CVT.VehicleAttitudeSetpoint, PX4_VEHICLE_ATTITUDE_SETPOINT_MID, + sizeof(CVT.VehicleAttitudeSetpoint), TRUE); + CFE_SB_InitMsg(&CVT.VehicleControlMode, PX4_VEHICLE_CONTROL_MODE_MID, + sizeof(CVT.VehicleControlMode), TRUE); + CFE_SB_InitMsg(&CVT.VehicleGlobalPosition, PX4_VEHICLE_GLOBAL_POSITION_MID, + sizeof(CVT.VehicleGlobalPosition), TRUE); + CFE_SB_InitMsg(&CVT.VehicleLandDetected, PX4_VEHICLE_LAND_DETECTED_MID, + sizeof(CVT.VehicleLandDetected), TRUE); + CFE_SB_InitMsg(&CVT.VehicleStatus, PX4_VEHICLE_STATUS_MID, + sizeof(CVT.VehicleStatus), TRUE); + + return (iStatus); +} + +int32 AppDataProcess::InitDataPipe() +{ + int32 iStatus = CFE_SUCCESS; + + iStatus = CFE_SB_CreatePipe(&DataPipeId, FAC_DATA_PIPE_DEPTH, FAC_DATA_PIPE_NAME); // check depth + if (iStatus == CFE_SUCCESS) + { + iStatus = Subscribe(PX4_AIRSPEED_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_VEHICLE_ATTITUDE_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_VEHICLE_ATTITUDE_SETPOINT_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_VEHICLE_CONTROL_MODE_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } +#if 0 + iStatus = Subscribe(PX4_PARAMETER_UPDATE_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } +#endif + + iStatus = Subscribe(PX4_MANUAL_CONTROL_SETPOINT_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_VEHICLE_GLOBAL_POSITION_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_VEHICLE_STATUS_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_VEHICLE_LAND_DETECTED_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + + iStatus = Subscribe(PX4_BATTERY_STATUS_MID); + if (iStatus != CFE_SUCCESS) + { + goto InitDataPipe_Exit_Tag; + } + } + else + { + CFE_EVS_SendEvent(FAC_INIT_ERR_EID, CFE_EVS_ERROR, + "Failed to create Data pipe (0x%08X)", + (unsigned int)iStatus); + goto InitDataPipe_Exit_Tag; + } + +InitDataPipe_Exit_Tag: + return iStatus; +} diff --git a/apps/fac/fsw/src/fac_data_utils.hpp b/apps/fac/fsw/src/fac_data_utils.hpp new file mode 100644 index 000000000..4e2791640 --- /dev/null +++ b/apps/fac/fsw/src/fac_data_utils.hpp @@ -0,0 +1,79 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_DATA_UTILS_HPP +#define FAC_DATA_UTILS_HPP + + +#if 0 +typedef enum +{ + FAC_PX4_INC_ERR_CTR = -1, /* Error detected, increment counter */ + FAC_PX4_DONT_INC_CTR = 0, /* No errors detected but don't increment counter */ + FAC_PX4_INC_TLM_CTR = 1 /* No errors detected and increment counter */ +} FAC_PX4MsgFuncRet_t; +#endif + + +class AppDataProcess +{ +public: + AppDataProcess(); + ~AppDataProcess(); + + int32 InitDataPipe(); + int32 InitTables(); + int32 RcvDataMsg(int32 iBlocking); + void SendOutData(); + + static int32 ValidateConfigTbl(void* ConfigTblPtr); + +private: + CFE_SB_PipeId_t DataPipeId; + + FAC_InData_t InData; + FAC_OutData_t OutData; + + int32 InitData(); + int32 InitConfigTbl(); + + int32 Subscribe(CFE_SB_MsgId_t MsgId); + int32 VerifyDataMsgLength(CFE_SB_Msg_t *MsgPtr, uint16 usExpectedLen); + + int32 AcquireConfigPointers(); + void ProcessNewConfigTbl(); + +}; + + +#endif diff --git a/apps/fac/fsw/src/fac_events.h b/apps/fac/fsw/src/fac_events.h new file mode 100644 index 000000000..cf6e4214a --- /dev/null +++ b/apps/fac/fsw/src/fac_events.h @@ -0,0 +1,215 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_EVENTS_H +#define FAC_EVENTS_H + + +/************************************************************************ +** Local Defines +*************************************************************************/ + + +/* Event IDs + * Conventions: _EID is the event identifier. _EVT_CNT is the total number of + * events and should always be last. Events can be added before _EVT_CNT. + * For long-term maintenance, consider not removing an event but replacing it + * with an unused, reserved, enum to preserve the IDs later in the list. */ +typedef enum { + +/** \brief Value of zero is reserved, and should not be used. */ + FAC_RESERVED_EID = 0, /* Do not use this event ID */ + +/** \brief 'FAC - ' +** \event 'FAC - ' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** TODO fill this in +** +*/ + FAC_INF_EID, + +/** \brief 'FAC Initialized. Version \%d.\%d.\%d' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** completed initialization. +** +** The first \c %d field contains the Application's Major Version Number +** The second \c %d field contains the Application's Minor Version Number +** The third \c %d field contains the Application's Revision Number +*/ + FAC_INIT_INF_EID, + +/** \brief 'FAC - ' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This message is generated when a table is initialized. +** +*/ + FAC_CONFIG_TABLE_INF_EID, + +/** \brief 'FAC - ' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is issued when TBD +** +*/ + FAC_CDS_INF_EID, + +/** \brief 'FAC - Recvd $x cmd (%us)' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** received and processed a command. +** +*/ + FAC_CMD_INF_EID, + +/** \brief 'FAC - ' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when TBD +** +*/ + FAC_ERR_EID, + +/** \brief 'FAC - ' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** had an error in initialization. +** +*/ + FAC_INIT_ERR_EID, + +/** \brief 'FAC - ' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** had an error with the configuration table. +** +*/ + FAC_CONFIG_TABLE_ERR_EID, + +/** \brief 'FAC - ' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** had an error in CDS. +** +*/ + FAC_CDS_ERR_EID, + +/** \brief 'FAC - $commandError' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** had an error processing a command. +** +*/ + FAC_CMD_ERR_EID, + +/** \brief 'FAC: SB pipe read error (0x%08X), app will exit' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** had an error reading from a pipe. +** +*/ + FAC_PIPE_ERR_EID, + +/** \brief 'FAC - Recvd invalid $type msgId (0x%04x)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** received an invalid message ID. +** +*/ + FAC_MSGID_ERR_EID, + +/** \brief 'FAC - Rcvd invalid msgLen: msgId=0x%08X, cmdCode=%d, msgLen=%d, expectedLen=%d" +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when the CFS FAC Task has +** received a message with a bad length. +** +*/ + FAC_MSGLEN_ERR_EID, + + +/** \brief This is a count of all the app events and should not be used. */ + FAC_EVT_CNT +} FAC_EventIds_t; + + +#endif /* FAC_EVENTS_H */ diff --git a/apps/fac/fsw/src/fac_fac.hpp b/apps/fac/fsw/src/fac_fac.hpp new file mode 100644 index 000000000..bb328247f --- /dev/null +++ b/apps/fac/fsw/src/fac_fac.hpp @@ -0,0 +1,65 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_FPC_HPP +#define FAC_FPC_HPP + + +class FixedwingAttitudeControl +{ +public: + FixedwingAttitudeControl(); + ~FixedwingAttitudeControl(); + + int32 InitEvent(); + int32 InitSchPipe(); + int32 InitHk(); + int32 RcvSchMsg(int32 iBlocking); + +private: + CFE_SB_PipeId_t SchPipeId; + + CFE_EVS_BinFilter_t EventTbl[FAC_EVT_CNT]; + + int32 Execute(); + int32 WakeupValidate(CFE_SB_Msg_t *MsgPtr, CFE_SB_MsgId_t MsgId); + int32 SendHkMsg(CFE_SB_Msg_t *MsgPtr, CFE_SB_MsgId_t MsgId); + int32 VerifySchCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 usExpectedLen); +// void IncrementCmdCount(); +// void IncrementCmdErr(); + void ReportHousekeeping(); + void SendOutData(); +}; + + +#endif /* FAC_FPC_HPP */ diff --git a/apps/fac/fsw/src/fac_msg.h b/apps/fac/fsw/src/fac_msg.h new file mode 100644 index 000000000..3b8b888cf --- /dev/null +++ b/apps/fac/fsw/src/fac_msg.h @@ -0,0 +1,163 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_MSG_H +#define FAC_MSG_H + +#include "cfe.h" + +/************************************************************************ +** FAC Command Codes +*************************************************************************/ +/** \faccmd Noop +** +** \par Description +** Implements the Noop command that demonstrates the FAC task is alive +** +** \faccmdmnemonic \FAC_NOOP +** +** \par Command Structure +** #FAC_NoArgCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with +** the following telemetry: +** - \b \c \FAC_CMDACPTCNT - command counter will increment +** - The #FAC_CMD_INF_EID informational event message will be +** generated when the command is received +** +** \par Error Conditions +** This command may fail for the following reason(s): +** - Command packet length not as expected +** +** \par Evidence of failure may be found in the following telemetry: +** - \b \c \FAC_CMDRJCTCNT - command error counter will increment +** - Error specific event message #FAC_MSGID_ERR_EID +** +** \par Criticality +** None +** +** \sa #FAC_RESET_CC +*/ +#define FAC_NOOP_CC (0) + +/** \faccmd Reset Counters +** +** \par Description +** Resets the fac housekeeping counters +** +** \faccmdmnemonic \FAC_TLMRST +** +** \par Command Structure +** #FAC_NoArgCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with +** the following telemetry: +** - \b \c \FAC_CMDACTPCNT - command counter will be cleared +** - \b \c \FAC_CMDRJCTCNT - command error counter will be cleared +** - The #FAC_CMD_INF_EID debug event message will be +** generated when the command is executed +** +** \par Error Conditions +** This command may fail for the following reason(s): +** - Command packet length not as expected +** +** \par Evidence of failure may be found in the following telemetry: +** - \b \c \FAC_CMDRJCTCNT - command error counter will increment +** - Error specific event message #FAC_MSGID_ERR_EID +** +** \par Criticality +** None +** +** \sa #FAC_NOOP_CC +*/ +#define FAC_RESET_CC (1) + +/** +** \brief No Arguments Command +** For command details see #FAC_NOOP_CC, #FAC_RESET_CC +** Also see #FAC_SEND_HK_MID +*/ +typedef struct +{ + uint8 ucCmdHeader[CFE_SB_CMD_HDR_SIZE]; +} FAC_NoArgCmd_t; + +/** +** \brief TODO Elaborate this struct +** Boilerplate example of application-specific incoming data +*/ +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint32 counter; + + /* TODO: Add input data to this application here, such as raw data read from I/O + ** devices. + ** Option: for data that is already defined by another app, include + ** that app's message header above. + */ + +} FAC_InData_t; + +/** +** \brief TODO Elaborate this struct +** Boilerplate example of application-specific outgoing data +*/ +typedef struct +{ + uint8 ucTlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint32 uiCounter; +} FAC_OutData_t; + +/** +** \brief FAC application housekeeping data +*/ +typedef struct +{ + /** \brief cFE SB Tlm Msg Hdr */ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + + /** \factlmmnemonic \FAC_CMDACPTCNT + \brief Count of accepted commands */ + uint8 usCmdCnt; + + /** \factlmmnemonic \FAC_CMDRJCTCNT + \brief Count of failed commands */ + uint8 usCmdErrCnt; + +} FAC_HkTlm_t; + + +#endif /* FAC_MSG_H */ diff --git a/apps/fac/fsw/src/fac_private_ids.h b/apps/fac/fsw/src/fac_private_ids.h new file mode 100644 index 000000000..97a6fd7f4 --- /dev/null +++ b/apps/fac/fsw/src/fac_private_ids.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_PRIVATE_IDS_H +#define FAC_PRIVATE_IDS_H + +#include "cfe.h" + + + + +#endif /* FAC_PRIVATE_IDS_H */ diff --git a/apps/fac/fsw/src/fac_private_types.h b/apps/fac/fsw/src/fac_private_types.h new file mode 100644 index 000000000..702ad6191 --- /dev/null +++ b/apps/fac/fsw/src/fac_private_types.h @@ -0,0 +1,45 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_PRIVATE_TYPES_H +#define FAC_PRIVATE_TYPES_H + +#include "cfe.h" + + +#define FAC_SUCCESS (CFE_SUCCESS) +#define FAC_ERR_MSG_LENGTH (-1) +#define FAC_ERR_INVALID_POINTER (-2) + + +#endif /* FAC_PRIVATE_TYPES_H */ diff --git a/apps/fac/fsw/src/fac_symbols.cpp b/apps/fac/fsw/src/fac_symbols.cpp new file mode 100644 index 000000000..1ad18c0b1 --- /dev/null +++ b/apps/fac/fsw/src/fac_symbols.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "fac_msg.h" + +FAC_NoArgCmd_t FAC_Noop; +FAC_HkTlm_t FAC_HkTlm; diff --git a/apps/fac/fsw/src/fac_tbldefs.h b/apps/fac/fsw/src/fac_tbldefs.h new file mode 100644 index 000000000..e5929456a --- /dev/null +++ b/apps/fac/fsw/src/fac_tbldefs.h @@ -0,0 +1,650 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_TBLDEFS_H +#define FAC_TBLDEFS_H + +#include "cfe.h" + + +#define FAC_CONFIG_TABLENAME ("CONFIG_TBL") + + +typedef struct +{ + /** + * Attitude Roll Time Constant + * + * This defines the latency between a roll step input and the achieved setpoint + * (inverse to a P gain). Half a second is a good start value and fits for + * most average systems. Smaller systems may require smaller values, but as + * this will wear out servos faster, the value should only be decreased as + * needed. + * + * @unit s + * @min 0.4 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_R_TC; + + /** + * Attitude pitch time constant + * + * This defines the latency between a pitch step input and the achieved setpoint + * (inverse to a P gain). Half a second is a good start value and fits for + * most average systems. Smaller systems may require smaller values, but as + * this will wear out servos faster, the value should only be decreased as + * needed. + * + * @unit s + * @min 0.2 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_P_TC; + + /** + * Pitch rate proportional gain. + * + * This defines how much the elevator input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_PR_P; + + /** + * Pitch rate integrator gain. + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.5 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_PR_I; + + /** + * Maximum positive / up pitch rate. + * + * This limits the maximum pitch up angular rate the controller will output (in + * degrees per second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_P_RMAX_POS; + + /** + * Maximum negative / down pitch rate. + * + * This limits the maximum pitch down up angular rate the controller will + * output (in degrees per second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_P_RMAX_NEG; + + /** + * Pitch rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_PR_IMAX; + + /** + * Roll rate proportional Gain + * + * This defines how much the aileron input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_RR_P; + + /** + * Roll rate integrator Gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.2 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_RR_I; + + /** + * Roll integrator anti-windup + * + * The portion of the integrator part in the control surface deflection is limited to this value. + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_RR_IMAX; + + /** + * Maximum roll rate + * + * This limits the maximum roll rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_R_RMAX; + + /** + * Yaw rate proportional gain + * + * This defines how much the rudder input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_YR_P; + + /** + * Yaw rate integrator gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.0 + * @max 50.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_YR_I; + + /** + * Yaw rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_YR_IMAX; + + /** + * Maximum yaw rate + * + * This limits the maximum yaw rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_Y_RMAX; + + /** + * Roll control to yaw control feedforward gain. + * + * This gain can be used to counteract the "adverse yaw" effect for fixed wings. + * When the plane enters a roll it will tend to yaw the nose out of the turn. + * This gain enables the use of a yaw actuator (rudder, airbrakes, ...) to counteract + * this effect. + * + * @min 0.0 + * @decimal 1 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_RLL_TO_YAW_FF; + + /** + * Enable wheel steering controller + * + * @boolean + * @group FW Attitude Control + */ + float FW_W_EN; + + /** + * Wheel steering rate proportional gain + * + * This defines how much the wheel steering input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_WR_P; + + /** + * Wheel steering rate integrator gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.5 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + float FW_WR_I; + + /** + * Wheel steering rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_WR_IMAX; + + /** + * Maximum wheel steering rate + * + * This limits the maximum wheel steering rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_W_RMAX; + + /** + * Roll rate feed forward + * + * Direct feed forward from rate setpoint to control surface output. Use this + * to obtain a tigher response of the controller without introducing + * noise amplification. + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_RR_FF; + + /** + * Pitch rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_PR_FF; + + /** + * Yaw rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_YR_FF; + + /** + * Wheel steering rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + float FW_WR_FF; + + /** + * Minimal speed for yaw coordination + * + * For airspeeds above this value, the yaw rate is calculated for a coordinated + * turn. Set to a very high value to disable. + * + * @unit m/s + * @min 0.0 + * @max 1000.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_YCO_VMIN; + + /** + * Method used for yaw coordination + * + * The param value sets the method used to calculate the yaw rate + * 0: open-loop zero lateral acceleration based on kinematic constraints + * 1: closed-loop: try to reduce lateral acceleration to 0 by measuring the acceleration + * + * @min 0 + * @max 1 + * @value 0 open-loop + * @value 1 closed-loop + * @group FW Attitude Control + */ + int32 FW_YCO_METHOD; + + /** + * Roll setpoint offset + * + * An airframe specific offset of the roll setpoint in degrees, the value is + * added to the roll setpoint and should correspond to the typical cruise speed + * of the airframe. + * + * @unit deg + * @min -90.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_RSP_OFF; + + /** + * Pitch setpoint offset + * + * An airframe specific offset of the pitch setpoint in degrees, the value is + * added to the pitch setpoint and should correspond to the typical cruise + * speed of the airframe. + * + * @unit deg + * @min -90.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_PSP_OFF; + + /** + * Max manual roll + * + * Max roll for manual control in attitude stabilized mode + * + * @unit deg + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_MAN_R_MAX; + + /** + * Max manual pitch + * + * Max pitch for manual control in attitude stabilized mode + * + * @unit deg + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + float FW_MAN_P_MAX; + + /** + * Scale factor for flaps + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_FLAPS_SCL; + + /** + * Scale factor for flaperons + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_FLAPERON_SCL; + + /** + * Disable airspeed sensor + * + * For small wings or VTOL without airspeed sensor this parameter can be used to + * enable flying without an airspeed reading + * + * @boolean + * @group FW Attitude Control + */ + int32 FW_ARSP_MODE; + + /** + * Manual roll scale + * + * Scale factor applied to the desired roll actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_MAN_R_SC; + + /** + * Manual pitch scale + * + * Scale factor applied to the desired pitch actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_MAN_P_SC; + + /** + * Manual yaw scale + * + * Scale factor applied to the desired yaw actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_MAN_Y_SC; + + /** + * Whether to scale throttle by battery power level + * + * This compensates for voltage drop of the battery over time by attempting to + * normalize performance across the operating range of the battery. The fixed wing + * should constantly behave as if it was fully charged with reduced max thrust + * at lower battery percentages. i.e. if cruise speed is at 0.5 throttle at 100% battery, + * it will still be 0.5 at 60% battery. + * + * @boolean + * @group FW Attitude Control + */ + int32 FW_BAT_SCALE_EN; + + /** + * Acro body x max rate. + * + * This is the rate the controller is trying to achieve if the user applies full roll + * stick input in acro mode. + * + * @min 45 + * @max 720 + * @unit degrees + * @group FW Attitude Control + */ + float FW_ACRO_X_MAX; + + /** + * Acro body y max rate. + * + * This is the body y rate the controller is trying to achieve if the user applies full pitch + * stick input in acro mode. + * + * @min 45 + * @max 720 + * @unit degrees + * @group FW Attitude Control + */ + float FW_ACRO_Y_MAX; + + /** + * Acro body z max rate. + * + * This is the body z rate the controller is trying to achieve if the user applies full yaw + * stick input in acro mode. + * + * @min 10 + * @max 180 + * @unit degrees + * @group FW Attitude Control + */ + float FW_ACRO_Z_MAX; + + /** + * Threshold for Rattitude mode + * + * Manual input needed in order to override attitude control rate setpoints + * and instead pass manual stick inputs as rate setpoints + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + float FW_RATT_TH; + +} FAC_ConfigTbl_t; + + +#endif /* FAC_TBLDEFS_H */ diff --git a/apps/fac/fsw/src/fac_version.h b/apps/fac/fsw/src/fac_version.h new file mode 100644 index 000000000..a27b812f0 --- /dev/null +++ b/apps/fac/fsw/src/fac_version.h @@ -0,0 +1,81 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_VERSION_H +#define FAC_VERSION_H + + +/** \brief Major version number for FAC application +** +** \par Description: +** An application version number consists of four parts: +** major version number, minor version number, revision +** number and mission specific revision number. The mission +** specific revision number is defined in "ci_platform_cfg.h". +** +** \par Limits: +** Must be defined as a numeric value that is greater than +** or equal to zero. +*/ +#define FAC_MAJOR_VERSION (0) + +/** \brief Minor version number for FAC application +** +** \par Description: +** An application version number consists of four parts: +** major version number, minor version number, revision +** number and mission specific revision number. The mission +** specific revision number is defined in "fac_platform_cfg.h". +** +** \par Limits: +** Must be defined as a numeric value that is greater than +** or equal to zero. +*/ +#define FAC_MINOR_VERSION (0) + +/** \brief Revision version number for FAC application +** +** \par Description: +** An application version number consists of four parts: +** major version number, minor version number, revision +** number and mission specific revision number. The mission +** specific revision number is defined in "fac_platform_cfg.h". +** +** \par Limits: +** Must be defined as a numeric value that is greater than +** or equal to zero. +*/ +#define FAC_REVISION (0) + + +#endif /* FAC_VERSION_H */ diff --git a/apps/fac/fsw/tables/fac_config.c b/apps/fac/fsw/tables/fac_config.c new file mode 100644 index 000000000..dd1bbc1b0 --- /dev/null +++ b/apps/fac/fsw/tables/fac_config.c @@ -0,0 +1,627 @@ +#include "cfe_tbl_filedef.h" +#include "fac_tbldefs.h" + +/** +** \brief The cFE FAC config table definition. +** +** Content format: ObjName[64], TblName[38], Desc[32], TgtFileName[20], ObjSize +** ObjName - variable name of config table, e.g., FAC_ConfigDefTbl[] +** TblName - app's table name, e.g., FAC.CONFIG_TBL, where FAC is the same app name +** used in cfe_es_startup.scr, and FAC_defConfigTbl is the same table +** name passed in to CFE_TBL_Register() +** Desc - description of table in string format +** TgtFileName[20] - table file name, compiled as .tbl file extension +** ObjSize - size of the entire table +** +*/ +static CFE_TBL_FileDef_t CFE_TBL_FileDef = +{ + "FAC_ConfigTbl", "FAC.CONFIG_TBL", "FAC default config table", + "fac_config.tbl", sizeof(FAC_ConfigTbl_t) +}; + +FAC_ConfigTbl_t FAC_ConfigTbl = +{ + /** + * Attitude Roll Time Constant + * + * This defines the latency between a roll step input and the achieved setpoint + * (inverse to a P gain). Half a second is a good start value and fits for + * most average systems. Smaller systems may require smaller values, but as + * this will wear out servos faster, the value should only be decreased as + * needed. + * + * @unit s + * @min 0.4 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.4f, + + /** + * Attitude pitch time constant + * + * This defines the latency between a pitch step input and the achieved setpoint + * (inverse to a P gain). Half a second is a good start value and fits for + * most average systems. Smaller systems may require smaller values, but as + * this will wear out servos faster, the value should only be decreased as + * needed. + * + * @unit s + * @min 0.2 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.4f, + + /** + * Pitch rate proportional gain. + * + * This defines how much the elevator input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.08f, + + /** + * Pitch rate integrator gain. + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.5 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.02f, + + /** + * Maximum positive / up pitch rate. + * + * This limits the maximum pitch up angular rate the controller will output (in + * degrees per second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 60.0f, + + /** + * Maximum negative / down pitch rate. + * + * This limits the maximum pitch down up angular rate the controller will + * output (in degrees per second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 60.0f, + + /** + * Pitch rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.4f, + + /** + * Roll rate proportional Gain + * + * This defines how much the aileron input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.05f, + + /** + * Roll rate integrator Gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.2 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.01f, + + /** + * Roll integrator anti-windup + * + * The portion of the integrator part in the control surface deflection is limited to this value. + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.2f, + + /** + * Maximum roll rate + * + * This limits the maximum roll rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 70.0f, + + /** + * Yaw rate proportional gain + * + * This defines how much the rudder input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.05f, + + /** + * Yaw rate integrator gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.0 + * @max 50.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Yaw rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.2f, + + /** + * Maximum yaw rate + * + * This limits the maximum yaw rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Roll control to yaw control feedforward gain. + * + * This gain can be used to counteract the "adverse yaw" effect for fixed wings. + * When the plane enters a roll it will tend to yaw the nose out of the turn. + * This gain enables the use of a yaw actuator (rudder, airbrakes, ...) to counteract + * this effect. + * + * @min 0.0 + * @decimal 1 + * @increment 0.01 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Enable wheel steering controller + * + * @boolean + * @group FW Attitude Control + */ + 0, + + /** + * Wheel steering rate proportional gain + * + * This defines how much the wheel steering input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.5f, + + /** + * Wheel steering rate integrator gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.5 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.1f, + + /** + * Wheel steering rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Maximum wheel steering rate + * + * This limits the maximum wheel steering rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Roll rate feed forward + * + * Direct feed forward from rate setpoint to control surface output. Use this + * to obtain a tigher response of the controller without introducing + * noise amplification. + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.5f, + + /** + * Pitch rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.5f, + + /** + * Yaw rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.3f, + + /** + * Wheel steering rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.2f, + + /** + * Minimal speed for yaw coordination + * + * For airspeeds above this value, the yaw rate is calculated for a coordinated + * turn. Set to a very high value to disable. + * + * @unit m/s + * @min 0.0 + * @max 1000.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 1000.0f, + + /** + * Method used for yaw coordination + * + * The param value sets the method used to calculate the yaw rate + * 0: open-loop zero lateral acceleration based on kinematic constraints + * 1: closed-loop: try to reduce lateral acceleration to 0 by measuring the acceleration + * + * @min 0 + * @max 1 + * @value 0 open-loop + * @value 1 closed-loop + * @group FW Attitude Control + */ + 0, + + /** + * Roll setpoint offset + * + * An airframe specific offset of the roll setpoint in degrees, the value is + * added to the roll setpoint and should correspond to the typical cruise speed + * of the airframe. + * + * @unit deg + * @min -90.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Pitch setpoint offset + * + * An airframe specific offset of the pitch setpoint in degrees, the value is + * added to the pitch setpoint and should correspond to the typical cruise + * speed of the airframe. + * + * @unit deg + * @min -90.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Max manual roll + * + * Max roll for manual control in attitude stabilized mode + * + * @unit deg + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 45.0f, + + /** + * Max manual pitch + * + * Max pitch for manual control in attitude stabilized mode + * + * @unit deg + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 45.0f, + + /** + * Scale factor for flaps + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Scale factor for flaperons + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Disable airspeed sensor + * + * For small wings or VTOL without airspeed sensor this parameter can be used to + * enable flying without an airspeed reading + * + * @boolean + * @group FW Attitude Control + */ + 0, + + /** + * Manual roll scale + * + * Scale factor applied to the desired roll actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Manual pitch scale + * + * Scale factor applied to the desired pitch actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Manual yaw scale + * + * Scale factor applied to the desired yaw actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Whether to scale throttle by battery power level + * + * This compensates for voltage drop of the battery over time by attempting to + * normalize performance across the operating range of the battery. The fixed wing + * should constantly behave as if it was fully charged with reduced max thrust + * at lower battery percentages. i.e. if cruise speed is at 0.5 throttle at 100% battery, + * it will still be 0.5 at 60% battery. + * + * @boolean + * @group FW Attitude Control + */ + 0, + + /** + * Acro body x max rate. + * + * This is the rate the controller is trying to achieve if the user applies full roll + * stick input in acro mode. + * + * @min 45 + * @max 720 + * @unit degrees + * @group FW Attitude Control + */ + 90, + + /** + * Acro body y max rate. + * + * This is the body y rate the controller is trying to achieve if the user applies full pitch + * stick input in acro mode. + * + * @min 45 + * @max 720 + * @unit degrees + * @group FW Attitude Control + */ + 90, + + /** + * Acro body z max rate. + * + * This is the body z rate the controller is trying to achieve if the user applies full yaw + * stick input in acro mode. + * + * @min 10 + * @max 180 + * @unit degrees + * @group FW Attitude Control + */ + 45, + + /** + * Threshold for Rattitude mode + * + * Manual input needed in order to override attitude control rate setpoints + * and instead pass manual stick inputs as rate setpoints + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 0.8f + +}; diff --git a/apps/fac/fsw/unit_test/fac_app_test.c b/apps/fac/fsw/unit_test/fac_app_test.c new file mode 100644 index 000000000..9f93fea46 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_app_test.c @@ -0,0 +1,524 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "fac_app_test.h" +#include "fac_app.h" +#include "fac_test_utils.h" + +#include "uttest.h" +#include "ut_osapi_stubs.h" +#include "ut_cfe_sb_stubs.h" +#include "ut_cfe_sb_hooks.h" +#include "ut_cfe_es_stubs.h" +#include "ut_cfe_es_hooks.h" +#include "ut_cfe_evs_stubs.h" +#include "ut_cfe_evs_hooks.h" +#include "ut_cfe_time_stubs.h" +#include "ut_cfe_psp_memutils_stubs.h" +#include "ut_cfe_tbl_stubs.h" +#include "ut_cfe_fs_stubs.h" +#include "ut_cfe_time_stubs.h" + + +int32 hookCalledCount = 0; + +/************************************************************************** + * Tests for FAC_InitEvent() + **************************************************************************/ + +/** + * Test FAC_InitEvent() with failed CFE_EVS_Register + */ +void Test_FAC_InitEvent_Fail_Register(void) +{ + /* Set a fail result for EVS */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_EVENTS_SERVICE | CFE_EVS_NOT_IMPLEMENTED; + int32 expected = CFE_EVS_APP_NOT_REGISTERED; + + Ut_CFE_EVS_SetReturnCode(UT_CFE_EVS_REGISTER_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitEvent(); + + /* Verify results */ + UtAssert_True (result == expected, "InitEvent, failed EVS Register"); +} + + +/************************************************************************** + * Tests for FAC_InitPipe() + **************************************************************************/ +/** + * Test FAC_InitPipe(), fail SCH CFE_SB_CreatePipe + */ +void Test_FAC_InitPipe_Fail_CreateSCHPipe(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_SOFTWARE_BUS_SERVICE | CFE_SB_NOT_IMPLEMENTED; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_CREATEPIPE_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitPipe(); + + /* Verify results */ + UtAssert_True (result == expected, "InitPipe, fail SB create SCH pipe"); +} + + +/** + * Test FAC_InitPipe(), fail CFE_SB_SubscribeEx for wakeup + */ +void Test_FAC_InitPipe_Fail_SubscribeWakeup(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_SOFTWARE_BUS_SERVICE | CFE_SB_NOT_IMPLEMENTED; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_SUBSCRIBEEX_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitPipe(); + + /* Verify results */ + UtAssert_True (result == expected, "InitPipe, fail CFE_SB_SubscribeEx for wakeup"); +} + + +/** + * Test FAC_InitPipe(), fail CFE_SB_SubscribeEx for sendhk + */ +void Test_FAC_InitPipe_Fail_SubscribeSendHK(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_SOFTWARE_BUS_SERVICE | CFE_SB_NOT_IMPLEMENTED; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_SUBSCRIBEEX_INDEX, expected, 2); + + /* Execute the function being tested */ + result = FAC_InitPipe(); + + /* Verify results */ + UtAssert_True (result == expected, "InitPipe, fail CFE_SB_SubscribeEx for sendhk"); +} + + +/** + * Test FAC_InitPipe(), fail CMD CFE_SB_CreatePipe + */ +void Test_FAC_InitPipe_Fail_CreateCMDPipe(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_SOFTWARE_BUS_SERVICE | CFE_SB_NOT_IMPLEMENTED; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_CREATEPIPE_INDEX, expected, 2); + + /* Execute the function being tested */ + result = FAC_InitPipe(); + + /* Verify results */ + UtAssert_True (result == expected, "InitPipe, fail SB create CMD pipe"); +} + + +/** + * Test FAC_InitPipe(), fail CFE_SB_Subscribe for CMD msg + */ +void Test_FAC_InitPipe_Fail_SubscribeCMD(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_SOFTWARE_BUS_SERVICE | CFE_SB_NOT_IMPLEMENTED; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_SUBSCRIBE_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitPipe(); + + /* Verify results */ + UtAssert_True (result == expected, "InitPipe, fail CFE_SB_Subscribe for CMD"); +} + + +/** + * Test FAC_InitPipe(), fail DATA CFE_SB_CreatePipe + */ +void Test_FAC_InitPipe_Fail_CreateDATAPipe(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_SOFTWARE_BUS_SERVICE | CFE_SB_NOT_IMPLEMENTED; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_CREATEPIPE_INDEX, expected, 3); + + /* Execute the function being tested */ + result = FAC_InitPipe(); + + /* Verify results */ + UtAssert_True (result == expected, "InitPipe, fail SB create DATA pipe"); +} + + +/************************************************************************** + * Tests for FAC_InitData() + **************************************************************************/ +/** + * Test FAC_InitData() + */ +void Test_FAC_InitData(void) +{ + /* Set a fail result */ + int32 result = -1; + int32 expected = CFE_SUCCESS; + + /* Execute the function being tested */ + result = FAC_InitData(); + + /* Verify results */ + UtAssert_True (result == expected, "InitData"); +} + + +/************************************************************************** + * Tests for FAC_InitApp() + **************************************************************************/ +/** + * Test FAC_InitApp(), fail init event + */ +void Test_FAC_InitApp_Fail_InitEvent(void) +{ + int32 result = CFE_SUCCESS; + int32 expected = CFE_EVS_APP_NOT_REGISTERED; + + Ut_CFE_EVS_SetReturnCode(UT_CFE_EVS_REGISTER_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitApp(); + + /* Verify results */ + UtAssert_True (result == expected, "InitApp, fail init event"); +} + + +/** + * Test FAC_InitApp(), fail init pipe + */ +void Test_FAC_InitApp_Fail_InitPipe(void) +{ + int32 result = CFE_SUCCESS; + int32 expected = CFE_SB_BAD_ARGUMENT; + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_CREATEPIPE_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitApp(); + + /* Verify results */ + UtAssert_True (result == expected, "InitApp, fail init pipe"); +} + + +/** + * Test FAC_InitApp(), fail init data. + * NOTE: no current way to fail FAC_InitData() in default + */ +void Test_FAC_InitApp_Fail_InitData(void) +{ + int32 result = CFE_SUCCESS; + int32 expected = CFE_SUCCESS; + + /* Execute the function being tested */ + result = FAC_InitApp(); + + /* Verify results */ + UtAssert_True (result == expected, "InitApp, fail init data"); +} + + +/** + * Test FAC_InitApp(), fail init config table + */ +void Test_FAC_InitApp_Fail_InitConfigTbl(void) +{ + int32 result = CFE_SUCCESS; + int32 expected = CFE_TBL_ERR_INVALID_NAME; + + Ut_CFE_TBL_SetReturnCode(UT_CFE_TBL_REGISTER_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitApp(); + + /* Verify results */ + UtAssert_True (result == expected, "InitApp, fail init config table"); +} + + +/** + * Test FAC_InitApp(), fail init CDS table + */ +void Test_FAC_InitApp_Fail_InitCDSTbl(void) +{ + int32 result = CFE_SUCCESS; + int32 expected = CFE_ES_CDS_INVALID_NAME; + + Ut_CFE_ES_SetReturnCode(UT_CFE_ES_REGISTERCDS_INDEX, expected, 1); + + /* Execute the function being tested */ + result = FAC_InitApp(); + + /* Verify results */ + UtAssert_True (result == expected, "InitApp, fail init CDS table"); +} + + +/** + * Test FAC_InitApp(), Nominal + */ +void Test_FAC_InitApp_Nominal(void) +{ + /* Set a fail result for SB */ + int32 result = (CFE_SEVERITY_BITMASK & CFE_SEVERITY_ERROR) + | CFE_EXECUTIVE_SERVICE | CFE_ES_ERR_APP_REGISTER; + int32 expected = CFE_SUCCESS; + + /* Execute the function being tested */ + result = FAC_InitApp(); + + /* Verify results */ + UtAssert_True (result == expected, "InitApp, nominal"); +} + +/************************************************************************** + * Tests for FAC_AppMain() + **************************************************************************/ +/** + * Test FAC_AppMain(), Fail RegisterApp + */ +void Test_FAC_AppMain_Fail_RegisterApp(void) +{ + /* fail the register app */ + Ut_CFE_ES_SetReturnCode(UT_CFE_ES_REGISTERAPP_INDEX, CFE_ES_ERR_APP_REGISTER, 1); + + /* Execute the function being tested */ + FAC_AppMain(); +} + + +/** + * Test FAC_AppMain(), Fail InitApp + */ +void Test_FAC_AppMain_Fail_InitApp(void) +{ + /* fail the register app */ + Ut_CFE_EVS_SetReturnCode(UT_CFE_EVS_REGISTER_INDEX, CFE_EVS_APP_NOT_REGISTERED, 1); + + /* Execute the function being tested */ + FAC_AppMain(); +} + + +/** + * Test FAC_AppMain(), Fail AcquireConfigPtrs + */ +void Test_FAC_AppMain_Fail_AcquireConfigPtrs(void) +{ + /* fail the register app */ + Ut_CFE_TBL_SetReturnCode(UT_CFE_TBL_GETADDRESS_INDEX, CFE_TBL_ERR_INVALID_HANDLE, 2); + + /* Execute the function being tested */ + FAC_AppMain(); +} + + +/** + * Test FAC_AppMain(), Invalid Schedule Message + */ +void Test_FAC_AppMain_InvalidSchMessage(void) +{ + /* The following will emulate behavior of receiving a SCH message to send HK */ + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, CFE_SUCCESS, 1); + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, 0, 1); + + Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); + + /* Execute the function being tested */ + FAC_AppMain(); + +} + + +/** + * Hook to support: FAC_AppMain(), Nominal - SendHK + */ +int32 Test_FAC_AppMain_Nominal_SendHK_SendMsgHook(CFE_SB_Msg_t *MsgPtr) +{ + /* TODO: Test the contents of your HK message here. */ + + hookCalledCount++; + + return CFE_SUCCESS; +} + +/** + * Test FAC_AppMain(), Nominal - SendHK + */ +void Test_FAC_AppMain_Nominal_SendHK(void) +{ + /* The following will emulate behavior of receiving a SCH message to WAKEUP */ + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, CFE_SUCCESS, 1); + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, FAC_SEND_HK_MID, 1); + + Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); + + /* Used to verify HK was transmitted correctly. */ + hookCalledCount = 0; + Ut_CFE_ES_SetFunctionHook(UT_CFE_SB_SENDMSG_INDEX, &Test_FAC_AppMain_Nominal_SendHK_SendMsgHook); + + /* Execute the function being tested */ + FAC_AppMain(); + + /* Verify results */ + UtAssert_True (hookCalledCount == 1, "AppMain_Nominal_SendHK"); + +} + + +/** + * Test FAC_AppMain(), Nominal - Wakeup + */ +void Test_FAC_AppMain_Nominal_Wakeup(void) +{ + /* The following will emulate behavior of receiving a SCH message to WAKEUP */ + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, CFE_SUCCESS, 1); + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, FAC_WAKEUP_MID, 1); + + Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); + + /* Execute the function being tested */ + FAC_AppMain(); + +} + + +/** + * Test FAC_AppMain(), ProcessNewData - InvalidMsgID + */ +void Test_FAC_AppMain_ProcessNewData_InvalidMsgID(void) +{ + FAC_InData_t InMsg; + int32 DataPipe; + + /* The following will emulate behavior of receiving a SCH message to WAKEUP, + and gives it data to process. */ + DataPipe = Ut_CFE_SB_CreatePipe("FAC_DATA_PIPE"); + CFE_SB_InitMsg (&InMsg, 0x0000, sizeof(FAC_InData_t), TRUE); + Ut_CFE_SB_AddMsgToPipe(&InMsg, DataPipe); + + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, CFE_SUCCESS, 1); + Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, FAC_WAKEUP_MID, 1); + + Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); + + /* Execute the function being tested */ + FAC_AppMain(); + + /* Verify results */ + UtAssert_True(Ut_CFE_EVS_GetEventQueueDepth()==3,"Event Count = 3"); + UtAssert_EventSent(FAC_MSGID_ERR_EID, CFE_EVS_ERROR, "", "Error Event Sent"); +} + + + +/************************************************************************** + * Rollup Test Cases + **************************************************************************/ +void FAC_App_Test_AddTestCases(void) +{ + UtTest_Add(Test_FAC_InitEvent_Fail_Register, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitEvent_Fail_Register"); + + UtTest_Add(Test_FAC_InitPipe_Fail_CreateSCHPipe, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitPipe_Fail_CreateSCHPipe"); + UtTest_Add(Test_FAC_InitPipe_Fail_SubscribeWakeup, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitPipe_Fail_SubscribeWakeup"); + UtTest_Add(Test_FAC_InitPipe_Fail_SubscribeSendHK, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitPipe_Fail_SubscribeSendHK"); + UtTest_Add(Test_FAC_InitPipe_Fail_CreateCMDPipe, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitPipe_Fail_CreateCMDPipe"); + UtTest_Add(Test_FAC_InitPipe_Fail_SubscribeCMD, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitPipe_Fail_SubscribeCMD"); + UtTest_Add(Test_FAC_InitPipe_Fail_CreateDATAPipe, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitPipe_Fail_CreateDATAPipe"); + + UtTest_Add(Test_FAC_InitData, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitData"); + + UtTest_Add(Test_FAC_InitApp_Fail_InitEvent, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitApp_Fail_InitEvent"); + UtTest_Add(Test_FAC_InitApp_Fail_InitPipe, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitApp_Fail_InitPipe"); + UtTest_Add(Test_FAC_InitApp_Fail_InitData, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitApp_Fail_InitData"); + UtTest_Add(Test_FAC_InitApp_Fail_InitConfigTbl, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitApp_Fail_InitConfigTbl"); + UtTest_Add(Test_FAC_InitApp_Fail_InitCDSTbl, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitApp_Fail_InitCDSTbl"); + UtTest_Add(Test_FAC_InitApp_Nominal, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_InitApp_Nominal"); + + UtTest_Add(Test_FAC_AppMain_Fail_RegisterApp, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_Fail_RegisterApp"); + UtTest_Add(Test_FAC_AppMain_Fail_InitApp, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_Fail_InitApp"); + UtTest_Add(Test_FAC_AppMain_Fail_AcquireConfigPtrs, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_Fail_AcquireConfigPtrs"); + UtTest_Add(Test_FAC_AppMain_InvalidSchMessage, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_InvalidSchMessage"); + UtTest_Add(Test_FAC_AppMain_Nominal_SendHK, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_Nominal_SendHK"); + UtTest_Add(Test_FAC_AppMain_Nominal_Wakeup, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_Nominal_Wakeup"); + UtTest_Add(Test_FAC_AppMain_ProcessNewData_InvalidMsgID, FAC_Test_Setup, FAC_Test_TearDown, + "Test_FAC_AppMain_ProcessNewData_InvalidMsgID"); + +} diff --git a/apps/fac/fsw/unit_test/fac_app_test.h b/apps/fac/fsw/unit_test/fac_app_test.h new file mode 100644 index 000000000..7fc8b97ae --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_app_test.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_APP_TEST_H +#define FAC_APP_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +void FAC_App_Test_AddTestCases(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* FAC_APP_TEST_H */ diff --git a/apps/fac/fsw/unit_test/fac_cds_tbl_test.c b/apps/fac/fsw/unit_test/fac_cds_tbl_test.c new file mode 100644 index 000000000..def183b62 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_cds_tbl_test.c @@ -0,0 +1,64 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "fac_cds_tbl_test.h" +#include "fac_test_utils.h" + +#include "fac_msg.h" + +#include "uttest.h" +#include "ut_osapi_stubs.h" +#include "ut_cfe_sb_stubs.h" +#include "ut_cfe_es_stubs.h" +#include "ut_cfe_es_hooks.h" +#include "ut_cfe_evs_stubs.h" +#include "ut_cfe_evs_hooks.h" +#include "ut_cfe_time_stubs.h" +#include "ut_cfe_psp_memutils_stubs.h" +#include "ut_cfe_tbl_stubs.h" +#include "ut_cfe_fs_stubs.h" +#include "ut_cfe_time_stubs.h" + + +void FAC_CDS_Tbl_Test_Case1(void) +{ + +} + + +void FAC_CDS_Tbl_Test_AddTestCases(void) +{ + UtTest_Add(FAC_CDS_Tbl_Test_Case1, FAC_Test_Setup, FAC_Test_TearDown, "FAC_CDS_Tbl_Test_Case1"); +} + + diff --git a/apps/fac/fsw/unit_test/fac_cds_tbl_test.h b/apps/fac/fsw/unit_test/fac_cds_tbl_test.h new file mode 100644 index 000000000..27c06d5b6 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_cds_tbl_test.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_CDS_TBL_TEST_H +#define FAC_CDS_TBL_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +void FAC_CDS_Tbl_Test_AddTestCases(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* FAC_CDS_TBL_TEST_H */ diff --git a/apps/fac/fsw/unit_test/fac_cmds_test.c b/apps/fac/fsw/unit_test/fac_cmds_test.c new file mode 100644 index 000000000..1387e457f --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_cmds_test.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "fac_cmds_test.h" +#include "fac_test_utils.h" + +#include "fac_msg.h" + +#include "uttest.h" +#include "ut_osapi_stubs.h" +#include "ut_cfe_sb_stubs.h" +#include "ut_cfe_es_stubs.h" +#include "ut_cfe_es_hooks.h" +#include "ut_cfe_evs_stubs.h" +#include "ut_cfe_evs_hooks.h" +#include "ut_cfe_time_stubs.h" +#include "ut_cfe_psp_memutils_stubs.h" +#include "ut_cfe_tbl_stubs.h" +#include "ut_cfe_fs_stubs.h" +#include "ut_cfe_time_stubs.h" + +int32 FAC_Cmds_Test_UT_CFE_SB_SubscribeHook1(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, + CFE_SB_Qos_t Quality, uint16 MsgLim) +{ + return 5; +} + + +int32 FAC_Cmds_Test_UT_CFE_SB_SubscribeHook2(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, + CFE_SB_Qos_t Quality, uint16 MsgLim) +{ + return 6; +} + + +void FAC_Function2_Test_Case1(void) +{ +/* int32 Result; + + FAC_AppData.Variable3 = 3; + + Ut_CFE_SB_SetFunctionHook(UT_CFE_SB_SUBSCRIBE_INDEX, &FAC_Cmds_Test_UT_CFE_SB_SubscribeHook1); +*/ + /* Execute the function being tested */ +/* Result = FAC_Function2();*/ + + /* Verify results */ +/* UtAssert_True (FAC_AppData.Variable4 == 4, "FAC_AppData.Variable4 == 4"); + UtAssert_True (Result == 25, "Result == 25"); + + UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); +*/ +} /* end FAC_Function2_Test_Case1 */ + + +void FAC_Cmds_Test_AddTestCases(void) +{ + UtTest_Add(FAC_Function2_Test_Case1, FAC_Test_Setup, FAC_Test_TearDown, "FAC_Function2_Test_Case1"); +} /* end FAC_Cmds_Test_AddTestCases */ + + diff --git a/apps/fac/fsw/unit_test/fac_cmds_test.h b/apps/fac/fsw/unit_test/fac_cmds_test.h new file mode 100644 index 000000000..103bce867 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_cmds_test.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_CMDS_TEST_H +#define FAC_CMDS_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +void FAC_Cmds_Test_AddTestCases(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* FAC_CMDS_TEST_H */ diff --git a/apps/fac/fsw/unit_test/fac_config_tbl_test.c b/apps/fac/fsw/unit_test/fac_config_tbl_test.c new file mode 100644 index 000000000..b81736b91 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_config_tbl_test.c @@ -0,0 +1,64 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "fac_config_tbl_test.h" +#include "fac_test_utils.h" + +#include "fac_msg.h" + +#include "uttest.h" +#include "ut_osapi_stubs.h" +#include "ut_cfe_sb_stubs.h" +#include "ut_cfe_es_stubs.h" +#include "ut_cfe_es_hooks.h" +#include "ut_cfe_evs_stubs.h" +#include "ut_cfe_evs_hooks.h" +#include "ut_cfe_time_stubs.h" +#include "ut_cfe_psp_memutils_stubs.h" +#include "ut_cfe_tbl_stubs.h" +#include "ut_cfe_fs_stubs.h" +#include "ut_cfe_time_stubs.h" + + +void FAC_Config_Tbl_Test_Case1(void) +{ + +} + + +void FAC_Config_Tbl_Test_AddTestCases(void) +{ + UtTest_Add(FAC_Config_Tbl_Test_Case1, FAC_Test_Setup, FAC_Test_TearDown, "FAC_Config_Tbl_Test_Case1"); +} + + diff --git a/apps/fac/fsw/unit_test/fac_config_tbl_test.h b/apps/fac/fsw/unit_test/fac_config_tbl_test.h new file mode 100644 index 000000000..daf9c9b4b --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_config_tbl_test.h @@ -0,0 +1,47 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_CONFIG_TBL_TEST_H +#define FAC_CONFIG_TBL_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +void FAC_Config_Tbl_Test_AddTestCases(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FAC_CONFIG_TBL_TEST_H */ diff --git a/apps/fac/fsw/unit_test/fac_test_utils.c b/apps/fac/fsw/unit_test/fac_test_utils.c new file mode 100644 index 000000000..da7841024 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_test_utils.c @@ -0,0 +1,82 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "fac_test_utils.h" + +#include "ut_cfe_evs_hooks.h" +#include "ut_cfe_time_stubs.h" +#include "ut_cfe_psp_memutils_stubs.h" +#include "ut_cfe_tbl_stubs.h" +#include "ut_cfe_tbl_hooks.h" +#include "ut_cfe_fs_stubs.h" +#include "ut_cfe_time_stubs.h" +#include "ut_osapi_stubs.h" +#include "ut_osfileapi_stubs.h" +#include "ut_cfe_sb_stubs.h" +#include "ut_cfe_es_stubs.h" +#include "ut_cfe_evs_stubs.h" + +#include + +/* + * Config table for testing + */ +FAC_ConfigTbl_t FAC_configtable = { + 1 /* iParam*/ +}; + +/* + * Function Definitions + */ + +void FAC_Test_Setup(void) +{ + /* initialize test environment to default state for every test */ + + CFE_PSP_MemSet(&FAC_AppData, 0x00, sizeof(FAC_AppData_t)); + + Ut_CFE_EVS_Reset(); + Ut_CFE_FS_Reset(); + Ut_CFE_TIME_Reset(); + Ut_CFE_TBL_Reset(); + Ut_CFE_SB_Reset(); + Ut_CFE_ES_Reset(); + Ut_OSAPI_Reset(); + Ut_OSFILEAPI_Reset(); + + Ut_CFE_TBL_AddTable(FAC_CONFIG_TABLE_FILENAME, (void *) &FAC_configtable); +} + +void FAC_Test_TearDown(void) { + CFE_PSP_MemSet(&FAC_AppData, 0x00, sizeof(FAC_AppData_t)); +} diff --git a/apps/fac/fsw/unit_test/fac_test_utils.h b/apps/fac/fsw/unit_test/fac_test_utils.h new file mode 100644 index 000000000..ef9f06783 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_test_utils.h @@ -0,0 +1,62 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_TEST_UTILS_H +#define FAC_TEST_UTILS_H + +/* + * Includes + */ + +#include "fac_app.h" + +extern FAC_AppData_t FAC_AppData; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Function Definitions + */ + +void FAC_Test_Setup(void); +void FAC_Test_TearDown(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* FAC_TEST_UTILS_H */ + diff --git a/apps/fac/fsw/unit_test/fac_testrunner.c b/apps/fac/fsw/unit_test/fac_testrunner.c new file mode 100644 index 000000000..7b69b5078 --- /dev/null +++ b/apps/fac/fsw/unit_test/fac_testrunner.c @@ -0,0 +1,51 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "uttest.h" + +#include "fac_app_test.h" +#include "fac_cmds_test.h" +#include "fac_config_tbl_test.h" +#include "fac_cds_tbl_test.h" + +int main(void) +{ + FAC_App_Test_AddTestCases(); + FAC_Cmds_Test_AddTestCases(); + FAC_Config_Tbl_Test_AddTestCases(); + FAC_CDS_Tbl_Test_AddTestCases(); + + return(UtTest_Run()); + +} + diff --git a/apps/fac/wh_design.yaml b/apps/fac/wh_design.yaml new file mode 100644 index 000000000..94ceac20b --- /dev/null +++ b/apps/fac/wh_design.yaml @@ -0,0 +1,105 @@ + short_name: fac + long_name: Fixedwing Attitude Control Application + app_name: FAC + module_type: CFE_APP + events: + FAC_RESERVED_EID: + id: 0 + FAC_INF_EID: + id: 1 + FAC_INIT_INF_EID: + id: 2 + FAC_CONFIG_TABLE_INF_EID: + id: 3 + FAC_CDS_INF_EID: + id: 4 + FAC_CMD_INF_EID: + id: 5 + FAC_ERR_EID: + id: 6 + FAC_INIT_ERR_EID: + id: 7 + FAC_CONFIG_TABLE_ERR_EID: + id: 8 + FAC_CDS_ERR_EID: + id: 9 + FAC_CMD_ERR_EID: + id: 10 + FAC_PIPE_ERR_EID: + id: 11 + FAC_MSGID_ERR_EID: + id: 12 + FAC_MSGLEN_ERR_EID: + id: 13 + telemetry: + FAC_HK_TLM_MID: + msgID: + struct: FAC_HkTlm_t + commands: + FAC_CMD_MID: + msgID: + commands: + Noop: + cc: 0 + struct: FAC_NoArgCmd_t + Reset: + cc: 1 + struct: FAC_NoArgCmd_t + FAC_SEND_HK_MID: + msgID: + commands: + SendHK: + cc: 0 + struct: FAC_NoArgCmd_t + FAC_WAKEUP_MID: + msgID: + commands: + WakeUp: + cc: 0 + struct: FAC_NoArgCmd_t + perfids: + FAC_MAIN_TASK_PERF_ID: + id: + config: + FAC_SB_TIMEOUT: + name: FAC_SB_TIMEOUT + value: CFE_SB_PEND_FOREVER + FAC_MISSION_REV: + name: FAC_MISSION_REV + value: 0 + FAC_SCH_PIPE_DEPTH: + name: FAC_SCH_PIPE_DEPTH + value: 2 + FAC_SCH_PIPE_NAME: + name: FAC_SCH_PIPE_NAME + value: FAC_SCH_PIPE + FAC_SCH_PIPE_PEND_TIME: + name: FAC_SCH_PIPE_PEND_TIME + value: 2000 + FAC_SCH_PIPE_WAKEUP_RESERVED: + name: FAC_SCH_PIPE_WAKEUP_RESERVED + value: 1 + FAC_SCH_PIPE_SEND_HK_RESERVED: + name: FAC_SCH_PIPE_SEND_HK_RESERVED + value: 1 + FAC_CMD_PIPE_DEPTH: + name: FAC_CMD_PIPE_DEPTH + value: 4 + FAC_CMD_PIPE_NAME: + name: FAC_CMD_PIPE_NAME + value: FAC_CMD_PIPE + FAC_DATA_PIPE_DEPTH: + name: FAC_DATA_PIPE_DEPTH + value: 4 + FAC_DATA_PIPE_NAME: + name: FAC_DATA_PIPE_NAME + value: FAC_DATA_PIPE + FAC_CONFIG_TABLE_FILENAME: + name: FAC_CONFIG_TABLE_FILENAME + value: /cf/apps/fac_config.tbl + FAC_STARTUP_TIMEOUT_MSEC: + name: FAC_STARTUP_TIMEOUT_MSEC + value: 1000 + FAC_CUSTOM_DEV_PATH: + name: FAC_CUSTOM_DEV_PATH + value: /tmp/ttyS0 diff --git a/config/obc/fixedwing/cpd/sitl/target/CMakeLists.txt b/config/obc/fixedwing/cpd/sitl/target/CMakeLists.txt index 03dbd5c26..37f11d73f 100644 --- a/config/obc/fixedwing/cpd/sitl/target/CMakeLists.txt +++ b/config/obc/fixedwing/cpd/sitl/target/CMakeLists.txt @@ -66,12 +66,6 @@ buildliner_add_app( CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/pq_lib ) -buildliner_add_app( - px4lib - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/px4lib/fsw/for_build -) - buildliner_add_app( sedlib EMBEDDED @@ -87,6 +81,12 @@ buildliner_add_app( DEFINITION ${PROJECT_SOURCE_DIR}/apps/io_lib/fsw/for_build ) +buildliner_add_app( + px4lib + EMBEDDED + DEFINITION ${PROJECT_SOURCE_DIR}/apps/px4lib/fsw/for_build +) + # sch_custom_v1.c: Traditional platform independent layer that uses OS_Timer # to drive minor frames. @@ -97,14 +97,14 @@ buildliner_add_app( # (SED). The interrupt handler included in this file does # not clear the interrupt. The SED clears the interrupt # automatically. -buildliner_add_app( - sch - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/sch/fsw/for_build - CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/sch - CONFIG_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/sch/sch_custom_v1.c -) +#buildliner_add_app( +# sch +# EMBEDDED +# DEFINITION ${PROJECT_SOURCE_DIR}/apps/sch/fsw/for_build +# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/sch +# CONFIG_SOURCES +# ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/sch/sch_custom_v1.c +#) buildliner_add_app( cf @@ -113,73 +113,6 @@ buildliner_add_app( CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/cf ) -buildliner_add_app( - fm - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/fm/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/fm -) - -buildliner_add_app( - cs - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/cs/fsw/for_build - CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/cs -) - -buildliner_add_app( - md - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/md/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/md -) - -buildliner_add_app( - mm - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/mm/fsw/for_build -) - -buildliner_add_app( - hs - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/hs/fsw/for_build - CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/hs - CONFIG_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/hs/hs_custom.c -) - -buildliner_add_app( - hk - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/hk/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/hk -) - -buildliner_add_app( - lc - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/lc/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/lc - CONFIG_SOURCES - ${PROJECT_SOURCE_DIR}/config/shared/apps/lc/src/lc_custom.c -) - -#buildliner_add_app( -# sbn -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/sbn/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../apps/sbn -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/sbn/src/sbn_remap_tbl.c -#) - -#buildliner_add_app( -# sbn_shm -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/sbn_shm/fsw/for_build -#) - buildliner_add_app( ci EMBEDDED @@ -200,231 +133,8 @@ buildliner_add_app( ) buildliner_add_app( - amc - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/amc/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/amc - CONFIG_SOURCES - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/amc/amc_custom.cpp -) -## This is temporarily removed until we can get px4lib back in -#buildliner_add_app( -# ulr -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/ulr/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/apps/ulr -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/apps/ulr/ulr_custom.cpp -#) -# -## This is temporarily removed until we can get px4lib back in -#buildliner_add_app( -# rgbled -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/rgbled/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/apps/rgbled -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/apps/rgbled/src/rgbled_custom.c -#) - -# This is temporarily removed until we can get px4lib back in -#buildliner_add_app( -# gps -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/gps/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_interface_uart/gps_sed.c -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_parser_ubx/gps_parser_ubx_common.c -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_parser_ubx/gps_parser_ubx_nav.c -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_parser_ubx/gps_parser_ubx_cfg.c -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_parser_ubx/gps_parser_ubx_ack.c -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_parser_ubx/gps_parser_ubx_mon.c -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/gps/src/gps_custom.c -#) - -buildliner_add_app( - sens - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/sens/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/sens -) - -buildliner_add_app( - vm - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/vm/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/vm -) - -buildliner_add_app( - ld - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/ld/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/ld -) - -buildliner_add_app( - nav - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/nav/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/nav -) - -# This is temporarily removed until we can get px4lib back in -buildliner_add_app( - rcin - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/rcin/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/rcin - CONFIG_SOURCES - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/rcin/sed/src/rcin_custom.c -) - -# This is temporarily removed until we can get px4lib back in -#buildliner_add_app( -# bat -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/bat/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/apps/bat -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/../../apps/bat/bat_custom.cpp -#) - -buildliner_add_app( - pe - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/pe/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/pe -) - -buildliner_add_app( - qae - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/qae/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/qae -) - -buildliner_add_app( - sc - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/sc/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/sc -) - -# This is temporarily removed until we can get px4lib back in -#buildliner_add_app( -# lgc -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/lgc/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/apps/lgc -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/apps/lgc/lgc_custom.cpp -#) -# -#buildliner_add_app( -# zusup -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/zusup/fsw/for_build -# CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/zusup -#) -# -#buildliner_add_app( -# sbnd -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/sbnd/fsw/for_build -# CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/sbnd -# CONFIG_SOURCES -# ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/sbnd/shm/sbnd_custom.cpp -#) -# -#buildliner_add_app( -# sbn_shm -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/sbn_shm/fsw/for_build -#) -# -# -#buildliner_add_app( -# sbn -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/apps/sbn/fsw/for_build -# CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/../apps/sbn -# CONFIG_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/../apps/sbn/src/sbn_remap_tbl.c -#) - - -buildliner_add_app( - icm20689 - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/icm20689/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/icm20689 -) - - -buildliner_add_app( - hmc5883 - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/hmc5883/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/hmc5883 - CONFIG_SOURCES ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/hmc5883/src/hmc5883_custom.c -) - - -buildliner_add_app( - ms5611 - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/ms5611/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/ms5611 - CONFIG_SOURCES ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/ms5611/src/ms5611_custom.c -) - - -#buildliner_add_app( -# rcin -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/rcin/fsw/for_build -# CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/rcin -#) - - -#buildliner_add_app( -# gps -# EMBEDDED -# DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/gps/fsw/for_build -# CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps -#) - -buildliner_add_app( - gps - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/gps/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps - CONFIG_SOURCES - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_interface_uart/gps_serial.c - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_parser_ubx/gps_parser_ubx_common.c - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_parser_ubx/gps_parser_ubx_nav.c - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_parser_ubx/gps_parser_ubx_cfg.c - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_parser_ubx/gps_parser_ubx_ack.c - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_parser_ubx/gps_parser_ubx_mon.c - ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/gps/src/gps_custom.c -) - -buildliner_add_app( - sed - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/../private/apps/sed/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/../private/config/obc/cpd/apps/sed -) - - -buildliner_add_app( - fpc - EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/fpc/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/fpc -) - -buildliner_add_app( - aspd4525 + fac EMBEDDED - DEFINITION ${PROJECT_SOURCE_DIR}/apps/aspd4525/fsw/for_build - CONFIG ${PROJECT_SOURCE_DIR}/config/obc/fixedwing/cpd/apps/aspd4525 + DEFINITION ${PROJECT_SOURCE_DIR}/apps/fac/fsw/for_build + CONFIG ${PROJECT_SOURCE_DIR}/config/shared/apps/fac ) diff --git a/config/obc/fixedwing/cpd/sitl/target/cfe_es_startup.scr b/config/obc/fixedwing/cpd/sitl/target/cfe_es_startup.scr index 45b756afd..9ff8944a7 100644 --- a/config/obc/fixedwing/cpd/sitl/target/cfe_es_startup.scr +++ b/config/obc/fixedwing/cpd/sitl/target/cfe_es_startup.scr @@ -4,22 +4,11 @@ CFE_LIB, /embedded/PQ_LIB.so, PQ_LibInit, PQ_LIB, 0, 0, 0x0, 0, CFE_LIB, /embedded/SED_LIB.so, SEDLIB_LibInit, SED_LIB, 0, 0, 0x0, 0, 0; CFE_LIB, /embedded/SLIP_LIB.so, SLIP_LibInit, SLIP_LIB, 0, 0, 0x0, 0, 0; CFE_LIB, /embedded/IO_LIB.so, IO_LibInit, IO_LIB, 0, 0, 0x0, 0, 0; -CFE_LIB, /embedded/IPC_LIB.so, IPC_LibInit, IPC_LIB, 0, 0, 0x0, 0, 0; -CFE_APP, /embedded/SED.so, SED_AppMain, SED, 127, 32768, 0x0, 0, 0; -CFE_APP, /embedded/SENS.so, SENS_AppMain, SENS, 20, 65536, 0x0, 0, 0; -CFE_APP, /embedded/LD.so, LD_AppMain, LD, 55, 65536, 0x0, 0, 0; -CFE_APP, /embedded/QAE.so, QAE_AppMain, QAE, 25, 65536, 0x0, 0, 0; -CFE_APP, /embedded/PE.so, PE_AppMain, PE, 70, 65536, 0x0, 0, 0; -CFE_APP, /embedded/AMC.so, AMC_AppMain, AMC, 40, 65536, 0x0, 0, 0; -CFE_APP, /embedded/NAV.so, NAV_AppMain, NAV, 50, 65536, 0x0, 0, 0; -CFE_APP, /embedded/VM.so, VM_AppMain, VM, 45, 65536, 0x0, 0, 0; -CFE_APP, /embedded/SBND.so, SBND_AppMain, SBND, 60, 32768, 0x0, 0, 0; -CFE_APP, /embedded/FM.so, FM_AppMain, FM, 115, 32768, 0x0, 0, 0; -CFE_APP, /embedded/MM.so, MM_AppMain, MM, 125, 32768, 0x0, 0, 0; -CFE_APP, /embedded/MD.so, MD_AppMain, MD, 130, 32768, 0x0, 0, 0; -CFE_APP, /embedded/SC.so, SC_AppMain, SC, 120, 32768, 0x0, 0, 0; -CFE_APP, /embedded/ZUSUP.so, ZUSUP_AppMain, ZUSUP, 240, 32768, 0x0, 0, 0; +CFE_LIB, /embedded/PX4LIB.so, PX4LIB_LibInit, PX4LIB, 0, 0, 0x0, 0, 2; +CFE_APP, /embedded/FAC.so, FAC_AppMain, FAC, 20, 32768, 0x0, 0, 0; CFE_APP, /embedded/CF.so, CF_AppMain, CF, 110, 32768, 0x0, 0, 0; +CFE_APP, /embedded/CI.so, CI_AppMain, CI, 115, 32768, 0x0, 0, 0; +CFE_APP, /embedded/TO.so, TO_AppMain, TO, 124, 32768, 0x0, 0, 2; CFE_APP, /embedded/GPS.so, GPS_AppMain, GPS, 97, 32768, 0x0, 0, 2; CFE_APP, /embedded/RCIN.so, RCIN_AppMain, RCIN, 88, 32768, 0x0, 0, 2; CFE_APP, /embedded/ICM20689.so, ICM20689_AppMain, ICM20689, 48, 32768, 0x0, 0, 2; diff --git a/config/obc/fixedwing/cpd/wh_config.yaml b/config/obc/fixedwing/cpd/wh_config.yaml index 79d72e2ab..bb71b0b71 100644 --- a/config/obc/fixedwing/cpd/wh_config.yaml +++ b/config/obc/fixedwing/cpd/wh_config.yaml @@ -202,6 +202,24 @@ modules: EA_MAIN_TASK_PERF_ID: id: 70 + fac: + definition: ${PROJECT_SOURCE_DIR}/apps/fac/wh_design.yaml + telemetry: + FAC_HK_TLM_MID: + msgID: 0x0B58 + FAC_OUT_DATA_MID: + msgID: 0x0B59 + commands: + FAC_CMD_MID: + msgID: 0x1B5A + FAC_SEND_HK_MID: + msgID: 0x1B5B + FAC_WAKEUP_MID: + msgID: 0x1B5C + perfids: + FAC_MAIN_TASK_PERF_ID: + id: 50 + fm: definition: ${PROJECT_SOURCE_DIR}/apps/fm/wh_design.yaml telemetry: diff --git a/config/obc/fixedwing/inc/msg_ids.h b/config/obc/fixedwing/inc/msg_ids.h index 2a0a81737..a24c19ab3 100644 --- a/config/obc/fixedwing/inc/msg_ids.h +++ b/config/obc/fixedwing/inc/msg_ids.h @@ -312,19 +312,26 @@ #define SBUS_SEND_HK_MID CMD_MSG( 342 ) /* 0x156 */ #define SBUS_WAKEUP_MID CMD_MSG( 343 ) /* 0x157 */ +/* FAC */ +#define FAC_HK_TLM_MID TLM_MSG( 344 ) /* 0x158 */ +#define FAC_OUT_DATA_MID TLM_MSG( 345 ) /* 0x159 */ +#define FAC_CMD_MID CMD_MSG( 346 ) /* 0x15a */ +#define FAC_SEND_HK_MID CMD_MSG( 347 ) /* 0x15b */ +#define FAC_WAKEUP_MID CMD_MSG( 348 ) /* 0x15c */ + /* ASPD4525 */ -#define ASPD4525_CMD_MID CMD_MSG( 344 ) /* 0x158 */ -#define ASPD4525_SEND_HK_MID CMD_MSG( 345 ) /* 0x159 */ -#define ASPD4525_WAKEUP_MID CMD_MSG( 346 ) /* 0x15a */ -#define ASPD4525_OUT_DATA_MID TLM_MSG( 347 ) /* 0x15b */ -#define ASPD4525_HK_TLM_MID TLM_MSG( 348 ) /* 0x15c */ +#define ASPD4525_CMD_MID CMD_MSG( 344 ) /* 0x15d */ +#define ASPD4525_SEND_HK_MID CMD_MSG( 345 ) /* 0x15e */ +#define ASPD4525_WAKEUP_MID CMD_MSG( 346 ) /* 0x15f */ +#define ASPD4525_OUT_DATA_MID TLM_MSG( 347 ) /* 0x160 */ +#define ASPD4525_HK_TLM_MID TLM_MSG( 348 ) /* 0x161 */ /* FPC */ -#define FPC_DIAG_TLM_MID TLM_MSG( 349 ) /* 0x15d */ -#define FPC_HK_TLM_MID TLM_MSG( 350 ) /* 0x15e */ -#define FPC_CMD_MID CMD_MSG( 351 ) /* 0x15f */ -#define FPC_SEND_HK_MID CMD_MSG( 352 ) /* 0x160 */ -#define FPC_WAKEUP_MID CMD_MSG( 353 ) /* 0x161 */ +#define FPC_DIAG_TLM_MID TLM_MSG( 349 ) /* 0x162 */ +#define FPC_HK_TLM_MID TLM_MSG( 350 ) /* 0x163 */ +#define FPC_CMD_MID CMD_MSG( 351 ) /* 0x164 */ +#define FPC_SEND_HK_MID CMD_MSG( 352 ) /* 0x165 */ +#define FPC_WAKEUP_MID CMD_MSG( 353 ) /* 0x166 */ #endif diff --git a/config/shared/apps/fac/CMakeLists.txt b/config/shared/apps/fac/CMakeLists.txt new file mode 100644 index 000000000..806eb74fd --- /dev/null +++ b/config/shared/apps/fac/CMakeLists.txt @@ -0,0 +1,10 @@ +set(APP_NAME fac) + +buildliner_add_table( + ${APP_NAME} + NAME fac_config + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tables/fac_config.c + INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/src/ +) + +buildliner_add_app_unit_test_src(${APP_NAME} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tables/fac_config.c) diff --git a/config/shared/apps/fac/tables/fac_config.c b/config/shared/apps/fac/tables/fac_config.c new file mode 100644 index 000000000..dd1bbc1b0 --- /dev/null +++ b/config/shared/apps/fac/tables/fac_config.c @@ -0,0 +1,627 @@ +#include "cfe_tbl_filedef.h" +#include "fac_tbldefs.h" + +/** +** \brief The cFE FAC config table definition. +** +** Content format: ObjName[64], TblName[38], Desc[32], TgtFileName[20], ObjSize +** ObjName - variable name of config table, e.g., FAC_ConfigDefTbl[] +** TblName - app's table name, e.g., FAC.CONFIG_TBL, where FAC is the same app name +** used in cfe_es_startup.scr, and FAC_defConfigTbl is the same table +** name passed in to CFE_TBL_Register() +** Desc - description of table in string format +** TgtFileName[20] - table file name, compiled as .tbl file extension +** ObjSize - size of the entire table +** +*/ +static CFE_TBL_FileDef_t CFE_TBL_FileDef = +{ + "FAC_ConfigTbl", "FAC.CONFIG_TBL", "FAC default config table", + "fac_config.tbl", sizeof(FAC_ConfigTbl_t) +}; + +FAC_ConfigTbl_t FAC_ConfigTbl = +{ + /** + * Attitude Roll Time Constant + * + * This defines the latency between a roll step input and the achieved setpoint + * (inverse to a P gain). Half a second is a good start value and fits for + * most average systems. Smaller systems may require smaller values, but as + * this will wear out servos faster, the value should only be decreased as + * needed. + * + * @unit s + * @min 0.4 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.4f, + + /** + * Attitude pitch time constant + * + * This defines the latency between a pitch step input and the achieved setpoint + * (inverse to a P gain). Half a second is a good start value and fits for + * most average systems. Smaller systems may require smaller values, but as + * this will wear out servos faster, the value should only be decreased as + * needed. + * + * @unit s + * @min 0.2 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.4f, + + /** + * Pitch rate proportional gain. + * + * This defines how much the elevator input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.08f, + + /** + * Pitch rate integrator gain. + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.5 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.02f, + + /** + * Maximum positive / up pitch rate. + * + * This limits the maximum pitch up angular rate the controller will output (in + * degrees per second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 60.0f, + + /** + * Maximum negative / down pitch rate. + * + * This limits the maximum pitch down up angular rate the controller will + * output (in degrees per second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 60.0f, + + /** + * Pitch rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.4f, + + /** + * Roll rate proportional Gain + * + * This defines how much the aileron input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.05f, + + /** + * Roll rate integrator Gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.2 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.01f, + + /** + * Roll integrator anti-windup + * + * The portion of the integrator part in the control surface deflection is limited to this value. + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.2f, + + /** + * Maximum roll rate + * + * This limits the maximum roll rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 70.0f, + + /** + * Yaw rate proportional gain + * + * This defines how much the rudder input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.05f, + + /** + * Yaw rate integrator gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.0 + * @max 50.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Yaw rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.2f, + + /** + * Maximum yaw rate + * + * This limits the maximum yaw rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Roll control to yaw control feedforward gain. + * + * This gain can be used to counteract the "adverse yaw" effect for fixed wings. + * When the plane enters a roll it will tend to yaw the nose out of the turn. + * This gain enables the use of a yaw actuator (rudder, airbrakes, ...) to counteract + * this effect. + * + * @min 0.0 + * @decimal 1 + * @increment 0.01 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Enable wheel steering controller + * + * @boolean + * @group FW Attitude Control + */ + 0, + + /** + * Wheel steering rate proportional gain + * + * This defines how much the wheel steering input will be commanded depending on the + * current body angular rate error. + * + * @unit %/rad/s + * @min 0.005 + * @max 1.0 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.5f, + + /** + * Wheel steering rate integrator gain + * + * This gain defines how much control response will result out of a steady + * state error. It trims any constant error. + * + * @unit %/rad + * @min 0.005 + * @max 0.5 + * @decimal 3 + * @increment 0.005 + * @group FW Attitude Control + */ + 0.1f, + + /** + * Wheel steering rate integrator limit + * + * The portion of the integrator part in the control surface deflection is + * limited to this value + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Maximum wheel steering rate + * + * This limits the maximum wheel steering rate the controller will output (in degrees per + * second). Setting a value of zero disables the limit. + * + * @unit deg/s + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Roll rate feed forward + * + * Direct feed forward from rate setpoint to control surface output. Use this + * to obtain a tigher response of the controller without introducing + * noise amplification. + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.5f, + + /** + * Pitch rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.5f, + + /** + * Yaw rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.3f, + + /** + * Wheel steering rate feed forward + * + * Direct feed forward from rate setpoint to control surface output + * + * @unit %/rad/s + * @min 0.0 + * @max 10.0 + * @decimal 2 + * @increment 0.05 + * @group FW Attitude Control + */ + 0.2f, + + /** + * Minimal speed for yaw coordination + * + * For airspeeds above this value, the yaw rate is calculated for a coordinated + * turn. Set to a very high value to disable. + * + * @unit m/s + * @min 0.0 + * @max 1000.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 1000.0f, + + /** + * Method used for yaw coordination + * + * The param value sets the method used to calculate the yaw rate + * 0: open-loop zero lateral acceleration based on kinematic constraints + * 1: closed-loop: try to reduce lateral acceleration to 0 by measuring the acceleration + * + * @min 0 + * @max 1 + * @value 0 open-loop + * @value 1 closed-loop + * @group FW Attitude Control + */ + 0, + + /** + * Roll setpoint offset + * + * An airframe specific offset of the roll setpoint in degrees, the value is + * added to the roll setpoint and should correspond to the typical cruise speed + * of the airframe. + * + * @unit deg + * @min -90.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Pitch setpoint offset + * + * An airframe specific offset of the pitch setpoint in degrees, the value is + * added to the pitch setpoint and should correspond to the typical cruise + * speed of the airframe. + * + * @unit deg + * @min -90.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Max manual roll + * + * Max roll for manual control in attitude stabilized mode + * + * @unit deg + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 45.0f, + + /** + * Max manual pitch + * + * Max pitch for manual control in attitude stabilized mode + * + * @unit deg + * @min 0.0 + * @max 90.0 + * @decimal 1 + * @increment 0.5 + * @group FW Attitude Control + */ + 45.0f, + + /** + * Scale factor for flaps + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Scale factor for flaperons + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 0.0f, + + /** + * Disable airspeed sensor + * + * For small wings or VTOL without airspeed sensor this parameter can be used to + * enable flying without an airspeed reading + * + * @boolean + * @group FW Attitude Control + */ + 0, + + /** + * Manual roll scale + * + * Scale factor applied to the desired roll actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Manual pitch scale + * + * Scale factor applied to the desired pitch actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Manual yaw scale + * + * Scale factor applied to the desired yaw actuator command in full manual mode. This parameter allows + * to adjust the throws of the control surfaces. + * + * @unit norm + * @min 0.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 1.0f, + + /** + * Whether to scale throttle by battery power level + * + * This compensates for voltage drop of the battery over time by attempting to + * normalize performance across the operating range of the battery. The fixed wing + * should constantly behave as if it was fully charged with reduced max thrust + * at lower battery percentages. i.e. if cruise speed is at 0.5 throttle at 100% battery, + * it will still be 0.5 at 60% battery. + * + * @boolean + * @group FW Attitude Control + */ + 0, + + /** + * Acro body x max rate. + * + * This is the rate the controller is trying to achieve if the user applies full roll + * stick input in acro mode. + * + * @min 45 + * @max 720 + * @unit degrees + * @group FW Attitude Control + */ + 90, + + /** + * Acro body y max rate. + * + * This is the body y rate the controller is trying to achieve if the user applies full pitch + * stick input in acro mode. + * + * @min 45 + * @max 720 + * @unit degrees + * @group FW Attitude Control + */ + 90, + + /** + * Acro body z max rate. + * + * This is the body z rate the controller is trying to achieve if the user applies full yaw + * stick input in acro mode. + * + * @min 10 + * @max 180 + * @unit degrees + * @group FW Attitude Control + */ + 45, + + /** + * Threshold for Rattitude mode + * + * Manual input needed in order to override attitude control rate setpoints + * and instead pass manual stick inputs as rate setpoints + * + * @min 0.0 + * @max 1.0 + * @decimal 2 + * @increment 0.01 + * @group FW Attitude Control + */ + 0.8f + +}; diff --git a/config/shared/apps/fac/unit_test/fac_custom.supp b/config/shared/apps/fac/unit_test/fac_custom.supp new file mode 100644 index 000000000..e69de29bb diff --git a/config/shared/inc/fac_mission_cfg.h b/config/shared/inc/fac_mission_cfg.h new file mode 100644 index 000000000..26054f142 --- /dev/null +++ b/config/shared/inc/fac_mission_cfg.h @@ -0,0 +1,57 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_MISSION_CFG_H +#define FAC_MISSION_CFG_H + + +/* +** FAC Mission Configuration Parameter Definitions +*/ + +/* TODO: Add mission configuration parameter definitions here, if necessary. */ + +#define FAC_SB_TIMEOUT CFE_SB_PEND_FOREVER /* Can be a value in milliseconds */ + +#define FAC_HK_TLM_MSG (344) /* FAC_HK_TLM_MID: 0x0B58 */ +#define FAC_OUT_DATA_MSG (345) /* FAC_OUT_DATA_MID: 0x0B59 */ +#define FAC_CMD_MSG (346) /* FAC_CMD_MID: 0x1B5A */ +#define FAC_SEND_HK_MSG (347) /* FAC_SEND_HK_MID: 0x1B5B */ +#define FAC_WAKEUP_MSG (348) /* FAC_WAKEUP_MID: 0x1B5C */ + + +#endif /* FAC_MISSION_CFG_H */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/config/shared/inc/fac_msgids.h b/config/shared/inc/fac_msgids.h new file mode 100644 index 000000000..942b57349 --- /dev/null +++ b/config/shared/inc/fac_msgids.h @@ -0,0 +1,8 @@ +#ifndef FAC_MSGIDS_H +#define FAC_MSGIDS_H + + +#include "msg_ids.h" + + +#endif /* FAC_MSGIDS_H */ diff --git a/config/shared/inc/fac_perfids.h b/config/shared/inc/fac_perfids.h new file mode 100644 index 000000000..0d77e3ff9 --- /dev/null +++ b/config/shared/inc/fac_perfids.h @@ -0,0 +1,46 @@ +/**************************************************************************** + * + * Copyright (c) 2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef FAC_PERFIDS_H +#define FAC_PERFIDS_H + + +/** \brief Performance ID for the TO main task */ +#define FAC_MAIN_TASK_PERF_ID (50) + + +#endif /* FAC_PERFIDS_H */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/config/shared/inc/fac_platform_cfg.h b/config/shared/inc/fac_platform_cfg.h new file mode 100644 index 000000000..7a825a130 --- /dev/null +++ b/config/shared/inc/fac_platform_cfg.h @@ -0,0 +1,145 @@ +#ifndef FAC_PLATFORM_CFG_H +#define FAC_PLATFORM_CFG_H + + +/* +** fac Platform Configuration Parameter Definitions +*/ + +/** \brief Mission specific version number for FAC application +** +** \par Description: +** An application version number consists of four parts: +** major version number, minor version number, revision +** number and mission specific revision number. The mission +** specific revision number is defined here and the other +** parts are defined in "fac_version.h". +** +** \par Limits: +** Must be defined as a numeric value that is greater than +** or equal to zero. +*/ +#define FAC_MISSION_REV (0) + +/** \brief Pipe depth for the Scheduler pipe +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH. +*/ +#define FAC_SCH_PIPE_DEPTH (2) + +/** \brief Pipe name for the Scheduler pipe +** +** \par Limits: +** Note, this name must fit in OS_MAX_API_NAME. +*/ +#define FAC_SCH_PIPE_NAME ("FAC_SCH_PIPE") + +/** \brief The SB pend behavior type for the Scheduler pipe. +** +** \par Limits: +** One of: CFE_SB_POLL, CFE_SB_PEND_FOREVER, or the +** number of milliseconds to wait for a new message (recommended). +** Note, using CFE_SB_PEND_FOREVER may cause an unresponsive +** application if no messages arrive on this pipe. +*/ +#define FAC_SCH_PIPE_PEND_TIME (2000) + +/** \brief The number of WAKEUP messages to reserve on the Scheduler pipe. +** +** \par Limits: +** minimum of 1, max limited to CFE_SB_MAX_PIPE_DEPTH-1. Note the +** FAC_SCH_PIPE_WAKEUP_RESERVED and FAC_SCH_PIPE_SEND_HK_RESERVED +** must be less than FAC_SCH_PIPE_DEPTH. +*/ +#define FAC_SCH_PIPE_WAKEUP_RESERVED (1) + +/** \brief The number of SEND_HK messages to reserve on the Scheduler pipe. +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH. Note the +** FAC_SCH_PIPE_WAKEUP_RESERVED and FAC_SCH_PIPE_SEND_HK_RESERVED +** must be less than FAC_SCH_PIPE_DEPTH. +*/ +#define FAC_SCH_PIPE_SEND_HK_RESERVED (1) + +/** \brief Pipe depth for the command pipe +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH. +*/ +#define FAC_CMD_PIPE_DEPTH (4) + +/** \brief Pipe name for the Scheduler pipe +** +** \par Limits: +** Note, this name must fit in OS_MAX_API_NAME. +*/ +#define FAC_CMD_PIPE_NAME ("FAC_CMD_PIPE") + +/** \brief The SB pend behavior type for the Command pipe. +** +** \par Limits: +** One of: CFE_SB_POLL, CFE_SB_PEND_FOREVER, or the +** number of milliseconds to wait for a new message (recommended). +** Note, using CFE_SB_PEND_FOREVER may cause an unresponsive +** application if no messages arrive on this pipe. +*/ +#define FAC_CMD_PIPE_PEND_TIME (2000) + +/** \brief Pipe depth for the data pipe +** +** \par Limits: +** minimum of 1, max of CFE_SB_MAX_PIPE_DEPTH(256). +*/ +#define FAC_DATA_PIPE_DEPTH (5) + +/** \brief Pipe name for the Scheduler pipe +** +** \par Limits: +** Note, this name must fit in OS_MAX_API_NAME. +*/ +#define FAC_DATA_PIPE_NAME ("FAC_DATA_PIPE") + +/** \brief The SB pend behavior type for the Data pipe. +** +** \par Limits: +** One of: CFE_SB_POLL, CFE_SB_PEND_FOREVER, or the +** number of milliseconds to wait for a new message (recommended). +** Note, using CFE_SB_PEND_FOREVER may cause an unresponsive +** application if no messages arrive on this pipe. +*/ +#define FAC_DATA_PIPE_PEND_TIME (2000) +#define FAC_DATA_PIPE_RESERVED (FAC_DATA_PIPE_DEPTH - 1) + +/** \brief The config table default filename +** +** \par Limits: +** The length of each string, including the NULL terminator cannot exceed +** the #OS_MAX_PATH_LEN value. +*/ +#define FAC_CONFIG_TABLE_FILENAME ("/cf/apps/fac_config.tbl") +/** \brief The timeout value, in milliseconds, to wait for ES application startup sync. +** +** \par Limits: +** This parameter must be at least 1000 (ms). +*/ +#define FAC_STARTUP_TIMEOUT_MSEC (1000) + +/* TODO: Add Doxygen markup. */ +#define FAC_CUSTOM_DEV_PATH "/tmp/ttyS0" + +#define FAC_CDS_TASK_PRIORITY (20) + +#define FAC_CDS_TASK_NAME "FAC_CDS_TASK" + +#define FAC_CMDS_TASK_PRIORITY (100) + +#define FAC_CMDS_TASK_NAME "FAC_CMDS_TASK" + + +#endif /* FAC_PLATFORM_CFG_H */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/config/shared/inc/px4_msgs.h b/config/shared/inc/px4_msgs.h new file mode 100644 index 000000000..b51900ad6 --- /dev/null +++ b/config/shared/inc/px4_msgs.h @@ -0,0 +1,1382 @@ +/**************************************************************************** + * + * Copyright (c) 2016-2017 Windhover Labs, L.L.C. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Windhover Labs nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef _PX4_MSGS_H_ +#define _PX4_MSGS_H_ + +#include "cfe.h" + +#define PX4_ACTUATOR_DIRECT_MAX ( 16 ) +#define PX4_ACTUATOR_OUTPUTS_MAX ( 16 ) +#define PX4_ACTUATOR_OUTPUTS_GROUP_MAX ( 4 ) +#define PX4_ADC_CHANNEL_MAX ( 8 ) +#define PX4_ESC_CONNECTED_ESC_MAX ( 8 ) +#define PX4_ESTIMATOR_STATES_MAX ( 32 ) +#define PX4_ESTIMATOR_VIBE_MAX ( 3 ) +#define PX4_ESTIMATOR_COVARIANCES_MAX ( 28 ) +#define PX4_FENCE_MAX_VERTICES ( 16 ) +#define PX4_GPS_DUMP_DATA_MAX ( 79 ) +#define PX4_GPS_INJECT_DATA_MAX ( 182 ) +#define PX4_RC_INPUT_MAX_CHANNELS ( 18 ) +#define PX4_PWM_OUTPUT_MAX_CHANNELS ( 16 ) +#define PX4_QSHELL_REQ_MAX_STRLEN ( 100 ) +#define PX4_RC_PARAM_MAP_NCHAN ( 3 ) +#define PX4_RC_PARAM_MAP_ID_LEN ( 51 ) +#define PX4_SAT_INFO_MAX_SATELLITES ( 20 ) +#define PX4_NUM_MOTOR_OUTPUTS ( 8 ) +#define PX4_ADSB_CALLSIGN_LEN ( 8 ) +#define PX4_OPTICAL_FLOW_FRAME_SIZE ( 4096 ) + +typedef enum +{ + PX4_GPS_NONE0_FIX = 0, + PX4_GPS_NONE1_FIX = 1, + PX4_GPS_2D_FIX = 2, + PX4_GPS_3D_FIX = 3, + PX4_GPS_DGPS_FIX = 4, + PX4_GPS_RTK_FIX = 5 + +} PX4_GpsFixType_t; + +typedef enum +{ + PX4_DISTANCE_SENSOR_LASER = 0, + PX4_DISTANCE_SENSOR_ULTRASOUND = 1, + PX4_DISTANCE_SENSOR_INFRARED = 2, + PX4_DISTANCE_SENSOR_RADAR = 3 +} PX4_DistanceSensorType_t; + +typedef enum +{ + PX4_ACTUATOR_CONTROL_ROLL = 0, + PX4_ACTUATOR_CONTROL_PITCH = 1, + PX4_ACTUATOR_CONTROL_YAW = 2, + PX4_ACTUATOR_CONTROL_THROTTLE = 3, + PX4_ACTUATOR_CONTROL_FLAPS = 4, + PX4_ACTUATOR_CONTROL_SPOILERS = 5, + PX4_ACTUATOR_CONTROL_AIRBRAKES = 6, + PX4_ACTUATOR_CONTROL_LANDING_GEAR = 7, + PX4_ACTUATOR_CONTROL_COUNT = 8 +} PX4_ActuatorControlIndex_t; + +typedef enum +{ + PX4_ACTUATOR_CONTROL_GROUP_ATTITUDE = 0, + PX4_ACTUATOR_CONTROL_GROUP_ATTITUDE_ALTERNATE = 1, + PX4_ACTUATOR_CONTROL_GROUP_COUNT = 4 +} PX4_ActuatorControlGroupIndex_t; + +typedef enum +{ + PX4_BATTERY_WARNING_NONE = 0, + PX4_BATTERY_WARNING_LOW = 1, + PX4_BATTERY_WARNING_CRITICAL = 2, + PX4_BATTERY_WARNING_EMERGENCY = 3 +} PX4_BatteryWarningSeverity_t; + +typedef enum +{ + PX4_COMMANDER_MAIN_STATE_MANUAL = 0, + PX4_COMMANDER_MAIN_STATE_ALTCTL = 1, + PX4_COMMANDER_MAIN_STATE_POSCTL = 2, + PX4_COMMANDER_MAIN_STATE_AUTO_MISSION = 3, + PX4_COMMANDER_MAIN_STATE_AUTO_LOITER = 4, + PX4_COMMANDER_MAIN_STATE_AUTO_RTL = 5, + PX4_COMMANDER_MAIN_STATE_ACRO = 6, + PX4_COMMANDER_MAIN_STATE_OFFBOARD = 7, + PX4_COMMANDER_MAIN_STATE_STAB = 8, + PX4_COMMANDER_MAIN_STATE_RATTITUDE = 9, + PX4_COMMANDER_MAIN_STATE_AUTO_TAKEOFF = 10, + PX4_COMMANDER_MAIN_STATE_AUTO_LAND = 11, + PX4_COMMANDER_MAIN_STATE_AUTO_FOLLOW_TARGET = 12, + PX4_COMMANDER_MAIN_STATE_AUTO_PRECLAND = 13, + PX4_COMMANDER_MAIN_STATE_DESCEND = 14, + PX4_COMMANDER_MAIN_STATE_TERMINATION = 15, + PX4_COMMANDER_MAIN_STATE_AUTO_OFFBOARD = 16, + PX4_COMMANDER_MAIN_STATE_AUTO_RTGS = 17, + PX4_COMMANDER_MAIN_STATE_AUTO_RATTITUDE = 18, + PX4_COMMANDER_MAIN_STATE_AUTO_LANDENGFAIL = 19, + PX4_COMMANDER_MAIN_STATE_AUTO_LANDGPSFAIL = 20, + PX4_COMMANDER_MAIN_STATE_AUTO_RCRECOVER = 21, + PX4_COMMANDER_MAIN_STATE_MAX = 22 +} PX4_CommanderMainState_t; + +typedef enum +{ + PX4_AIRSPEED_MODE_MEAS = 0, + PX4_AIRSPEED_MODE_EST = 1, + PX4_AIRSPEED_MODE_DISABLED = 2 +} PX4_AirspeedMode_t; + +typedef enum +{ + PX4_ESC_VENDOR_GENERIC = 0, + PX4_ESC_VENDOR_MIKROKOPTER = 1, + PX4_ESC_VENDOR_GRAUPNER_HOTT = 2, + PX4_ESC_VENDOR_TAP = 3 +} PX4_EscVendor_t; + +typedef enum +{ + PX4_ESC_CONNECTION_TYPE_PPM = 0, + PX4_ESC_CONNECTION_TYPE_SERIAL = 1, + PX4_ESC_CONNECTION_TYPE_ONESHOOT = 2, + PX4_ESC_CONNECTION_TYPE_I2C = 3, + PX4_ESC_CONNECTION_TYPE_CAN = 4 +} PX4_EscConnectionType_t; + +typedef enum +{ + PX4_GEOFENCE_ACTION_NONE = 0, + PX4_GEOFENCE_ACTION_WARN = 1, + PX4_GEOFENCE_ACTION_LOITER = 2, + PX4_GEOFENCE_ACTION_RTL = 3, + PX4_GEOFENCE_ACTION_TERMINATE = 4 +} PX4_GeofenceAction_t; + +typedef enum +{ + PX4_MAGNETOMETER_MODE_NORMAL = 0, + PX4_MAGNETOMETER_MODE_POSITIVE_BIAS = 1, + PX4_MAGNETOMETER_MODE_NEGATIVE_BIAS = 2 +} PX4_MagnetometerMode_t; + +typedef enum +{ + PX4_RC_INPUT_SOURCE_UNKNOWN = 0, + PX4_RC_INPUT_SOURCE_PX4FMU_PPM = 1, + PX4_RC_INPUT_SOURCE_PX4IO_PPM = 2, + PX4_RC_INPUT_SOURCE_PX4IO_SPEKTRUM = 3, + PX4_RC_INPUT_SOURCE_PX4IO_SBUS = 4, + PX4_RC_INPUT_SOURCE_PX4IO_ST24 = 5, + PX4_RC_INPUT_SOURCE_MAVLINK = 6, + PX4_RC_INPUT_SOURCE_QURT = 7, + PX4_RC_INPUT_SOURCE_PX4FMU_SPEKTRUM = 8, + PX4_RC_INPUT_SOURCE_PX4FMU_SBUS = 9, + PX4_RC_INPUT_SOURCE_PX4FMU_ST24 = 10, + PX4_RC_INPUT_SOURCE_PX4FMU_SUMD = 11, + PX4_RC_INPUT_SOURCE_PX4FMU_DSM = 12, + PX4_RC_INPUT_SOURCE_PX4IO_SUMD = 13 +} PX4_RcInputSource_t; + +typedef enum +{ + PX4_SWITCH_POS_NONE = 0, + PX4_SWITCH_POS_ON = 1, + PX4_SWITCH_POS_MIDDLE = 2, + PX4_SWITCH_POS_OFF = 3 +} PX4_SwitchPos_t; + +typedef enum +{ + PX4_MANUAL_CONTROL_SOURCE_RC = 1, + PX4_MANUAL_CONTROL_SOURCE_MAVLINK_0 = 2, + PX4_MANUAL_CONTROL_SOURCE_MAVLINK_1 = 3, + PX4_MANUAL_CONTROL_SOURCE_MAVLINK_2 = 4, + PX4_MANUAL_CONTROL_SOURCE_MAVLINK_3 = 5 +} PX4_ManualControlDataSource_t; + + +typedef enum +{ + PX4_MODE_SLOT_NONE = -1, + PX4_MODE_SLOT_1 = 0, + PX4_MODE_SLOT_2 = 1, + PX4_MODE_SLOT_3 = 2, + PX4_MODE_SLOT_4 = 3, + PX4_MODE_SLOT_5 = 4, + PX4_MODE_SLOT_6 = 5, + PX4_MODE_SLOT_MAX = 6 +} PX4_ModeSlot_t; + +typedef enum +{ + PX4_SETPOINT_TYPE_POSITION = 0, + PX4_SETPOINT_TYPE_VELOCITY = 1, + PX4_SETPOINT_TYPE_LOITER = 2, + PX4_SETPOINT_TYPE_TAKEOFF = 3, + PX4_SETPOINT_TYPE_LAND = 4, + PX4_SETPOINT_TYPE_IDLE = 5, + PX4_SETPOINT_TYPE_OFFBOARD = 6, + PX4_SETPOINT_TYPE_FOLLOW_TARGET = 7 +} PX4_SetpointType_t; + +typedef enum +{ + PX4_VELOCITY_FRAME_LOCAL_NED = 1, + PX4_VELOCITY_FRAME_BODY_NED = 8 +} PX4_VelocityFrameType_t; + +typedef enum +{ + PX4_RC_CHANNELS_FUNCTION_THROTTLE = 0, + PX4_RC_CHANNELS_FUNCTION_ROLL = 1, + PX4_RC_CHANNELS_FUNCTION_PITCH = 2, + PX4_RC_CHANNELS_FUNCTION_YAW = 3, + PX4_RC_CHANNELS_FUNCTION_MODE = 4, + PX4_RC_CHANNELS_FUNCTION_RETURN = 5, + PX4_RC_CHANNELS_FUNCTION_POSCTL = 6, + PX4_RC_CHANNELS_FUNCTION_LOITER = 7, + PX4_RC_CHANNELS_FUNCTION_OFFBOARD = 8, + PX4_RC_CHANNELS_FUNCTION_ACRO = 9, + PX4_RC_CHANNELS_FUNCTION_FLAPS = 10, + PX4_RC_CHANNELS_FUNCTION_AUX_1 = 11, + PX4_RC_CHANNELS_FUNCTION_AUX_2 = 12, + PX4_RC_CHANNELS_FUNCTION_AUX_3 = 13, + PX4_RC_CHANNELS_FUNCTION_AUX_4 = 14, + PX4_RC_CHANNELS_FUNCTION_AUX_5 = 15, + PX4_RC_CHANNELS_FUNCTION_PARAM_1 = 16, + PX4_RC_CHANNELS_FUNCTION_PARAM_2 = 17, + PX4_RC_CHANNELS_FUNCTION_PARAM_3 = 18, + PX4_RC_CHANNELS_FUNCTION_RATTITUDE = 19, + PX4_RC_CHANNELS_FUNCTION_KILLSWITCH = 20, + PX4_RC_CHANNELS_FUNCTION_TRANSITION = 21, + PX4_RC_CHANNELS_FUNCTION_GEAR = 22, + PX4_RC_CHANNELS_FUNCTION_ARMSWITCH = 23, + PX4_RC_CHANNELS_FUNCTION_STAB = 24, + PX4_RC_CHANNELS_FUNCTION_MAN = 25, + PX4_RC_CHANNELS_FUNCTION_ALTCTL = 26, + PX4_RC_CHANNELS_FUNCTION_COUNT = 27 +} PX4_RcChannelFunction_t; + +typedef enum +{ + PX4_SUBSYSTEM_TYPE_GYRO = 0b00000000000000000001, /* 1 */ + PX4_SUBSYSTEM_TYPE_ACC = 0b00000000000000000010, /* 2 */ + PX4_SUBSYSTEM_TYPE_MAG = 0b00000000000000000100, /* 4 */ + PX4_SUBSYSTEM_TYPE_ABSPRESSURE = 0b00000000000000001000, /* 8 */ + PX4_SUBSYSTEM_TYPE_DIFFPRESSURE = 0b00000000000000010000, /* 16 */ + PX4_SUBSYSTEM_TYPE_GPS = 0b00000000000000100000, /* 32 */ + PX4_SUBSYSTEM_TYPE_OPTICALFLOW = 0b00000000000001000000, /* 64 */ + PX4_SUBSYSTEM_TYPE_CVPOSITION = 0b00000000000010000000, /* 128 */ + PX4_SUBSYSTEM_TYPE_LASERPOSITION = 0b00000000000100000000, /* 256 */ + PX4_SUBSYSTEM_TYPE_EXTERNALGROUNDTRUTH = 0b00000000001000000000, /* 512 */ + PX4_SUBSYSTEM_TYPE_ANGULARRATECONTROL = 0b00000000010000000000, /* 1024 */ + PX4_SUBSYSTEM_TYPE_ATTITUDESTABILIZATION = 0b00000000100000000000, /* 2048 */ + PX4_SUBSYSTEM_TYPE_YAWPOSITION = 0b00000001000000000000, /* 4096 */ + /* Skip 8192 */ + PX4_SUBSYSTEM_TYPE_ALTITUDECONTROL = 0b00000100000000000000, /* 16384 */ + PX4_SUBSYSTEM_TYPE_POSITIONCONTROL = 0b00001000000000000000, /* 32768 */ + PX4_SUBSYSTEM_TYPE_MOTORCONTROL = 0b00010000000000000000, /* 65536 */ + PX4_SUBSYSTEM_TYPE_RANGEFINDER = 0b00100000000000000000 /* 131072 */ +} PX4_SubsystemType_t; + +typedef enum +{ + PX4_TECS_MODE_NORMAL = 0, + PX4_TECS_MODE_UNDERSPEED = 1, + PX4_TECS_MODE_TAKEOFF = 2, + PX4_TECS_MODE_LAND = 3, + PX4_TECS_MODE_LAND_THROTTLELIM = 4, + PX4_TECS_MODE_BAD_DESCENT = 5, + PX4_TECS_MODE_CLIMBOUT = 6 +} PX4_TecsMode_t; + +typedef enum +{ + PX4_TELEMETRY_STATUS_RADIO_TYPE_GENERIC = 0, + PX4_TELEMETRY_STATUS_RADIO_TYPE_3DR_RADIO = 1, + PX4_TELEMETRY_STATUS_RADIO_TYPE_UBIQUITY_BULLET = 2, + PX4_TELEMETRY_STATUS_RADIO_TYPE_WIRE = 3, + PX4_TELEMETRY_STATUS_RADIO_TYPE_USB = 4 +} PX4_TelemetryStatusRadioType_t; + +typedef enum +{ + PX4_ADSB_ALTITUDE_TYPE_PRESSURE_QNH = 0, + PX4_ADSB_ALTITUDE_TYPE_GEOMETRIC = 1 +} PX4_AdsbAltitudeType_t; + +typedef enum +{ + PX4_ADSB_EMITTER_TYPE_NO_INFO = 0, + PX4_ADSB_EMITTER_TYPE_LIGHT = 1, + PX4_ADSB_EMITTER_TYPE_SMALL = 2, + PX4_ADSB_EMITTER_TYPE_LARGE = 3, + PX4_ADSB_EMITTER_TYPE_HIGH_VORTEX_LARGE = 4, + PX4_ADSB_EMITTER_TYPE_HEAVY = 5, + PX4_ADSB_EMITTER_TYPE_HIGHLY_MANUV = 6, + PX4_ADSB_EMITTER_TYPE_ROTOCRAFT = 7, + PX4_ADSB_EMITTER_TYPE_UNASSIGNED = 8, + PX4_ADSB_EMITTER_TYPE_GLIDER = 9, + PX4_ADSB_EMITTER_TYPE_LIGHTER_AIR = 10, + PX4_ADSB_EMITTER_TYPE_PARACHUTE = 11, + PX4_ADSB_EMITTER_TYPE_ULTRA_LIGHT = 12, + PX4_ADSB_EMITTER_TYPE_UNASSIGNED2 = 13, + PX4_ADSB_EMITTER_TYPE_UAV = 14, + PX4_ADSB_EMITTER_TYPE_SPACE = 15, + PX4_ADSB_EMITTER_TYPE_UNASSGINED3 = 16, + PX4_ADSB_EMITTER_TYPE_EMERGENCY_SURFACE = 17, + PX4_ADSB_EMITTER_TYPE_SERVICE_SURFACE = 18, + PX4_ADSB_EMITTER_TYPE_POINT_OBSTACLE = 19 +} PX4_AdsbEmitterType_t; + +typedef enum +{ + PX4_ADSB_FLAGS_VALID_COORDS = 0b00000001, /* 1 */ + PX4_ADSB_FLAGS_VALID_ALTITUDE = 0b00000010, /* 2 */ + PX4_ADSB_FLAGS_VALID_HEADING = 0b00000100, /* 4 */ + PX4_ADSB_FLAGS_VALID_VELOCITY = 0b00001000, /* 8 */ + PX4_ADSB_FLAGS_VALID_CALLSIGN = 0b00010000, /* 16 */ + PX4_ADSB_FLAGS_VALID_SQUAWK = 0b00100000, /* 32 */ + PX4_ADSB_FLAGS_SIMULATED = 0b01000000 /* 64 */ +} PX4_AdsbFlags_t; + +typedef enum +{ + PX4_VEHICLE_COMMAND_RESULT_ACCEPTED = 0, + PX4_VEHICLE_COMMAND_RESULT_TEMPORARILY_REJECTED = 1, + PX4_VEHICLE_COMMAND_RESULT_DENIED = 2, + PX4_VEHICLE_COMMAND_RESULT_UNSUPPORTED = 3, + PX4_VEHICLE_COMMAND_RESULT_FAILED = 4 +} PX4_VehicleCommandResult_t; + +typedef enum +{ + PX4_VEHICLE_CMD_CUSTOM_0 = 0, + PX4_VEHICLE_CMD_CUSTOM_1 = 1, + PX4_VEHICLE_CMD_CUSTOM_2 = 2, + PX4_VEHICLE_CMD_NAV_WAYPOINT = 16, + PX4_VEHICLE_CMD_NAV_LOITER_UNLIM = 17, + PX4_VEHICLE_CMD_NAV_LOITER_TURNS = 18, + PX4_VEHICLE_CMD_NAV_LOITER_TIME = 19, + PX4_VEHICLE_CMD_NAV_RETURN_TO_LAUNCH = 20, + PX4_VEHICLE_CMD_NAV_LAND = 21, + PX4_VEHICLE_CMD_NAV_TAKEOFF = 22, + PX4_VEHICLE_CMD_NAV_LOITER_TO_ALT = 31, + PX4_VEHICLE_CMD_NAV_ROI = 80, + PX4_VEHICLE_CMD_NAV_PATHPLANNING = 81, + PX4_VEHICLE_CMD_NAV_VTOL_TAKEOFF = 84, + PX4_VEHICLE_CMD_NAV_VTOL_LAND = 85, + PX4_VEHICLE_CMD_NAV_GUIDED_LIMITS = 90, + PX4_VEHICLE_CMD_NAV_GUIDED_MASTER = 91, + PX4_VEHICLE_CMD_NAV_GUIDED_ENABLE = 92, + PX4_VEHICLE_CMD_NAV_LAST = 95, + PX4_VEHICLE_CMD_CONDITION_DELAY = 112, + PX4_VEHICLE_CMD_CONDITION_CHANGE_ALT = 113, + PX4_VEHICLE_CMD_CONDITION_DISTANCE = 114, + PX4_VEHICLE_CMD_CONDITION_YAW = 115, + PX4_VEHICLE_CMD_CONDITION_LAST = 159, + PX4_VEHICLE_CMD_DO_SET_MODE = 176, + PX4_VEHICLE_CMD_DO_JUMP = 177, + PX4_VEHICLE_CMD_DO_CHANGE_SPEED = 178, + PX4_VEHICLE_CMD_DO_SET_HOME = 179, + PX4_VEHICLE_CMD_DO_SET_PARAMETER = 180, + PX4_VEHICLE_CMD_DO_SET_RELAY = 181, + PX4_VEHICLE_CMD_DO_REPEAT_RELAY = 182, + PX4_VEHICLE_CMD_DO_SET_SERVO = 183, + PX4_VEHICLE_CMD_DO_REPEAT_SERVO = 184, + PX4_VEHICLE_CMD_DO_FLIGHTTERMINATION = 185, + PX4_VEHICLE_CMD_DO_GO_AROUND = 191, + PX4_VEHICLE_CMD_DO_REPOSITION = 192, + PX4_VEHICLE_CMD_DO_PAUSE_CONTINUE = 193, + PX4_VEHICLE_CMD_DO_CONTROL_VIDEO = 200, + PX4_VEHICLE_CMD_DO_DIGICAM_CONTROL = 203, + PX4_VEHICLE_CMD_DO_MOUNT_CONFIGURE = 204, + PX4_VEHICLE_CMD_DO_MOUNT_CONTROL = 205, + PX4_VEHICLE_CMD_DO_SET_CAM_TRIGG_DIST = 206, + PX4_VEHICLE_CMD_DO_FENCE_ENABLE = 207, + PX4_VEHICLE_CMD_DO_PARACHUTE = 208, + PX4_VEHICLE_CMD_DO_INVERTED_FLIGHT = 210, + PX4_VEHICLE_CMD_DO_MOUNT_CONTROL_QUAT = 220, + PX4_VEHICLE_CMD_DO_GUIDED_MASTER = 221, + PX4_VEHICLE_CMD_DO_GUIDED_LIMITS = 222, + PX4_VEHICLE_CMD_DO_LAST = 240, + PX4_VEHICLE_CMD_PREFLIGHT_CALIBRATION = 241, + PX4_VEHICLE_CMD_PREFLIGHT_SET_SENSOR_OFFSETS = 242, + PX4_VEHICLE_CMD_PREFLIGHT_UAVCAN = 243, + PX4_VEHICLE_CMD_PREFLIGHT_STORAGE = 245, + PX4_VEHICLE_CMD_PREFLIGHT_REBOOT_SHUTDOWN = 246, + PX4_VEHICLE_CMD_OVERRIDE_GOTO = 252, + PX4_VEHICLE_CMD_MISSION_START = 300, + PX4_VEHICLE_CMD_COMPONENT_ARM_DISARM = 400, + PX4_VEHICLE_CMD_START_RX_PAIR = 500, + PX4_VEHICLE_CMD_DO_TRIGGER_CONTROL = 2003, + PX4_VEHICLE_CMD_DO_VTOL_TRANSITION = 3000, + PX4_VEHICLE_CMD_PAYLOAD_PREPARE_DEPLOY = 30001, + PX4_VEHICLE_CMD_PAYLOAD_CONTROL_DEPLOY = 30002 +} PX4_VehicleCmd_t; + +typedef enum +{ + PX4_ARMING_STATE_INIT = 0, + PX4_ARMING_STATE_STANDBY = 1, + PX4_ARMING_STATE_ARMED = 2, + PX4_ARMING_STATE_ARMED_ERROR = 3, + PX4_ARMING_STATE_STANDBY_ERROR = 4, + PX4_ARMING_STATE_REBOOT = 5, + PX4_ARMING_STATE_IN_AIR_RESTORE = 6, + PX4_ARMING_STATE_MAX = 7 +} PX4_ArmingState_t; + +typedef enum +{ + PX4_HIL_STATE_OFF = 0, + PX4_HIL_STATE_ON = 1 +} PX4_HilState_t; + +typedef enum +{ + PX4_NAVIGATION_STATE_MANUAL = 0, + PX4_NAVIGATION_STATE_ALTCTL = 1, + PX4_NAVIGATION_STATE_POSCTL = 2, + PX4_NAVIGATION_STATE_AUTO_MISSION = 3, + PX4_NAVIGATION_STATE_AUTO_LOITER = 4, + PX4_NAVIGATION_STATE_AUTO_RTL = 5, + PX4_NAVIGATION_STATE_AUTO_RCRECOVER = 6, + PX4_NAVIGATION_STATE_AUTO_RTGS = 7, + PX4_NAVIGATION_STATE_AUTO_LANDENGFAIL = 8, + PX4_NAVIGATION_STATE_AUTO_LANDGPSFAIL = 9, + PX4_NAVIGATION_STATE_ACRO = 10, + PX4_NAVIGATION_STATE_UNUSED = 11, + PX4_NAVIGATION_STATE_DESCEND = 12, + PX4_NAVIGATION_STATE_TERMINATION = 13, + PX4_NAVIGATION_STATE_OFFBOARD = 14, + PX4_NAVIGATION_STATE_STAB = 15, + PX4_NAVIGATION_STATE_RATTITUDE = 16, + PX4_NAVIGATION_STATE_AUTO_TAKEOFF = 17, + PX4_NAVIGATION_STATE_AUTO_LAND = 18, + PX4_NAVIGATION_STATE_AUTO_FOLLOW_TARGET = 19, + PX4_NAVIGATION_STATE_AUTO_PRECLAND = 20, + PX4_NAVIGATION_STATE_MAX = 21 +} PX4_NavigationState_t; + +typedef enum +{ + PX4_RC_IN_MODE_DEFAULT = 0, + PX4_RC_IN_MODE_OFF = 1, + PX4_RC_IN_MODE_GENERATED = 2 +} PX4_RcInMode_t; + +typedef enum +{ + PX4_VEHICLE_MOUNT_MODE_RETRACT = 0, + PX4_VEHICLE_MOUNT_MODE_NEUTRAL = 1, + PX4_VEHICLE_MOUNT_MODE_MAVLINK_TARGETING = 2, + PX4_VEHICLE_MOUNT_MODE_RC_TARGETING = 3, + PX4_VEHICLE_MOUNT_MODE_GPS_POINT = 4, + PX4_VEHICLE_MOUNT_MODE_ENUM_END = 5 +} PX4_VehicleMountMode_t; + +typedef enum +{ + PX4_SYSTEM_TYPE_GENERIC = 0, + PX4_SYSTEM_TYPE_FIXED_WING = 1, + PX4_SYSTEM_TYPE_QUADROTOR = 2, + PX4_SYSTEM_TYPE_COAXIAL = 3, + PX4_SYSTEM_TYPE_HELICOPTER = 4, + PX4_SYSTEM_TYPE_ANTENNA_TRACKER = 5, + PX4_SYSTEM_TYPE_GCS = 6, + PX4_SYSTEM_TYPE_AIRSHIP = 7, + PX4_SYSTEM_TYPE_FREE_BALLOON = 8, + PX4_SYSTEM_TYPE_ROCKET = 9, + PX4_SYSTEM_TYPE_GROUND_ROVER = 10, + PX4_SYSTEM_TYPE_SURFACE_BOAT = 11, + PX4_SYSTEM_TYPE_SUBMARINE = 12, + PX4_SYSTEM_TYPE_HEXAROTOR = 13, + PX4_SYSTEM_TYPE_OCTOROTOR = 14, + PX4_SYSTEM_TYPE_TRICOPTER = 15, + PX4_SYSTEM_TYPE_FLAPPING_WING = 16, + PX4_SYSTEM_TYPE_KITE = 17, + PX4_SYSTEM_TYPE_ONBOARD_CONTROLLER = 18, + PX4_SYSTEM_TYPE_VTOL_DUOROTOR = 19, + PX4_SYSTEM_TYPE_VTOL_QUADROTOR = 20, + PX4_SYSTEM_TYPE_VTOL_TILTROTOR = 21, + PX4_SYSTEM_TYPE_VTOL_RESERVED2 = 22, + PX4_SYSTEM_TYPE_VTOL_RESERVED3 = 23, + PX4_SYSTEM_TYPE_VTOL_RESERVED4 = 24, + PX4_SYSTEM_TYPE_VTOL_RESERVED5 = 25, + PX4_SYSTEM_TYPE_GIMBAL = 26, + PX4_SYSTEM_TYPE_ADSB = 27 +} PX4_SystemType_t; + +typedef enum +{ + PX4_VEHICLE_VTOL_STATE_UNDEFINED = 0, + PX4_VEHICLE_VTOL_STATE_TRANSITION_TO_FW = 1, + PX4_VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2, + PX4_VEHICLE_VTOL_STATE_MC = 3, + PX4_VEHICLE_VTOL_STATE_FW = 4 +} PX4_VehicleVtolState_t; + + +typedef enum +{ + PX4_SENSOR_ORIENTATION_NONE = 0, + PX4_SENSOR_ORIENTATION_YAW_45 = 1, + PX4_SENSOR_ORIENTATION_YAW_90 = 2, + PX4_SENSOR_ORIENTATION_YAW_135 = 3, + PX4_SENSOR_ORIENTATION_YAW_180 = 4, + PX4_SENSOR_ORIENTATION_YAW_225 = 5, + PX4_SENSOR_ORIENTATION_YAW_270 = 6, + PX4_SENSOR_ORIENTATION_YAW_315 = 7, + PX4_SENSOR_ORIENTATION_ROLL_180 = 8, + PX4_SENSOR_ORIENTATION_ROLL_180_YAW_45 = 9, + PX4_SENSOR_ORIENTATION_ROLL_180_YAW_90 = 10, + PX4_SENSOR_ORIENTATION_ROLL_180_YAW_135 = 11, + PX4_SENSOR_ORIENTATION_PITCH_180 = 12, + PX4_SENSOR_ORIENTATION_ROLL_180_YAW_225 = 13, + PX4_SENSOR_ORIENTATION_ROLL_180_YAW_270 = 14, + PX4_SENSOR_ORIENTATION_ROLL_180_YAW_315 = 15, + PX4_SENSOR_ORIENTATION_ROLL_90 = 16, + PX4_SENSOR_ORIENTATION_ROLL_90_YAW_45 = 17, + PX4_SENSOR_ORIENTATION_ROLL_90_YAW_90 = 18, + PX4_SENSOR_ORIENTATION_ROLL_90_YAW_135 = 19, + PX4_SENSOR_ORIENTATION_ROLL_270 = 20, + PX4_SENSOR_ORIENTATION_ROLL_270_YAW_45 = 21, + PX4_SENSOR_ORIENTATION_ROLL_270_YAW_90 = 22, + PX4_SENSOR_ORIENTATION_ROLL_270_YAW_135 = 23, + PX4_SENSOR_ORIENTATION_PITCH_90 = 24, + PX4_SENSOR_ORIENTATION_PITCH_270 = 25, + PX4_SENSOR_ORIENTATION_PITCH_180_YAW_90 = 26, + PX4_SENSOR_ORIENTATION_PITCH_180_YAW_270 = 27, + PX4_SENSOR_ORIENTATION_ROLL_90_PITCH_90 = 28, + PX4_SENSOR_ORIENTATION_ROLL_180_PITCH_90 = 29, + PX4_SENSOR_ORIENTATION_ROLL_270_PITCH_90 = 30, + PX4_SENSOR_ORIENTATION_ROLL_90_PITCH_180 = 31, + PX4_SENSOR_ORIENTATION_ROLL_270_PITCH_180 = 32, + PX4_SENSOR_ORIENTATION_ROLL_90_PITCH_270 = 33, + PX4_SENSOR_ORIENTATION_ROLL_180_PITCH_270 = 34, + PX4_SENSOR_ORIENTATION_ROLL_270_PITCH_270 = 35, + PX4_SENSOR_ORIENTATION_ROLL_90_PITCH_180_YAW_90 = 36, + PX4_SENSOR_ORIENTATION_ROLL_90_YAW_270 = 37, + PX4_SENSOR_ORIENTATION_ROLL_315_PITCH_315_YAW_315 = 39 +} PX4_SensorOrientation_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + boolean Armed; + boolean Prearmed; + boolean ReadyToArm; + boolean Lockdown; + boolean ManualLockdown; + boolean ForceFailsafe; + boolean InEscCalibrationMode; +} PX4_ActuatorArmedMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 SampleTime; + float Control[PX4_ACTUATOR_CONTROL_COUNT]; +} PX4_ActuatorControlsMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint32 Count; + float Output[PX4_ACTUATOR_OUTPUTS_MAX]; +} PX4_ActuatorOutputsMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float IndicatedAirspeed; /* m/s */ + float TrueAirspeed; /* m/s */ + float TrueAirspeedUnfiltered; /* m/s */ + float AirTemperature; /* Celsius */ + float Confidence; +} PX4_AirspeedMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float Voltage; /* V */ + float VoltageFiltered; /* V */ + float Current; /* A */ + float CurrentFiltered; /* A */ + float Discharged; /* mAh */ + float Remaining; + float Scale; + int32 CellCount; + boolean Connected; + PX4_BatteryWarningSeverity_t Warning; +} PX4_BatteryStatusMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + PX4_CommanderMainState_t MainState; +} PX4_CommanderStateMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float AccX; + float AccY; + float AccZ; + float VelX; + float VelY; + float VelZ; + float PosX; + float PosY; + float PosZ; + float Airspeed; + float VelVariance[3]; + float PosVariance[3]; + float Q[4]; + float DeltaQReset[4]; + float RollRate; + float PitchRate; + float YawRate; + float HorzAccMag; + float RollRateBias; + float PitchRateBias; + float YawRateBias; + boolean AirspeedValid; + uint8 QuatResetCounter; +} PX4_ControlStateMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 ErrorCount; + float DifferentialPressureRaw; + float DifferentialPressureFiltered; + float Temperature; +} PX4_DifferentialPressureMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float MinDistance; + float MaxDistance; + float CurrentDistance; + float Covariance; + PX4_DistanceSensorType_t Type : 8; + uint8 ID; + PX4_SensorOrientation_t Orientation : 8; +} PX4_DistanceSensorMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float States[PX4_ESTIMATOR_STATES_MAX]; + uint32 NumStates; + float Vibe[PX4_ESTIMATOR_VIBE_MAX]; + float Covariances[PX4_ESTIMATOR_COVARIANCES_MAX]; + uint16 GpsCheckFailFlags; + uint16 ControlModeFlags; + uint16 FilterFaultFlags; + uint8 NanFlags; + uint8 HealthFlags; + uint8 TimeoutFlags; +} PX4_EstimatorStatusMsg_t; + +typedef struct +{ + float Lat; + float Lon; +} PX4_FenceVertex_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint8 Len; + uint8 Flags; + char Data[PX4_GPS_INJECT_DATA_MAX]; +} PX4_GpsInjectDataMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + double Lat; + double Lon; + float Alt; + float X; + float Y; + float Z; + float Yaw; + float DirectionX; + float DirectionY; + float DirectionZ; +} PX4_HomePositionMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 LastSignal; + uint32 ChannelCount; + int32 RSSI; + uint16 RcLostFrameCount; + uint16 RcTotalFrameCount; + uint16 RcPpmFrameLength; + uint16 Values[PX4_RC_INPUT_MAX_CHANNELS]; + boolean RcFailsafe; + boolean RcLost; + PX4_RcInputSource_t InputSource; +} PX4_InputRcMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint8 Severity; + char Text[127]; +} PX4_LogMessageMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float X; + float Y; + float Z; + float R; + float Flaps; + float Aux1; + float Aux2; + float Aux3; + float Aux4; + float Aux5; + PX4_SwitchPos_t ModeSwitch; + PX4_SwitchPos_t ReturnSwitch; + PX4_SwitchPos_t RattitudeSwitch; + PX4_SwitchPos_t PosctlSwitch; + PX4_SwitchPos_t LoiterSwitch; + PX4_SwitchPos_t AcroSwitch; + PX4_SwitchPos_t OffboardSwitch; + PX4_SwitchPos_t KillSwitch; + PX4_SwitchPos_t TransitionSwitch; + PX4_SwitchPos_t GearSwitch; + PX4_SwitchPos_t ArmSwitch; + PX4_SwitchPos_t StabSwitch; + PX4_SwitchPos_t ManSwitch; + PX4_ModeSlot_t ModeSlot; + PX4_ManualControlDataSource_t DataSource; + PX4_SwitchPos_t AltctlSwitch; +} PX4_ManualControlSetpointMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float RollRateInteg; + float PitchRateInteg; + float YawRateInteg; +} PX4_McAttCtrlStatusMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + int32 DatamanID; + uint32 Count; + int32 CurrentSeq; +} PX4_MissionMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint32 InstanceCount; + uint32 SeqReached; + uint32 SeqCurrent; + uint32 SeqTotal; + uint32 ItemChangedIndex; + uint32 ItemDoJumpRemaining; + boolean Valid; + boolean Warning; + boolean Reached; + boolean Finished; + boolean Failure; + boolean StayInFailsafe; + boolean FlightTermination; + boolean ItemDoJumpChanged; +} PX4_MissionResultMsg_t; + + +typedef union +{ + struct + { + uint16 MotorPos : 1; // 0 - true when any motor has saturated in the positive direction + uint16 MotorNeg : 1; // 1 - true when any motor has saturated in the negative direction + uint16 RollPos : 1; // 2 - true when a positive roll demand change will increase saturation + uint16 RollNeg : 1; // 3 - true when a negative roll demand change will increase saturation + uint16 PitchPos : 1; // 4 - true when a positive pitch demand change will increase saturation + uint16 PitchNeg : 1; // 5 - true when a negative pitch demand change will increase saturation + uint16 YawPos : 1; // 6 - true when a positive yaw demand change will increase saturation + uint16 YawNeg : 1; // 7 - true when a negative yaw demand change will increase saturation + uint16 ThrustPos : 1; // 8 - true when a positive thrust demand change will increase saturation + uint16 ThrustNeg : 1; // 9 - true when a negative thrust demand change will increase saturation + } Flags; + uint16 Value; +} PX4_SaturationStatus_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + PX4_SaturationStatus_t SaturationStatus; +} PX4_MultirotorMotorLimitsMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float PixelFlowXIntegral; + float PixelFlowYIntegral; + float GyroXRateIntegral; + float GyroYRateIntegral; + float GyroZRateIntegral; + float GroundDistance; + uint32 IntegrationTimespan; + uint32 TimeSinceLastSonarUpdate; + uint16 FrameCountSinceLastReadout; + int16 GyroTemperature; + uint8 SensorID; + uint8 Quality; +} PX4_OpticalFlowMsg_t; + +typedef struct +{ + uint64 Timestamp; + double Lat; + double Lon; + float X; + float Y; + float Z; + float VX; + float VY; + float VZ; + float Alt; + float Yaw; + float Yawspeed; + float LoiterRadius; + float PitchMin; + float AX; + float AY; + float AZ; + float AcceptanceRadius; + float CruisingSpeed; + float CruisingThrottle; + boolean Valid; + PX4_SetpointType_t Type; + boolean PositionValid; + boolean VelocityValid; + uint8 VelocityFrame; + boolean AltValid; + boolean YawValid; + boolean DisableMcYawControl; + boolean YawspeedValid; + int8 LoiterDirection; + boolean AccelerationValid; + boolean AccelerationIsForce; +} PX4_PositionSetpoint_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + PX4_PositionSetpoint_t Previous; + PX4_PositionSetpoint_t Current; + PX4_PositionSetpoint_t Next; +} PX4_PositionSetpointTripletMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 TimestampLastValid; + float Channels[PX4_RC_INPUT_MAX_CHANNELS]; + uint32 FrameDropCount; + uint8 ChannelCount; + PX4_RcChannelFunction_t Function[PX4_RC_CHANNELS_FUNCTION_COUNT]; + uint8 RSSI; + boolean SignalLost; +} PX4_RcChannelsMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + boolean SafetySwitchAvailable; + boolean SafetyOff; +} PX4_SafetyMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint8 Count; + uint8 SVID[PX4_SAT_INFO_MAX_SATELLITES]; + uint8 Used[PX4_SAT_INFO_MAX_SATELLITES]; + uint8 Elevation[PX4_SAT_INFO_MAX_SATELLITES]; + uint8 Azimuth[PX4_SAT_INFO_MAX_SATELLITES]; + uint8 SNR[PX4_SAT_INFO_MAX_SATELLITES]; +} PX4_SatelliteInfoMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 IntegralDt; + uint64 ErrorCount; + float X; + float Y; + float Z; + float XIntegral; + float YIntegral; + float ZIntegral; + float Temperature; + float Range_m_s2; + float Scaling; + uint32 DeviceID; + int16 XRaw; + int16 YRaw; + int16 ZRaw; + int16 TemperatureRaw; +} PX4_SensorAccelMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint32 ErrorCount; + float Pressure; + float Altitude; + float Temperature; +} PX4_SensorBaroMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float GyroRad[3]; + float GyroIntegralDt; + uint64 AccTimestamp; + boolean AccInvalid; + float Acc[3]; + float AccIntegralDt; + uint64 MagTimestamp; + boolean MagInvalid; + float Mag[3]; + uint64 BaroTimestamp; + boolean BaroInvalid; + float BaroAlt; + float BaroTemp; +} PX4_SensorCombinedMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 IntegralDt; + uint64 ErrorCount; + float X; + float Y; + float Z; + float XIntegral; + float YIntegral; + float ZIntegral; + float Temperature; + float Range; + float Scaling; + uint32 DeviceID; + int16 XRaw; + int16 YRaw; + int16 ZRaw; + int16 TemperatureRaw; +} PX4_SensorGyroMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 ErrorCount; + float X; + float Y; + float Z; + float Range; + float Scaling; + float Temperature; + uint32 DeviceID; + int16 XRaw; + int16 YRaw; + int16 ZRaw; +} PX4_SensorMagMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + PX4_SubsystemType_t SubsystemType; + boolean Present; + boolean Enabled; + boolean Ok; +} PX4_SubsystemInfoMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 HeartbeatTime; + uint64 TelemTime; + uint16 RxErrors; + uint16 Fixed; + PX4_TelemetryStatusRadioType_t Type; + uint8 RSSI; + uint8 RemoteRSSI; + uint8 Noise; + uint8 RemoteNoise; + uint8 TxBuf; + uint8 SystemID; + uint8 ComponentID; +} PX4_TelemetryStatusMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float RollSpeed; + float PitchSpeed; + float YawSpeed; + float Q[4]; +} PX4_VehicleAttitudeMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float RollBody; + float PitchBody; + float YawBody; + float YawSpMoveRate; + float Q_D[4]; + boolean Q_D_Valid; + float Thrust; + boolean RollResetIntegral; + boolean PitchResetIntegral; + boolean YawResetIntegral; + boolean FwControlYaw; + boolean DisableMcYawControl; + boolean ApplyFlaps; + float LandingGear; +} PX4_VehicleAttitudeSetpointMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint16 Command; + PX4_VehicleCommandResult_t Result; +} PX4_VehicleCommandAckMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + double Param5; + double Param6; + float Param1; + float Param2; + float Param3; + float Param4; + float Param7; + PX4_VehicleCmd_t Command; + uint32 TargetSystem; + uint32 TargetComponent; + uint32 SourceSystem; + uint32 SourceComponent; + uint8 Confirmation; +} PX4_VehicleCommandMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + boolean Armed; + boolean ExternalManualOverrideOk; + boolean SystemHilEnabled; + boolean ControlManualEnabled; + boolean ControlAutoEnabled; + boolean ControlOffboardEnabled; + boolean ControlRatesEnabled; + boolean ControlAttitudeEnabled; + boolean ControlRattitudeEnabled; + boolean ControlForceEnabled; + boolean ControlAccelerationEnabled; + boolean ControlVelocityEnabled; + boolean ControlPositionEnabled; + boolean ControlAltitudeEnabled; + boolean ControlClimbRateEnabled; + boolean ControlTerminationEnabled; + boolean ControlFixedHdgEnabled; +} PX4_VehicleControlModeMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 TimeUtcUsec; + double Lat; + double Lon; + float Alt; + double DeltaLatLon[2]; + float DeltaAlt; + uint8 LatLonResetCounter; + uint8 AltResetCounter; + float VelN; + float VelE; + float VelD; + float Yaw; + float EpH; + float EpV; + float EvH; + float EvV; + float TerrainAlt; + float PressureAlt; + boolean TerrainAltValid; + boolean DeadReckoning; +} PX4_VehicleGlobalPositionMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float VX; + float VY; + float VZ; +} PX4_VehicleGlobalVelocitySetpointMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 TimeUtcUsec; + int32 Lat; + int32 Lon; + int32 Alt; + int32 AltEllipsoid; + float SVariance; + float CVariance; + float EpH; + float EpV; + float HDOP; + float VDOP; + int32 NoisePerMs; + int32 JammingIndicator; + float Vel_m_s; + float Vel_n_m_s; + float Vel_e_m_s; + float Vel_d_m_s; + float COG; + int32 TimestampTimeRelative; + PX4_GpsFixType_t FixType; + boolean VelNedValid; + uint8 SatellitesUsed; +} PX4_VehicleGpsPositionMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float AltMax; + boolean Landed; + boolean Freefall; + boolean GroundContact; +} PX4_VehicleLandDetectedMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint64 RefTimestamp; + double RefLat; + double RefLon; + uint64 SurfaceBottomTimestamp; + float X; + float Y; + float Z; + float Delta_XY[2]; + float Delta_Z; + float VX; + float VY; + float VZ; + float Delta_VXY[2]; + float Delta_VZ; + float AX; + float AY; + float AZ; + float Yaw; + float RefAlt; + float DistBottom; + float DistBottomRate; + float EpH; + float EpV; + float EvH; + float EvV; + uint8 EstimatorType; + boolean XY_Valid; + boolean Z_Valid; + boolean V_XY_Valid; + boolean V_Z_Valid; + uint8 XY_ResetCounter; + uint8 Z_ResetCounter; + uint8 VXY_ResetCounter; + uint8 VZ_ResetCounter; + boolean XY_Global; + boolean Z_Global; + boolean DistBottomValid; +} PX4_VehicleLocalPositionMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float X; + float Y; + float Z; + float Yaw; + float VX; + float VY; + float VZ; + float AccX; + float AccY; + float AccZ; +} PX4_VehicleLocalPositionSetpointMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float Roll; + float Pitch; + float Yaw; + float Thrust; +} PX4_VehicleRatesSetpointMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint32 SystemID; + uint32 ComponentID; + uint32 OnboardControlSensorsPresent; + uint32 OnboardControlSensorsEnabled; + uint32 OnboardControlSensorsHealth; + PX4_NavigationState_t NavState; + PX4_ArmingState_t ArmingState; + PX4_HilState_t HilState; + boolean Failsafe; + PX4_SystemType_t SystemType; + boolean IsRotaryWing; + boolean IsVtol; + boolean VtolFwPermanentStab; + boolean InTransitionMode; + boolean RcSignalLost; + PX4_RcInMode_t RcInputMode; + boolean DataLinkLost; + uint8 DataLinkLostCounter; + boolean EngineFailure; + boolean EngineFailureCmd; + boolean MissionFailure; +} PX4_VehicleStatusMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + float gyro_offset_0[3]; + float gyro_scale_0[3]; + float gyro_offset_1[3]; + float gyro_scale_1[3]; + float gyro_offset_2[3]; + float gyro_scale_2[3]; + float accel_offset_0[3]; + float accel_scale_0[3]; + float accel_offset_1[3]; + float accel_scale_1[3]; + float accel_offset_2[3]; + float accel_scale_2[3]; + float baro_offset_0; + float baro_scale_0; + float baro_offset_1; + float baro_scale_1; + float baro_offset_2; + float baro_scale_2; + uint8 selected_gyro_instance; + uint8 selected_accel_instance; + uint8 selected_baro_instance; + uint8 gyro_mapping[3]; + uint8 accel_mapping[3]; + uint8 baro_mapping[3]; +} PX4_SensorCorrectionMsg_t; + + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint8 LedMask; + uint8 Color; + uint8 Mode; + uint8 NumBlinks; + uint8 Priority; +} PX4_LedControlMsg_t; + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint64 Timestamp; + uint8 Frame[4096]; +} PX4_OpticalFlowFrameMsg_t; + + +#endif + + diff --git a/core/base/tools/commander/workspace_template/bin/wh_defs.yaml b/core/base/tools/commander/workspace_template/bin/wh_defs.yaml index a0aab5d98..b821ea341 100644 --- a/core/base/tools/commander/workspace_template/bin/wh_defs.yaml +++ b/core/base/tools/commander/workspace_template/bin/wh_defs.yaml @@ -1616,9 +1616,9 @@ modules: CFE_TIME_1HZ_TASK_FLAGS: name: CFE_TIME_1HZ_TASK_FLAGS value: OS_ENABLE_CORE_0 - definition: /home/mbenson/git/airliner/core/cfe/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/core/base/cfe/wh_design.yaml elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/airliner + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/airliner cf: short_name: cf long_name: CFDP File Delivery @@ -2417,9 +2417,9 @@ modules: CF_MISSION_REV: name: CF_MISSION_REV value: 0 - definition: /home/mbenson/git/airliner/apps/cf/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/cf/wh_design.yaml elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/CF.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/CF.so ci: short_name: ci long_name: Command Ingest @@ -2619,9 +2619,116 @@ modules: CI_CMD_MAX_TIMEOUT: name: CI_CMD_MAX_TIMEOUT value: 20 - definition: /home/mbenson/git/airliner/apps/ci/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ci/wh_design.yaml elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/CI.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/CI.so + fac: + short_name: fac + long_name: Fixedwing Attitude Control Application + events: + FAC_RESERVED_EID: + id: 0 + FAC_INF_EID: + id: 1 + FAC_INIT_INF_EID: + id: 2 + FAC_CONFIG_TABLE_INF_EID: + id: 3 + FAC_CDS_INF_EID: + id: 4 + FAC_CMD_INF_EID: + id: 5 + FAC_ERR_EID: + id: 6 + FAC_INIT_ERR_EID: + id: 7 + FAC_CONFIG_TABLE_ERR_EID: + id: 8 + FAC_CDS_ERR_EID: + id: 9 + FAC_CMD_ERR_EID: + id: 10 + FAC_PIPE_ERR_EID: + id: 11 + FAC_MSGID_ERR_EID: + id: 12 + FAC_MSGLEN_ERR_EID: + id: 13 + telemetry: + FAC_HK_TLM_MID: + msgID: + struct: FAC_HkTlm_t + commands: + FAC_CMD_MID: + msgID: + commands: + Noop: + cc: 0 + struct: FAC_NoArgCmd_t + Reset: + cc: 1 + struct: FAC_NoArgCmd_t + FAC_SEND_HK_MID: + msgID: + commands: + SendHK: + cc: 0 + struct: FAC_NoArgCmd_t + FAC_WAKEUP_MID: + msgID: + commands: + WakeUp: + cc: 0 + struct: FAC_NoArgCmd_t + perfids: + FAC_MAIN_TASK_PERF_ID: + id: + config: + FAC_SB_TIMEOUT: + name: FAC_SB_TIMEOUT + value: CFE_SB_PEND_FOREVER + FAC_MISSION_REV: + name: FAC_MISSION_REV + value: 0 + FAC_SCH_PIPE_DEPTH: + name: FAC_SCH_PIPE_DEPTH + value: 2 + FAC_SCH_PIPE_NAME: + name: FAC_SCH_PIPE_NAME + value: FAC_SCH_PIPE + FAC_SCH_PIPE_PEND_TIME: + name: FAC_SCH_PIPE_PEND_TIME + value: 2000 + FAC_SCH_PIPE_WAKEUP_RESERVED: + name: FAC_SCH_PIPE_WAKEUP_RESERVED + value: 1 + FAC_SCH_PIPE_SEND_HK_RESERVED: + name: FAC_SCH_PIPE_SEND_HK_RESERVED + value: 1 + FAC_CMD_PIPE_DEPTH: + name: FAC_CMD_PIPE_DEPTH + value: 4 + FAC_CMD_PIPE_NAME: + name: FAC_CMD_PIPE_NAME + value: FAC_CMD_PIPE + FAC_DATA_PIPE_DEPTH: + name: FAC_DATA_PIPE_DEPTH + value: 5 + FAC_DATA_PIPE_NAME: + name: FAC_DATA_PIPE_NAME + value: FAC_DATA_PIPE + FAC_CONFIG_TABLE_FILENAME: + name: FAC_CONFIG_TABLE_FILENAME + value: /cf/apps/fac_config.tbl + FAC_STARTUP_TIMEOUT_MSEC: + name: FAC_STARTUP_TIMEOUT_MSEC + value: 1000 + FAC_CUSTOM_DEV_PATH: + name: FAC_CUSTOM_DEV_PATH + value: /tmp/ttyS0 + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/fac/wh_design.yaml + elf_files: + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/FAC.so sch: short_name: sch long_name: Scheduler @@ -2845,9 +2952,9 @@ modules: SCH_AD_CHILD_TASK_FLAGS: name: SCH_AD_CHILD_TASK_FLAGS value: OS_ENABLE_CORE_0 - definition: /home/mbenson/git/airliner/apps/sch/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/sch/wh_design.yaml elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/SCH.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/SCH.so to: short_name: to long_name: Telemetry Output @@ -3069,9 +3176,9 @@ modules: TO_MAX_PROTOBUF_ENC_LEN: name: TO_MAX_PROTOBUF_ENC_LEN value: 5000 - definition: /home/mbenson/git/airliner/apps/to/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/to/wh_design.yaml elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/TO.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/TO.so ak8963: short_name: ak8963 long_name: TBD @@ -3209,7 +3316,7 @@ modules: AK8963_MAG_UNIT: name: AK8963_MAG_UNIT value: 1.0f - definition: /home/mbenson/git/airliner/apps/ak8963/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ak8963/wh_design.yaml amc: short_name: amc long_name: Actuator Motor Control @@ -3355,7 +3462,7 @@ modules: AMC_MAX_PARAMS: name: AMC_MAX_PARAMS value: 3 - definition: /home/mbenson/git/airliner/apps/amc/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/amc/wh_design.yaml bat: short_name: bat long_name: Battery Manager @@ -3467,7 +3574,7 @@ modules: BAT_STARTUP_TIMEOUT_MSEC: name: BAT_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/bat/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/bat/wh_design.yaml ea: short_name: ea long_name: External Application @@ -3594,7 +3701,7 @@ modules: EA_MAX_PATH_LEN: name: EA_MAX_PATH_LEN value: 96 - definition: /home/mbenson/git/airliner/apps/ea/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ea/wh_design.yaml gps: short_name: gps long_name: GPS Driver @@ -3707,7 +3814,7 @@ modules: GPS_STARTUP_TIMEOUT_MSEC: name: GPS_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/gps/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/gps/wh_design.yaml hmc5883: short_name: hmc5883 long_name: @@ -3846,7 +3953,7 @@ modules: HMC5883_CALC_MAG_RANGE: name: HMC5883_CALC_MAG_RANGE value: 1.3 - definition: /home/mbenson/git/airliner/apps/hmc5883/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/hmc5883/wh_design.yaml ld: short_name: ld long_name: Landing Determination @@ -3958,7 +4065,7 @@ modules: LD_STARTUP_TIMEOUT_MSEC: name: LD_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/ld/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ld/wh_design.yaml lgc: short_name: lgc long_name: Landing Gear Control @@ -4070,7 +4177,7 @@ modules: LGC_MAX_GEAR_OUTPUTS: name: LGC_MAX_GEAR_OUTPUTS value: 1 - definition: /home/mbenson/git/airliner/apps/lgc/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/lgc/wh_design.yaml mac: short_name: mac long_name: Multicopter Attitude Controller @@ -4165,7 +4272,7 @@ modules: MAC_STARTUP_TIMEOUT_MSEC: name: MAC_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/mac/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/mac/wh_design.yaml mpc: short_name: mpc long_name: Multicopter Position Controller @@ -4302,7 +4409,7 @@ modules: DIRECTION_CHANGE_TRIGGER_TIME_US: name: DIRECTION_CHANGE_TRIGGER_TIME_US value: 100000 - definition: /home/mbenson/git/airliner/apps/mpc/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/mpc/wh_design.yaml mpu6050: short_name: mpu6050 long_name: @@ -4479,7 +4586,7 @@ modules: MPU6050_TEMP_SENS: name: MPU6050_TEMP_SENS value: 340 - definition: /home/mbenson/git/airliner/apps/mpu6050/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/mpu6050/wh_design.yaml mpu9250: short_name: mpu9250 long_name: @@ -4658,7 +4765,7 @@ modules: MPU9250_TEMP_SENS: name: MPU9250_TEMP_SENS value: 361 - definition: /home/mbenson/git/airliner/apps/mpu9250/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/mpu9250/wh_design.yaml ms5607: short_name: ms5607 long_name: @@ -4782,7 +4889,7 @@ modules: MS5607_PRESS_TEMP_MEAS_RATIO: name: MS5607_PRESS_TEMP_MEAS_RATIO value: 3 - definition: /home/mbenson/git/airliner/apps/ms5607/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ms5607/wh_design.yaml ms5611: short_name: ms5611 long_name: @@ -4897,7 +5004,7 @@ modules: MS5611_PRESS_TEMP_MEAS_RATIO: name: MS5611_PRESS_TEMP_MEAS_RATIO value: 3 - definition: /home/mbenson/git/airliner/apps/ms5611/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ms5611/wh_design.yaml nav: short_name: nav long_name: Navigation @@ -5022,7 +5129,7 @@ modules: NAV_STARTUP_TIMEOUT_MSEC: name: NAV_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/nav/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/nav/wh_design.yaml pe: short_name: pe long_name: Position Estimator @@ -5290,7 +5397,7 @@ modules: FLOW_GYRO_HP_CUTOFF: name: FLOW_GYRO_HP_CUTOFF value: 0.001 - definition: /home/mbenson/git/airliner/apps/pe/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/pe/wh_design.yaml qae: short_name: qae long_name: Attitude Estimator @@ -5407,7 +5514,7 @@ modules: AE_STARTUP_TIMEOUT_MSEC: name: AE_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/qae/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/qae/wh_design.yaml rcin: short_name: rcin long_name: Radio Control Input @@ -5518,7 +5625,7 @@ modules: RCIN_MAX_EVENT_FILTERS: name: RCIN_MAX_EVENT_FILTERS value: 32 - definition: /home/mbenson/git/airliner/apps/rcin/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/rcin/wh_design.yaml rgbled: short_name: rgbled long_name: RGB LED Control @@ -5622,7 +5729,7 @@ modules: RGBLED_STARTUP_TIMEOUT_MSEC: name: RGBLED_STARTUP_TIMEOUT_MSEC value: 1000 - definition: /home/mbenson/git/airliner/apps/rgbled/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/rgbled/wh_design.yaml sc: short_name: sc long_name: Stored Command @@ -5991,9 +6098,9 @@ modules: SC_MISSION_REV: name: SC_MISSION_REV value: 0 - definition: /home/mbenson/git/airliner/apps/sc/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/sc/wh_design.yaml elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/SC.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/SC.so sens: short_name: sens long_name: Sensor Application @@ -6106,7 +6213,7 @@ modules: SENS_MAX_BARO_TIME_DELTA: name: SENS_MAX_BARO_TIME_DELTA value: 100 - definition: /home/mbenson/git/airliner/apps/sens/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/sens/wh_design.yaml sonar: short_name: sonar long_name: Sonar Driver @@ -6227,7 +6334,7 @@ modules: SONAR_MAX_DISTANCE: name: SONAR_MAX_DISTANCE value: 8.5 - definition: /home/mbenson/git/airliner/apps/sonar/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/sonar/wh_design.yaml ulr: short_name: ulr long_name: uLanding Radar Driver @@ -6353,7 +6460,7 @@ modules: ULR_MUTEX_NAME: name: ULR_MUTEX_NAME value: ULR_MUTEX - definition: /home/mbenson/git/airliner/apps/ulr/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/ulr/wh_design.yaml vc: short_name: vc long_name: Video Control @@ -6548,7 +6655,7 @@ modules: VC_BUFFER_TIMEOUTS_ALLOWED: name: VC_BUFFER_TIMEOUTS_ALLOWED value: 2 - definition: /home/mbenson/git/airliner/apps/vc/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/vc/wh_design.yaml vm: short_name: vm long_name: Vehicle Manager @@ -6800,31 +6907,31 @@ modules: VM_MINIMUM_VALID_BATTERY_VOLTAGE: name: VM_MINIMUM_VALID_BATTERY_VOLTAGE value: 2 - definition: /home/mbenson/git/airliner/apps/vm/wh_design.yaml + definition: /home/young/data/git/squeaky-weasel/software/airliner/public/apps/vm/wh_design.yaml cfs_lib: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/CFS_LIB.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/CFS_LIB.so cs: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/CS.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/CS.so ds: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/DS.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/DS.so fm: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/FM.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/FM.so hk: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/HK.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/HK.so hs: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/HS.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/HS.so lc: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/LC.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/LC.so md: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/MD.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/MD.so mm: elf_files: - - /home/mbenson/git/airliner/build/tutorial/cfs/target/target/exe/cf/apps/MM.so + - /home/young/data/git/squeaky-weasel/software/airliner/public/build/obc/fixedwing/ppd/sitl/target/target/exe/cf/apps/MM.so