-
Notifications
You must be signed in to change notification settings - Fork 0
obc: add framework for modes of operation #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
angelazheng96
wants to merge
20
commits into
main
Choose a base branch
from
mission-ops-moos
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6a4a37a
obc: mission ops: add common modules and modes
angelazheng96 e358443
obc: mission ops: add idle mode of operation
angelazheng96 3d5b6f0
obc: mission ops: add imaging mode of operation
angelazheng96 7399d04
obc: mission ops: add downlinking mode of operation
angelazheng96 ea5c450
obc: mission ops: add safety mode of operation
angelazheng96 3ad7a13
obc: mission ops: add firmware update mode of operation
angelazheng96 298264e
obc: mission ops: remove main file
angelazheng96 8b81fbe
obc: mission ops: allow both obc and pay update
angelazheng96 6dbaa95
obc: mission ops: add finch prefix to common module
angelazheng96 86f6c3e
obc: mission ops: add prefixes to downlinking functions
angelazheng96 82b3220
obc: mission ops: reinstate main file
angelazheng96 75bfaf3
obc: mission ops: set placeholder types to uint8_t*
angelazheng96 29eb160
obc: mission ops: label downlinking and error data as constant
angelazheng96 e9f9095
obc: mission ops: remove multiple log module registrations
angelazheng96 d47d8b2
obc: mission ops: add error handling to downlinking function
angelazheng96 b77a2b9
obc: adding init
jpmedinagl 99c2322
obc: mission ops: update adcs in firmware update
angelazheng96 8e602ac
obc: adding idle schedule
jpmedinagl 3ca5eb1
Merge branch 'mission-ops-moos' of https://github.com/utat-ss/finch-f…
jpmedinagl 2f1d9ee
obc: draft: implement command handling functions
angelazheng96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * @file common.c | ||
| * @brief Source for Definitions Common Across Modules | ||
| */ | ||
|
|
||
| #include "common.h" | ||
| #include <stdbool.h> | ||
| #include <zephyr/logging/log.h> | ||
|
|
||
| LOG_MODULE_REGISTER(finch_common); | ||
|
|
||
| /** | ||
| * @brief Enter specified ADCS control mode | ||
| */ | ||
| void cmd_adcs_mode(mode_adcs mode, uint8_t* orbit_info, float current_time, uint8_t* tle) | ||
| { | ||
| switch (mode) { | ||
| case MODE_ADCS_SAFE: | ||
| LOG_INF("Setting ADCS to Safe mode"); | ||
| // Setting ADCS to Safe mode | ||
| break; | ||
|
|
||
| case MODE_ADCS_DETUMBLING: | ||
| LOG_INF("Setting ADCS to Detumbling mode"); | ||
| // Set ADCS to Detumbling mode | ||
| break; | ||
|
|
||
| case MODE_ADCS_SUN_POINTING: | ||
| LOG_INF("Setting ADCS to Sun Pointing mode"); | ||
| // Set ADCS to Sun Pointing mode | ||
| break; | ||
|
|
||
| case MODE_ADCS_FINE_POINTING: | ||
| LOG_INF("Setting ADCS to Fine Pointing mode"); | ||
| // Set ADCS to Fine Pointing mode | ||
| break; | ||
|
|
||
| case MODE_ADCS_LVLH: | ||
| LOG_INF("Setting ADCS to LVLH mode"); | ||
| // Set ADCS to LVLH mode | ||
| break; | ||
|
|
||
| case MODE_ADCS_TRACKING: | ||
| LOG_INF("Setting ADCS to Tracking mode"); | ||
| // Set ADCS to Tracking mode | ||
| break; | ||
|
|
||
| case MODE_ADCS_OFF: | ||
| LOG_INF("Setting ADCS to Off mode"); | ||
| // Set ADCS to Off mode | ||
| break; | ||
|
|
||
| default: | ||
| LOG_WRN("Unknown ADCS control mode"); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @brief Enter specified PAY control mode | ||
| */ | ||
| void cmd_pay_mode(mode_pay mode) | ||
| { | ||
| switch (mode) { | ||
| case MODE_PAY_OFF: | ||
| LOG_INF("Setting PAY to Off mode"); | ||
| // Set PAY to Off mode | ||
| break; | ||
|
|
||
| case MODE_PAY_ON: | ||
| LOG_INF("Setting PAY to On mode"); | ||
| // Set PAY to On mode | ||
| break; | ||
|
|
||
| default: | ||
| LOG_WRN("Unknown PAY control mode"); | ||
| break; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * @file common.h | ||
| * @brief Header for Definitions Common Across Modules | ||
| */ | ||
|
|
||
| #ifndef FINCH_COMMON_H | ||
| #define FINCH_COMMON_H | ||
|
|
||
| /** | ||
| * @brief System modules | ||
| */ | ||
| typedef enum system_module { | ||
| MODULE_OPERATOR, | ||
| MODULE_MCC_GS, | ||
| MODULE_RF, | ||
| MODULE_OBC, | ||
| MODULE_ADCS, | ||
| MODULE_PAY | ||
| } system_module; | ||
|
|
||
| /** | ||
| * @brief Modes of operation | ||
| */ | ||
| typedef enum mode_op { | ||
| MODE_OP_IDLE, | ||
| MODE_OP_IMAGING, | ||
| MODE_OP_DOWNLINKING, | ||
| MODE_OP_SAFETY, | ||
| MODE_OP_FIRMWARE_UPDATE | ||
| } mode_op; | ||
|
|
||
| /** | ||
| * @brief ADCS control modes | ||
| */ | ||
| typedef enum mode_adcs { | ||
| MODE_ADCS_SAFE, | ||
| MODE_ADCS_DETUMBLING, | ||
| MODE_ADCS_SUN_POINTING, | ||
| MODE_ADCS_FINE_POINTING, | ||
| MODE_ADCS_LVLH, | ||
| MODE_ADCS_TRACKING, | ||
| MODE_ADCS_OFF | ||
| } mode_adcs; | ||
|
|
||
| /** | ||
| * @brief PAY control mode | ||
| */ | ||
| typedef enum mode_pay { | ||
| MODE_PAY_OFF, | ||
| MODE_PAY_ON | ||
| } mode_pay; | ||
|
|
||
| /** | ||
| * @brief Enter specified mode of operation | ||
| */ | ||
| // void enter_mode_op(mode_op mode); | ||
|
|
||
| /** | ||
| * @brief Enter specified ADCS control mode | ||
| */ | ||
| void cmd_adcs_mode(mode_adcs mode, uint8_t* orbit_info, float current_time, uint8_t* tle); | ||
|
|
||
| /** | ||
| * @brief Enter specified PAY control mode | ||
| */ | ||
| void cmd_pay_mode(mode_pay mode); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * @file downlinking.c | ||
| * @brief Downlinking Command Sequence Implementation | ||
| */ | ||
|
|
||
| #include "common.h" | ||
| #include "downlinking.h" | ||
| #include <stdbool.h> | ||
| #include <zephyr/logging/log.h> | ||
|
|
||
| LOG_MODULE_REGISTER(downlinking); | ||
|
|
||
| /** | ||
| * @brief Main loop for Downlinking command sequence | ||
| */ | ||
| mode_op downlinking_command_sequence(void) | ||
| { | ||
| cmd_adcs_mode(MODE_ADCS_FINE_POINTING, 0, 0.0, 0); // Placeholder values for orbit_info, current_time and tle | ||
|
|
||
| downlink_type dl_type = downlinking_prepare_rf(); | ||
| uint8_t* downlink_data; | ||
|
|
||
| if (dl_type == DOWNLINK_TELEMETRY) | ||
| { | ||
| downlink_data = downlinking_get_telemetry_data(); | ||
| } | ||
|
|
||
| else if (dl_type == DOWNLINK_IMAGE) | ||
| { | ||
| downlink_data = downlinking_get_image_data(); | ||
| } | ||
|
|
||
| int ret = downlinking_downlink_rf(downlink_data); | ||
|
|
||
| // Error handling - to be implemented | ||
| if (ret < 0) | ||
| { | ||
| return ret; | ||
| } | ||
|
|
||
| return MODE_OP_IDLE; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Prepare RF for downlinking | ||
| */ | ||
| downlink_type downlinking_prepare_rf(void) | ||
| { | ||
| // Implement RF downlink preparation | ||
| // Return type of downlinking | ||
| return NULL; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Get telemetry data for downlinking | ||
| */ | ||
| uint8_t* downlinking_get_telemetry_data(void) | ||
| { | ||
| // Get telemetry data | ||
| return NULL; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Get image data for downlinking | ||
| */ | ||
| uint8_t* downlinking_get_image_data(void) | ||
| { | ||
| // Get image data | ||
| return NULL; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Downlink data to RF | ||
| */ | ||
| int downlinking_downlink_rf(const uint8_t* downlink_data) | ||
| { | ||
| // Implement downlinking data to RF | ||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * @file downlinking.h | ||
| * @brief Header for Downlinking Command Sequence Implementation | ||
| */ | ||
|
|
||
| #ifndef DOWNLINKING_H | ||
| #define DOWNLINKING_H | ||
|
|
||
| #include "common.h" | ||
|
|
||
| /** | ||
| * @brief Downlink types | ||
| */ | ||
| typedef enum downlink_type { | ||
| DOWNLINK_TELEMETRY, | ||
| DOWNLINK_IMAGE | ||
| } downlink_type; | ||
|
|
||
| /** | ||
| * @brief Main loop for Downlinking command sequence | ||
| */ | ||
| mode_op downlinking_command_sequence(void); | ||
|
|
||
| /** | ||
| * @brief Prepare RF for downlinking | ||
| */ | ||
| downlink_type downlinking_prepare_rf(void); | ||
|
|
||
| /** | ||
| * @brief Get telemetry data for downlinking | ||
| */ | ||
| uint8_t* downlinking_get_telemetry_data(void); | ||
|
|
||
| /** | ||
| * @brief Get image data for downlinking | ||
| */ | ||
| uint8_t* downlinking_get_image_data(void); | ||
|
|
||
| /** | ||
| * @brief Downlink data to RF | ||
| */ | ||
| int downlinking_downlink_rf(const uint8_t* downlink_data); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /* | ||
| * Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * @file firmware-update.c | ||
| * @brief Firmware Update Command Sequence Implementation | ||
| */ | ||
|
|
||
| #include "common.h" | ||
| #include "firmware-update.h" | ||
| #include <stdbool.h> | ||
| #include <zephyr/logging/log.h> | ||
|
|
||
| LOG_MODULE_REGISTER(firmware_update); | ||
|
|
||
| /** | ||
| * @brief Main loop for Firmware Update command sequence | ||
| */ | ||
| mode_op firmware_update_command_sequence(void) | ||
| { | ||
| // RUN BELOW IN PARALLEL | ||
|
|
||
| // Parallel block 1 | ||
| cmd_adcs_mode(MODE_ADCS_FINE_POINTING, 0, 0.0, 0); // Placeholder values for orbit_info, current_time and tle | ||
|
|
||
| // Parallel block 2 | ||
| if (cmd_obc_available_update()) | ||
| { | ||
| cmd_obc_update(); | ||
| // Transmit update feedback to RF | ||
| } | ||
|
|
||
| if (cmd_pay_available_update()) | ||
| { | ||
| cmd_pay_update(); | ||
| // Transmit update feedback to RF | ||
| } | ||
|
|
||
| // END PARALLEL | ||
|
|
||
| return MODE_OP_IDLE; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Polls for available OBC firmware upate | ||
| */ | ||
| int cmd_obc_available_update(void) | ||
| { | ||
| // Implement check for OBC firmware update | ||
| return 0; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Polls for available PAY firmware upate | ||
| */ | ||
| int cmd_pay_available_update(void) | ||
| { | ||
| // Implement check for PAY firmware update | ||
| return 0; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Executes OBC firmware update | ||
| */ | ||
| int cmd_obc_update(void) | ||
| { | ||
| // Implement OBC firmware update | ||
| return 0; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Executes PAY firmware update | ||
| */ | ||
| int cmd_pay_update(void) | ||
| { | ||
| // Implement PAY firmware update | ||
| return 0; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.