Merge branch 'main' into soc-calculator
This commit is contained in:
commit
56fb2c0e1e
245
CHANGELOG.md
245
CHANGELOG.md
@ -16,22 +16,240 @@ will consitute of a breaking change warranting a new major release:
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v4.0.0] to be released
|
||||
## Changed
|
||||
|
||||
- eive-tmtc: v4.0.0 (to be released)
|
||||
TODO: New firmware package version.
|
||||
- STR missed reply handling is now moved to DHB rather than the COM interface. The COM IF will
|
||||
still trigger an event if a reply is taking too long, and FDIR should still work via reply
|
||||
timeouts.
|
||||
- Re-ordered some functions of the core controller in the initialize function.
|
||||
- Rad sensor is now only polled every 30 minutes instead of every device cycle to reduce wear of
|
||||
the RADFET electronics.
|
||||
|
||||
## Added
|
||||
|
||||
- 5 ms delay after pulling RADFET enable pin high before starting
|
||||
the ADC conversion.
|
||||
- Set STR time in configuration sequence to firmware mode.
|
||||
- The STR `AutoThreshold` parameters are now set from the configuration JSON file at STR
|
||||
startup.
|
||||
- The STR handler can now handle the COM error reply and triggers an low severity event accordingly.
|
||||
- Add SCEX handler for EM.
|
||||
- Radiation sensor handler dummy for the EM.
|
||||
- Added event for SD card information in core controller initialize function. This event will also
|
||||
be triggered after the SD state machine has run, so the event will generally be triggered twice
|
||||
at system boot, and once after commanding SD card switches.
|
||||
|
||||
## Fixed
|
||||
|
||||
- CFDP low level protocol bugfix. Requires fsfw update and tmtc update.
|
||||
- SUS dummy handler went to `MODE_NORMAL` for ON commands.
|
||||
- PL PCDU dummy went to `MODE_NORMAL` for ON commands.
|
||||
|
||||
# [v6.1.0] 2023-07-13
|
||||
|
||||
- `eive-tmtc`: v5.2.0
|
||||
|
||||
## Changed
|
||||
|
||||
- TCS: Remove OBC IF board thermal module, which is exactly identical to OBC module and therefore
|
||||
obsolete.
|
||||
- Swapped PL and PS I2C, BPX battery and MGT are connected to PS I2C now for firmware versions
|
||||
equal or above v4. However, this software version is compatible to both v3 and v4 of the firmware.
|
||||
- The firmware version variables are global statics inititalized early during the program
|
||||
runtime now. This makes it possible to check the firmware version earlier.
|
||||
- The TCS controller will now always command heaters OFF when being blind for thermal
|
||||
components (no sensors available), irrespective of current switch state.
|
||||
- Make OBSW compatible to prospective FW version v5.0.0, where the Q7 I2C devices were
|
||||
moved to a PL I2C block and the TMP sensor devices were moved to the PS I2C0.
|
||||
- Made `Xadc` code a little bit more robust against errors.
|
||||
|
||||
## Fixed
|
||||
|
||||
- TMP1075: Set dataset invalid on shutdown explicitely
|
||||
- Small fixes for TMP1075 FDIR: Use strange and missed reply counters.
|
||||
- TCS controller: Last heater (S-band heater) was skipped for transition completion
|
||||
checks.
|
||||
- TCS controller: A helper member to track the elapsed heater control cycles was not reset
|
||||
properly, which could lead to switch transitions being completed immediately. This can
|
||||
lead to weird bugs like heaters being commanded ON twice and can potentially lead to
|
||||
other bugs.
|
||||
- TMP1075: Devices did not go to OFF mode when being set faulty.
|
||||
- Update PL PCDU 1 in TCS mode tree on the EM.
|
||||
- TMP1075: Possibly ignored health commands.
|
||||
- Bugfix in FSFW where certain packet types could only be sent with source data fields with a
|
||||
maximum size of 255 bytes.
|
||||
- TCS CTRL: Limit number of heater handler messages sent in case there are not sensors available
|
||||
anymore.
|
||||
- Fix to allow adding real STR device for EM.
|
||||
|
||||
# Added
|
||||
|
||||
- Two events for heaters being commanded ON and OFF by the TCS controller
|
||||
- Upper limit for burn time of TCS heaters. Currently set to 1 hour for each heater.
|
||||
This mechanism will only track the burn time for heaters which were commanded by the
|
||||
TCS controller.
|
||||
- TCS controller is now observable by introducing a new HK dataset which exposes some internal
|
||||
fields related to TCS control.
|
||||
|
||||
# [v6.0.0] 2023-07-02
|
||||
|
||||
- `q7s-package` version v3.2.0
|
||||
- Important bugfixes for PTME. See `q7s-package` CHANGELOG.
|
||||
|
||||
## Changed
|
||||
|
||||
- Added back PTME busy bit polling. This is necessary due to changes to the AXI APB interface
|
||||
to the PTME core.
|
||||
|
||||
## Fixed
|
||||
|
||||
- For the live channel (VC0), telemetry was still only dumped if the transmitter is active.
|
||||
Please note that this fix will lead to crashes for FW versions below v3.2.
|
||||
However, it might not be an issue for the oldest firmware on the satellite (v2.5.1).
|
||||
|
||||
# [v5.2.0] 2023-07-02
|
||||
|
||||
## Fixed
|
||||
|
||||
- The firmware information event was not triggered even when possible because of an ordering
|
||||
bug in the initializer function.
|
||||
- Empty dumps (no TM in time range) will now correctly be completed immediately
|
||||
|
||||
## Changed
|
||||
|
||||
- PTME was always reset on submode changes. The reset will now only be performed if the actual data
|
||||
rate changes.
|
||||
- Add back ACS board code for the EM. Now that the radiation sensor was removed, the image switching
|
||||
issue has disappeared and adding back the ACS board is worth it for the GPS timekeeping.
|
||||
|
||||
# [v5.1.0] 2023-06-28
|
||||
|
||||
- `eive-tmtc` version v5.1.0
|
||||
|
||||
## Changed
|
||||
|
||||
- Persistent TM store dumps are now performed in chronological order.
|
||||
- Increase Syrlinks RX HK rate to 5.0 seconds during a pass.
|
||||
- Various robustness improvements for the heater handler. The heater handler will now only
|
||||
process the command queue if it is not busy with switch commanding which reduces the amount
|
||||
of possible bugs.
|
||||
- The heater handler is only able to process messages stricly sequentially now but is scheduled
|
||||
twice in a 0.5 second slot so something like a consecutive heater ON or OFF command can still
|
||||
be handled relatively quickly.
|
||||
|
||||
## Added
|
||||
|
||||
- Sequence counters for PUS and CFDP packets are now stored persistently across graceful reboots.
|
||||
- The PUS packet message type counter will now be incremented properly for each PUS service.
|
||||
- Internal error reporter set is now enabled by default and generated every 120 seconds.
|
||||
|
||||
# [v5.0.0] 2023-06-26
|
||||
|
||||
v3.3.1 and all following version will now be moved to v5.0.0 with the additional changes listed
|
||||
here. This was done because the firmware update (v4.0.0) is not working right now and it is not
|
||||
known when and how it will be fixed. Because of that, all updates to make the SW work with the new
|
||||
firmware, which are limited to a few files will be moved to a dev branch so regular development
|
||||
compatible to the old firmware can continue.
|
||||
|
||||
TLDR: This version is compatible to the old firmware and some changes which only work with the new
|
||||
firmware have been reverted.
|
||||
|
||||
## Changed
|
||||
|
||||
- Added `sync` syscall in graceful shutdown handler
|
||||
- Graceful shutdown is now performed by the reboot watchdog
|
||||
- There is now a separate file for the total reboot counter. The reboot watchdog has its own local
|
||||
counters to determine whether a reboot is necessary.
|
||||
|
||||
# [v4.0.1] 2023-06-24
|
||||
|
||||
## Fixed
|
||||
|
||||
- `PusLiveDemux` packet demultiplexing bugfix where the demultiplexing did not work when there was
|
||||
only one destination available.
|
||||
|
||||
# [v4.0.0] 2023-06-22
|
||||
|
||||
- `eive-tmtc` version v5.0.0
|
||||
- `q7s-package` version v3.1.1
|
||||
|
||||
## Fixed
|
||||
|
||||
- Important bugfixes for PTME. See `q7s-package` CHANGELOG.
|
||||
- TCS fixes: Set temperature values to invalid value for MAX31865 RTD handler, SUS handler
|
||||
and STR handler. Also set dataset to invakid for RTD handler.
|
||||
- Fixed H parameter in SUS converter from 1 mm to 2.5 mm.
|
||||
|
||||
## Changed
|
||||
|
||||
- Removed PTME busy/ready signals. Those were not used anyway because register reads are used now.
|
||||
- APB bus access busy checking is not done anymore as this is performed by the bus itself now.
|
||||
- Core controller will now announce version and image information event in addition to reboot
|
||||
event in the `inititalize` function.
|
||||
- Core controller will now try to request and announce the firmware version in addition to the
|
||||
OBSW version as well.
|
||||
- Added core controller action to read reboot mechansm information
|
||||
- GNSS reset pin will now only be asserted for 5 ms instead of 100 ms.
|
||||
|
||||
# [v3.0.0] to be released
|
||||
## Added
|
||||
|
||||
- Added PL I2C reset pin. It is not used/connected for now but could be used for FDIR procedures to
|
||||
restore the PL I2C.
|
||||
- Core controller now announces firmware version as well when requesting a version info event
|
||||
|
||||
# [v3.3.1] 2023-06-22
|
||||
|
||||
## Fixed
|
||||
|
||||
- `PusLiveDemux` packet demultiplexing bugfix where the demultiplexing did not work when there was
|
||||
only one destination available.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed H parameter in SUS converter from 1 mm to 2.5 mm.
|
||||
|
||||
# [v3.3.0] 2023-06-21
|
||||
|
||||
Like v3.2.0 but without the custom FM changes related to VC0.
|
||||
|
||||
# [v3.2.0] 2023-06-21
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix sun vector calculation
|
||||
- SUS total vector was not reset to being a zero vector during eclipse due to a wrong memcpy
|
||||
length.
|
||||
|
||||
## Changed
|
||||
|
||||
- Reverted all changes related to VC0 handling to avoid FM bug possibly related to FPGA bug.
|
||||
|
||||
# [v3.1.1] 2023-06-14
|
||||
|
||||
## Fixed
|
||||
|
||||
- TMP1075 bugfix where negative temperatures could not be measured because of a two's-complement
|
||||
conversion bug.
|
||||
|
||||
# [v3.1.0] 2023-06-14
|
||||
|
||||
- `eive-tmtc` version v4.1.0
|
||||
|
||||
## Fixed
|
||||
|
||||
- TCS heater switch enumeration naming was old/wrong and was not updated in sync with the object ID
|
||||
update. This lead to the TCS controller commanding the wrong heaters.
|
||||
|
||||
## Changed
|
||||
|
||||
- Increase number of allowed parallel HK commands to 16
|
||||
|
||||
## Added
|
||||
|
||||
- Added `CONFIG_SET`, `MAN_HEATER_ON` and `MAN_HEATER_OFF` support for the BPX battery handler
|
||||
|
||||
# [v3.0.0] 2023-06-11
|
||||
|
||||
- `eive-tmtc` version v4.0.0
|
||||
|
||||
## Changed
|
||||
|
||||
@ -66,6 +284,13 @@ TODO: New firmware package version.
|
||||
only be used to cancel a transfer.
|
||||
- Handling of multiple RWs in the ACS Controller is improved and can be changed by parameter
|
||||
commands.
|
||||
- The Directory Listing direct dumper now has a state machine to stagger the directory listing dump.
|
||||
This is required because very large dumps will overload the queue capacities in the framework.
|
||||
- The PUS Service 8 now has larger queue sizes to handle more action replies. The PUS Service 1
|
||||
also has a larger queue size to handle a lot of step replies now.
|
||||
- Moved PDU `vcc` and `vbat` variable from auxiliary dataset to core dataset.
|
||||
- Tweak TCP/IP configuration: Only the TCP server will be included on the EM. For the FM, no
|
||||
TCP/IP servers will be included by default.
|
||||
|
||||
## Added
|
||||
|
||||
@ -75,9 +300,13 @@ TODO: New firmware package version.
|
||||
- ACU dummy HK sets
|
||||
- IMTQ HK sets
|
||||
- IMTQ dummy now handles power switch
|
||||
- Added some new ACS parameters
|
||||
- Enabled decimation filter for the ADIS GYRs
|
||||
- Enabled second low-pass filter for L3GD20H GYRs
|
||||
|
||||
## Fixed
|
||||
|
||||
- CFDP low level protocol bugfix. Requires `fsfw` update and `tmtc` update.
|
||||
- Compile fix if SCEX is compiled for the EM.
|
||||
- Set up Rad Sensor chip select even for EM to avoid SPI bus issues.
|
||||
- Correct ADIS Gyroscope type configuration for the EM, where the 16507 type is used instead of the
|
||||
@ -106,12 +335,16 @@ TODO: New firmware package version.
|
||||
- Prevent spam of TCS controller heater unavailability event if all heaters are in external control.
|
||||
- TCS heater switch info set contained invalid values because of a faulty `memcpy` in the TCS
|
||||
controller. There is not crash risk but the heater states were invalid.
|
||||
- STR datasets were not set to invalid on shutdown.
|
||||
- Fixed usage of quaternion valid flag, which does not actually represent the validity of the
|
||||
quaternion.
|
||||
- Various fixes for the pointing modes of the `ACS Controller`. All modes should work now as
|
||||
intended.
|
||||
- The variance for the ADIS GYRs now represents the used `-3` version and not the `-1` version
|
||||
- CFDP funnel did not route packets to live channel VC0
|
||||
|
||||
# [v2.0.5] 2023-05-11
|
||||
|
||||
|
||||
- The dual lane assembly transition failed handler started new transitions towards the current mode
|
||||
instead of the target mode. This means that if the dual lane assembly never reached the initial
|
||||
submode (e.g. mode normal and submode dual side), it will transition back to the current mode,
|
||||
|
@ -9,8 +9,8 @@
|
||||
# ##############################################################################
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(OBSW_VERSION_MAJOR 4)
|
||||
set(OBSW_VERSION_MINOR 0)
|
||||
set(OBSW_VERSION_MAJOR 6)
|
||||
set(OBSW_VERSION_MINOR 1)
|
||||
set(OBSW_VERSION_REVISION 0)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
@ -79,6 +79,13 @@ else()
|
||||
set(INIT_VAL 1)
|
||||
set(OBSW_STAR_TRACKER_GROUND_CONFIG 0)
|
||||
endif()
|
||||
|
||||
set(OBSW_ADD_TMTC_TCP_SERVER
|
||||
${OBSW_Q7S_EM}
|
||||
CACHE STRING "Add TCP TMTC Server")
|
||||
set(OBSW_ADD_TMTC_UDP_SERVER
|
||||
0
|
||||
CACHE STRING "Add UDP TMTC Server")
|
||||
set(OBSW_ADD_MGT
|
||||
${INIT_VAL}
|
||||
CACHE STRING "Add MGT module")
|
||||
@ -86,7 +93,7 @@ set(OBSW_ADD_BPX_BATTERY_HANDLER
|
||||
1
|
||||
CACHE STRING "Add BPX battery module")
|
||||
set(OBSW_ADD_STAR_TRACKER
|
||||
${INIT_VAL}
|
||||
1
|
||||
CACHE STRING "Add Startracker module")
|
||||
set(OBSW_ADD_SUN_SENSORS
|
||||
${INIT_VAL}
|
||||
@ -98,7 +105,7 @@ set(OBSW_ADD_THERMAL_TEMP_INSERTER
|
||||
${OBSW_Q7S_EM}
|
||||
CACHE STRING "Add thermal sensor temperature inserter")
|
||||
set(OBSW_ADD_ACS_BOARD
|
||||
${INIT_VAL}
|
||||
1
|
||||
CACHE STRING "Add ACS board module")
|
||||
set(OBSW_ADD_GPS_CTRL
|
||||
${INIT_VAL}
|
||||
@ -143,7 +150,7 @@ set(OBSW_ADD_SYRLINKS
|
||||
1
|
||||
CACHE STRING "Add Syrlinks module")
|
||||
set(OBSW_ADD_TMP_DEVICES
|
||||
${INIT_VAL}
|
||||
1
|
||||
CACHE STRING "Add TMP devices")
|
||||
set(OBSW_ADD_GOMSPACE_PCDU
|
||||
1
|
||||
@ -155,7 +162,7 @@ set(OBSW_ADD_RW
|
||||
${INIT_VAL}
|
||||
CACHE STRING "Add RW modules")
|
||||
set(OBSW_ADD_SCEX_DEVICE
|
||||
${INIT_VAL}
|
||||
1
|
||||
CACHE STRING "Add Solar Cell Experiment module")
|
||||
set(OBSW_SYRLINKS_SIMULATED
|
||||
0
|
||||
|
@ -964,6 +964,12 @@ used by other software components to read the current chip and copy.
|
||||
This is a configuration scripts which runs after the Network Time Protocol has run. This script
|
||||
currently sets the static IP address `192.168.133.10` and starts the `can` interface.
|
||||
|
||||
## Initial boot delay
|
||||
|
||||
You can create a file named `boot_delays_secs.txt` inside the home folder to delay the OBSW boot
|
||||
for 6 seconds if the file is empty of for the number of seconds specified inside the file. This
|
||||
can be helpful if something inside the OBSW leads to an immediate crash of the OBC.
|
||||
|
||||
## PCDU
|
||||
|
||||
Connect to serial console of P60 Dock
|
||||
|
@ -68,7 +68,7 @@ void ObjectFactory::produce(void* args) {
|
||||
#endif
|
||||
auto sdcMan = new DummySdCardManager("/tmp");
|
||||
ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore,
|
||||
&tmStore, persistentStores, 120);
|
||||
&tmStore, persistentStores, 120, enableHkSets);
|
||||
|
||||
new TmFunnelHandler(objects::LIVE_TM_TASK, *pusFunnel, *cfdpFunnel);
|
||||
auto* dummyGpioIF = new DummyGpioIF();
|
||||
@ -113,7 +113,7 @@ void ObjectFactory::produce(void* args) {
|
||||
if (heaterHandler == nullptr) {
|
||||
sif::error << "HeaterHandler could not be created" << std::endl;
|
||||
} else {
|
||||
ObjectFactory::createThermalController(*heaterHandler);
|
||||
ObjectFactory::createThermalController(*heaterHandler, true);
|
||||
}
|
||||
new TestTask(objects::TEST_TASK);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 295 translations.
|
||||
* @brief Auto-generated event translation file. Contains 301 translations.
|
||||
* @details
|
||||
* Generated on: 2023-05-17 17:15:34
|
||||
* Generated on: 2023-07-21 11:04:23
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -139,6 +139,7 @@ const char *ERROR_STATE_STRING = "ERROR_STATE";
|
||||
const char *RESET_OCCURED_STRING = "RESET_OCCURED";
|
||||
const char *BOOTING_FIRMWARE_FAILED_EVENT_STRING = "BOOTING_FIRMWARE_FAILED_EVENT";
|
||||
const char *BOOTING_BOOTLOADER_FAILED_EVENT_STRING = "BOOTING_BOOTLOADER_FAILED_EVENT";
|
||||
const char *COM_ERROR_REPLY_RECEIVED_STRING = "COM_ERROR_REPLY_RECEIVED";
|
||||
const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_FAILURE";
|
||||
const char *SUPV_UNKNOWN_TM_STRING = "SUPV_UNKNOWN_TM";
|
||||
const char *SUPV_UNINIMPLEMENTED_TM_STRING = "SUPV_UNINIMPLEMENTED_TM";
|
||||
@ -277,6 +278,8 @@ const char *INDIVIDUAL_BOOT_COUNTS_STRING = "INDIVIDUAL_BOOT_COUNTS";
|
||||
const char *TRYING_I2C_RECOVERY_STRING = "TRYING_I2C_RECOVERY";
|
||||
const char *I2C_REBOOT_STRING = "I2C_REBOOT";
|
||||
const char *PDEC_REBOOT_STRING = "PDEC_REBOOT";
|
||||
const char *FIRMWARE_INFO_STRING = "FIRMWARE_INFO";
|
||||
const char *ACTIVE_SD_INFO_STRING = "ACTIVE_SD_INFO";
|
||||
const char *NO_VALID_SENSOR_TEMPERATURE_STRING = "NO_VALID_SENSOR_TEMPERATURE";
|
||||
const char *NO_HEALTHY_HEATER_AVAILABLE_STRING = "NO_HEALTHY_HEATER_AVAILABLE";
|
||||
const char *SYRLINKS_OVERHEATING_STRING = "SYRLINKS_OVERHEATING";
|
||||
@ -285,6 +288,9 @@ const char *CAMERA_OVERHEATING_STRING = "CAMERA_OVERHEATING";
|
||||
const char *PCDU_SYSTEM_OVERHEATING_STRING = "PCDU_SYSTEM_OVERHEATING";
|
||||
const char *HEATER_NOT_OFF_FOR_OFF_MODE_STRING = "HEATER_NOT_OFF_FOR_OFF_MODE";
|
||||
const char *MGT_OVERHEATING_STRING = "MGT_OVERHEATING";
|
||||
const char *TCS_SWITCHING_HEATER_ON_STRING = "TCS_SWITCHING_HEATER_ON";
|
||||
const char *TCS_SWITCHING_HEATER_OFF_STRING = "TCS_SWITCHING_HEATER_OFF";
|
||||
const char *TCS_HEATER_MAX_BURN_TIME_REACHED_STRING = "TCS_HEATER_MAX_BURN_TIME_REACHED";
|
||||
const char *TX_TIMER_EXPIRED_STRING = "TX_TIMER_EXPIRED";
|
||||
const char *BIT_LOCK_TX_ON_STRING = "BIT_LOCK_TX_ON";
|
||||
const char *POSSIBLE_FILE_CORRUPTION_STRING = "POSSIBLE_FILE_CORRUPTION";
|
||||
@ -571,6 +577,8 @@ const char *translateEvents(Event event) {
|
||||
return BOOTING_FIRMWARE_FAILED_EVENT_STRING;
|
||||
case (11902):
|
||||
return BOOTING_BOOTLOADER_FAILED_EVENT_STRING;
|
||||
case (11903):
|
||||
return COM_ERROR_REPLY_RECEIVED_STRING;
|
||||
case (12001):
|
||||
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||
case (12002):
|
||||
@ -847,6 +855,10 @@ const char *translateEvents(Event event) {
|
||||
return I2C_REBOOT_STRING;
|
||||
case (14012):
|
||||
return PDEC_REBOOT_STRING;
|
||||
case (14013):
|
||||
return FIRMWARE_INFO_STRING;
|
||||
case (14014):
|
||||
return ACTIVE_SD_INFO_STRING;
|
||||
case (14100):
|
||||
return NO_VALID_SENSOR_TEMPERATURE_STRING;
|
||||
case (14101):
|
||||
@ -863,6 +875,12 @@ const char *translateEvents(Event event) {
|
||||
return HEATER_NOT_OFF_FOR_OFF_MODE_STRING;
|
||||
case (14108):
|
||||
return MGT_OVERHEATING_STRING;
|
||||
case (14109):
|
||||
return TCS_SWITCHING_HEATER_ON_STRING;
|
||||
case (14110):
|
||||
return TCS_SWITCHING_HEATER_OFF_STRING;
|
||||
case (14111):
|
||||
return TCS_HEATER_MAX_BURN_TIME_REACHED_STRING;
|
||||
case (14201):
|
||||
return TX_TIMER_EXPIRED_STRING;
|
||||
case (14202):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 171 translations.
|
||||
* Generated on: 2023-05-17 17:15:34
|
||||
* Generated on: 2023-07-21 11:04:23
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -7,7 +7,8 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC ${LIB_FSFW_NAME})
|
||||
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||
add_subdirectory(simple)
|
||||
|
||||
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp)
|
||||
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp scheduling.cpp
|
||||
objectFactory.cpp)
|
||||
|
||||
add_subdirectory(boardtest)
|
||||
|
||||
|
@ -67,8 +67,8 @@
|
||||
// because UDP packets are not allowed in the VPN
|
||||
// This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the
|
||||
// CCSDS IP Cores.
|
||||
#define OBSW_ADD_TMTC_TCP_SERVER 1
|
||||
#define OBSW_ADD_TMTC_UDP_SERVER 1
|
||||
#define OBSW_ADD_TMTC_TCP_SERVER @OBSW_ADD_TMTC_TCP_SERVER@
|
||||
#define OBSW_ADD_TMTC_UDP_SERVER @OBSW_ADD_TMTC_UDP_SERVER@
|
||||
|
||||
// Can be used to switch device to NORMAL mode immediately
|
||||
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 0
|
||||
|
@ -12,6 +12,9 @@ static constexpr char SPI_RW_DEV[] = "/dev/spi_rw";
|
||||
static constexpr char I2C_PL_EIVE[] = "/dev/i2c_pl";
|
||||
//! I2C bus using the I2C peripheral of the ARM processing system (PS)
|
||||
static constexpr char I2C_PS_EIVE[] = "/dev/i2c_ps";
|
||||
//! I2C bus using the first I2C peripheral of the ARM processing system (PS).
|
||||
//! Named like this because it is used by default for the Q7 devices.
|
||||
static constexpr char I2C_Q7_EIVE[] = "/dev/i2c_q7";
|
||||
|
||||
static constexpr char UART_GNSS_DEV[] = "/dev/gps0";
|
||||
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul_plmpsoc";
|
||||
@ -23,6 +26,7 @@ static constexpr char UART_SCEX_DEV[] = "/dev/scex";
|
||||
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio_pdec_regs";
|
||||
static constexpr char UIO_PTME[] = "/dev/uio_ptme";
|
||||
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio_pdec_cfg_mem";
|
||||
static constexpr char UIO_SYS_ROM[] = "/dev/uio_sys_rom";
|
||||
static constexpr char UIO_PDEC_RAM[] = "/dev/uio_pdec_ram";
|
||||
static constexpr char UIO_PDEC_IRQ[] = "/dev/uio_pdec_irq";
|
||||
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
||||
@ -57,6 +61,7 @@ static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
|
||||
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
|
||||
static constexpr char GNSS_SELECT[] = "gnss_mux_select";
|
||||
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
|
||||
static constexpr char PL_I2C_ARESETN[] = "pl_i2c_aresetn";
|
||||
|
||||
static constexpr char HEATER_0[] = "heater0";
|
||||
static constexpr char HEATER_1[] = "heater1";
|
||||
|
@ -1,4 +1 @@
|
||||
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp scheduling.cpp
|
||||
ObjectFactory.cpp WatchdogHandler.cpp)
|
||||
|
||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE scheduling.cpp)
|
||||
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <fsfw/filesystem/HasFileSystemIF.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw_hal/linux/uio/UioMapper.h>
|
||||
|
||||
#include "commonConfig.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
@ -22,6 +23,7 @@
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
|
||||
#include "bsp_q7s/boardconfig/busConf.h"
|
||||
#include "bsp_q7s/fs/SdCardManager.h"
|
||||
#include "bsp_q7s/memory/scratchApi.h"
|
||||
#include "bsp_q7s/xadc/Xadc.h"
|
||||
@ -112,6 +114,9 @@ void CoreController::performControlOperation() {
|
||||
sdStateMachine();
|
||||
performMountedSdCardOperations();
|
||||
readHkData();
|
||||
if (dumpContext.active) {
|
||||
dirListingDumpHandler();
|
||||
}
|
||||
|
||||
if (shellCmdIsExecuting) {
|
||||
bool replyReceived = false;
|
||||
@ -151,21 +156,12 @@ ReturnValue_t CoreController::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "CoreController::initialize: Base init failed" << std::endl;
|
||||
}
|
||||
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||
"count failed"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
result = paramHelper.initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
sdStateMachine();
|
||||
|
||||
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
||||
EventManagerIF *eventManager =
|
||||
ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
if (eventManager == nullptr or eventQueue == nullptr) {
|
||||
@ -182,7 +178,20 @@ ReturnValue_t CoreController::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "Subscribing for GPS GPS_FIX_CHANGE event failed" << std::endl;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
||||
announceCurrentImageInfo();
|
||||
announceVersionInfo();
|
||||
SdCardManager::SdStatePair sdStates;
|
||||
sdcMan->getSdCardsStatus(sdStates);
|
||||
announceSdInfo(sdStates);
|
||||
sdStateMachine();
|
||||
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||
"count failed"
|
||||
<< std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||
@ -207,19 +216,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
using namespace core;
|
||||
switch (actionId) {
|
||||
case (ANNOUNCE_VERSION): {
|
||||
uint32_t p1 = (common::OBSW_VERSION_MAJOR << 24) | (common::OBSW_VERSION_MINOR << 16) |
|
||||
(common::OBSW_VERSION_REVISION << 8);
|
||||
uint32_t p2 = 0;
|
||||
if (strcmp("", common::OBSW_VERSION_CST_GIT_SHA1) != 0) {
|
||||
p1 |= 1;
|
||||
auto shaAsStr = std::string(common::OBSW_VERSION_CST_GIT_SHA1);
|
||||
size_t posDash = shaAsStr.find("-");
|
||||
auto gitHash = shaAsStr.substr(posDash + 2, 4);
|
||||
// Only copy first 4 letters of git hash
|
||||
memcpy(&p2, gitHash.c_str(), 4);
|
||||
}
|
||||
|
||||
triggerEvent(VERSION_INFO, p1, p2);
|
||||
announceVersionInfo();
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (ANNOUNCE_BOOT_COUNTS): {
|
||||
@ -227,7 +224,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (ANNOUNCE_CURRENT_IMAGE): {
|
||||
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
|
||||
announceCurrentImageInfo();
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (LIST_DIRECTORY_INTO_FILE): {
|
||||
@ -243,6 +240,9 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
return result;
|
||||
}
|
||||
std::ostringstream oss("cp ", std::ostringstream::ate);
|
||||
if (parser.isForceOptSet()) {
|
||||
oss << "-f ";
|
||||
}
|
||||
if (parser.isRecursiveOptSet()) {
|
||||
oss << "-r ";
|
||||
}
|
||||
@ -315,28 +315,38 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
if (size < 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_WATCHDOG_FILE;
|
||||
parseRebootWatchdogFile(path, rebootWatchdogFile);
|
||||
if (data[0] == 0) {
|
||||
rebootFile.enabled = false;
|
||||
rewriteRebootFile(rebootFile);
|
||||
rebootWatchdogFile.enabled = false;
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
} else if (data[0] == 1) {
|
||||
rebootFile.enabled = true;
|
||||
rewriteRebootFile(rebootFile);
|
||||
rebootWatchdogFile.enabled = true;
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
} else {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (READ_REBOOT_MECHANISM_INFO): {
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_WATCHDOG_FILE;
|
||||
parseRebootWatchdogFile(path, rebootWatchdogFile);
|
||||
RebootWatchdogPacket packet(rebootWatchdogFile);
|
||||
ReturnValue_t result = actionHelper.reportData(commandedBy, actionId, &packet);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_REBOOT_COUNTERS): {
|
||||
if (size == 0) {
|
||||
resetRebootCount(xsc::ALL_CHIP, xsc::ALL_COPY);
|
||||
resetRebootWatchdogCounters(xsc::ALL_CHIP, xsc::ALL_COPY);
|
||||
} else if (size == 2) {
|
||||
if (data[0] > 1 or data[1] > 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
resetRebootCount(static_cast<xsc::Chip>(data[0]), static_cast<xsc::Copy>(data[1]));
|
||||
resetRebootWatchdogCounters(static_cast<xsc::Chip>(data[0]),
|
||||
static_cast<xsc::Copy>(data[1]));
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
@ -431,11 +441,11 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
if (size < 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_WATCHDOG_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
rebootFile.maxCount = data[0];
|
||||
rewriteRebootFile(rebootFile);
|
||||
parseRebootWatchdogFile(path, rebootWatchdogFile);
|
||||
rebootWatchdogFile.maxCount = data[0];
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (XSC_REBOOT_OBC): {
|
||||
@ -791,6 +801,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
||||
}
|
||||
sif::info << "SD card update into " << modeStr
|
||||
<< " mode finished. Active SD: " << sdInfo.activeChar << std::endl;
|
||||
announceSdInfo(sdInfo.currentState);
|
||||
if (not sdInfo.initFinished) {
|
||||
updateInternalSdInfo();
|
||||
sdInfo.initFinished = true;
|
||||
@ -1038,7 +1049,6 @@ ReturnValue_t CoreController::actionListDirectoryDumpDirectly(ActionId_t actionI
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
std::array<uint8_t, 1024> dirListingBuf{};
|
||||
dirListingBuf[8] = parser.compressionOptionSet();
|
||||
// First four bytes reserved for segment index. One byte for compression option information
|
||||
std::strcpy(reinterpret_cast<char *>(dirListingBuf.data() + 2 * sizeof(uint32_t) + 1), repoName);
|
||||
@ -1047,38 +1057,47 @@ ReturnValue_t CoreController::actionListDirectoryDumpDirectly(ActionId_t actionI
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
std::error_code e;
|
||||
size_t totalFileSize = std::filesystem::file_size(LIST_DIR_DUMP_WORK_FILE, e);
|
||||
uint32_t segmentIdx = 0;
|
||||
size_t dumpedBytes = 0;
|
||||
dumpContext.totalFileSize = std::filesystem::file_size(LIST_DIR_DUMP_WORK_FILE, e);
|
||||
dumpContext.segmentIdx = 0;
|
||||
dumpContext.dumpedBytes = 0;
|
||||
size_t nextDumpLen = 0;
|
||||
size_t dummy = 0;
|
||||
size_t maxDumpLen = dirListingBuf.size() - 2 * sizeof(uint32_t) - 1 - repoNameLen - 1;
|
||||
size_t listingDataOffset = 2 * sizeof(uint32_t) + 1 + repoNameLen + 1;
|
||||
uint32_t chunks = totalFileSize / maxDumpLen;
|
||||
if (totalFileSize % maxDumpLen != 0) {
|
||||
dumpContext.maxDumpLen = dirListingBuf.size() - 2 * sizeof(uint32_t) - 1 - repoNameLen - 1;
|
||||
dumpContext.listingDataOffset = 2 * sizeof(uint32_t) + 1 + repoNameLen + 1;
|
||||
uint32_t chunks = dumpContext.totalFileSize / dumpContext.maxDumpLen;
|
||||
if (dumpContext.totalFileSize % dumpContext.maxDumpLen != 0) {
|
||||
chunks++;
|
||||
}
|
||||
SerializeAdapter::serialize(&chunks, dirListingBuf.data() + sizeof(uint32_t), &dummy,
|
||||
dirListingBuf.size() - sizeof(uint32_t),
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
while (dumpedBytes < totalFileSize) {
|
||||
ifile.seekg(dumpedBytes, std::ios::beg);
|
||||
nextDumpLen = maxDumpLen;
|
||||
if (totalFileSize - dumpedBytes < maxDumpLen) {
|
||||
nextDumpLen = totalFileSize - dumpedBytes;
|
||||
while (dumpContext.dumpedBytes < dumpContext.totalFileSize) {
|
||||
ifile.seekg(dumpContext.dumpedBytes, std::ios::beg);
|
||||
nextDumpLen = dumpContext.maxDumpLen;
|
||||
if (dumpContext.totalFileSize - dumpContext.dumpedBytes < dumpContext.maxDumpLen) {
|
||||
nextDumpLen = dumpContext.totalFileSize - dumpContext.dumpedBytes;
|
||||
}
|
||||
SerializeAdapter::serialize(&segmentIdx, dirListingBuf.data(), &dummy, dirListingBuf.size(),
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
ifile.read(reinterpret_cast<char *>(dirListingBuf.data() + listingDataOffset), nextDumpLen);
|
||||
SerializeAdapter::serialize(&dumpContext.segmentIdx, dirListingBuf.data(), &dummy,
|
||||
dirListingBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||
ifile.read(reinterpret_cast<char *>(dirListingBuf.data() + dumpContext.listingDataOffset),
|
||||
nextDumpLen);
|
||||
result = actionHelper.reportData(commandedBy, actionId, dirListingBuf.data(),
|
||||
listingDataOffset + nextDumpLen);
|
||||
dumpContext.listingDataOffset + nextDumpLen);
|
||||
if (result != returnvalue::OK) {
|
||||
// Remove work file when we are done
|
||||
std::filesystem::remove(LIST_DIR_DUMP_WORK_FILE, e);
|
||||
return result;
|
||||
}
|
||||
segmentIdx++;
|
||||
dumpedBytes += nextDumpLen;
|
||||
dumpContext.segmentIdx++;
|
||||
dumpContext.dumpedBytes += nextDumpLen;
|
||||
// Dump takes multiple task cycles, so cache the dump state and continue dump the next cycles.
|
||||
if (dumpContext.segmentIdx == 10) {
|
||||
dumpContext.active = true;
|
||||
dumpContext.firstDump = true;
|
||||
dumpContext.commander = commandedBy;
|
||||
dumpContext.actionId = actionId;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
}
|
||||
// Remove work file when we are done
|
||||
std::filesystem::remove(LIST_DIR_DUMP_WORK_FILE, e);
|
||||
@ -1185,45 +1204,7 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
|
||||
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
||||
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
||||
|
||||
// This function can not really fail
|
||||
gracefulShutdownTasks(tgtChip, tgtCopy, protOpPerformed);
|
||||
|
||||
switch (tgtChip) {
|
||||
case (xsc::Chip::CHIP_0): {
|
||||
switch (tgtCopy) {
|
||||
case (xsc::Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case (xsc::Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (xsc::Chip::CHIP_1): {
|
||||
switch (tgtCopy) {
|
||||
case (xsc::Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case (xsc::Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
performGracefulShutdown(tgtChip, tgtCopy);
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
@ -1236,14 +1217,23 @@ ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
|
||||
|
||||
ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy,
|
||||
bool &protOpPerformed) {
|
||||
// Store both sequence counters persistently.
|
||||
core::SAVE_CFDP_SEQUENCE_COUNT = true;
|
||||
core::SAVE_PUS_SEQUENCE_COUNT = true;
|
||||
|
||||
sdcMan->setBlocking(true);
|
||||
sdcMan->markUnusable();
|
||||
// Wait two seconds to ensure no one uses the SD cards
|
||||
TaskFactory::delayTask(2000);
|
||||
|
||||
// Ensure that all writes/reads do finish.
|
||||
sync();
|
||||
|
||||
// Attempt graceful shutdown by unmounting and switching off SD cards
|
||||
sdcMan->switchOffSdCard(sd::SdCard::SLOT_0);
|
||||
sdcMan->switchOffSdCard(sd::SdCard::SLOT_1);
|
||||
// If any boot copies are unprotected
|
||||
// If any boot copies are unprotected.
|
||||
// Actually this function only ensures that reboots to the own image are protected..
|
||||
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||
protOpPerformed, false);
|
||||
if (result == returnvalue::OK and protOpPerformed) {
|
||||
@ -1532,7 +1522,8 @@ void CoreController::performMountedSdCardOperations() {
|
||||
if (not timeFileInitDone) {
|
||||
initClockFromTimeFile();
|
||||
}
|
||||
performRebootFileHandling(false);
|
||||
performRebootWatchdogHandling(false);
|
||||
performRebootCountersHandling(false);
|
||||
}
|
||||
backupTimeFileHandler();
|
||||
};
|
||||
@ -1604,117 +1595,126 @@ ReturnValue_t CoreController::performSdCardCheck() {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void CoreController::performRebootFileHandling(bool recreateFile) {
|
||||
void CoreController::performRebootWatchdogHandling(bool recreateFile) {
|
||||
using namespace std;
|
||||
std::string path = currMntPrefix + REBOOT_FILE;
|
||||
std::string path = currMntPrefix + REBOOT_WATCHDOG_FILE;
|
||||
std::string legacyPath = currMntPrefix + LEGACY_REBOOT_WATCHDOG_FILE;
|
||||
std::error_code e;
|
||||
// TODO: Remove at some point in the future.
|
||||
if (std::filesystem::exists(legacyPath, e)) {
|
||||
// Old file might still exist, so copy it to new path
|
||||
std::filesystem::copy(legacyPath, path, std::filesystem::copy_options::overwrite_existing, e);
|
||||
if (e) {
|
||||
sif::error << "File copy has failed: " << e.message() << std::endl;
|
||||
}
|
||||
}
|
||||
if (not std::filesystem::exists(path, e) or recreateFile) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "CoreController::performRebootFileHandling: Recreating reboot file" << std::endl;
|
||||
sif::info << "CoreController::performRebootFileHandling: Recreating reboot watchdog file"
|
||||
<< std::endl;
|
||||
#endif
|
||||
rebootFile.enabled = false;
|
||||
rebootFile.img00Cnt = 0;
|
||||
rebootFile.img01Cnt = 0;
|
||||
rebootFile.img10Cnt = 0;
|
||||
rebootFile.img11Cnt = 0;
|
||||
rebootFile.lastChip = xsc::Chip::CHIP_0;
|
||||
rebootFile.lastCopy = xsc::Copy::COPY_0;
|
||||
rebootFile.img00Lock = false;
|
||||
rebootFile.img01Lock = false;
|
||||
rebootFile.img10Lock = false;
|
||||
rebootFile.img11Lock = false;
|
||||
rebootFile.mechanismNextChip = xsc::Chip::NO_CHIP;
|
||||
rebootFile.mechanismNextCopy = xsc::Copy::NO_COPY;
|
||||
rebootFile.bootFlag = false;
|
||||
rewriteRebootFile(rebootFile);
|
||||
rebootWatchdogFile.enabled = false;
|
||||
rebootWatchdogFile.img00Cnt = 0;
|
||||
rebootWatchdogFile.img01Cnt = 0;
|
||||
rebootWatchdogFile.img10Cnt = 0;
|
||||
rebootWatchdogFile.img11Cnt = 0;
|
||||
rebootWatchdogFile.lastChip = xsc::Chip::CHIP_0;
|
||||
rebootWatchdogFile.lastCopy = xsc::Copy::COPY_0;
|
||||
rebootWatchdogFile.img00Lock = false;
|
||||
rebootWatchdogFile.img01Lock = false;
|
||||
rebootWatchdogFile.img10Lock = false;
|
||||
rebootWatchdogFile.img11Lock = false;
|
||||
rebootWatchdogFile.mechanismNextChip = xsc::Chip::NO_CHIP;
|
||||
rebootWatchdogFile.mechanismNextCopy = xsc::Copy::NO_COPY;
|
||||
rebootWatchdogFile.bootFlag = false;
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
} else {
|
||||
if (not parseRebootFile(path, rebootFile)) {
|
||||
performRebootFileHandling(true);
|
||||
if (not parseRebootWatchdogFile(path, rebootWatchdogFile)) {
|
||||
performRebootWatchdogHandling(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (CURRENT_CHIP == xsc::CHIP_0) {
|
||||
if (CURRENT_COPY == xsc::COPY_0) {
|
||||
rebootFile.img00Cnt++;
|
||||
rebootWatchdogFile.img00Cnt++;
|
||||
} else {
|
||||
rebootFile.img01Cnt++;
|
||||
rebootWatchdogFile.img01Cnt++;
|
||||
}
|
||||
} else {
|
||||
if (CURRENT_COPY == xsc::COPY_0) {
|
||||
rebootFile.img10Cnt++;
|
||||
rebootWatchdogFile.img10Cnt++;
|
||||
} else {
|
||||
rebootFile.img11Cnt++;
|
||||
rebootWatchdogFile.img11Cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (rebootFile.bootFlag) {
|
||||
if (rebootWatchdogFile.bootFlag) {
|
||||
// Trigger event to inform ground that a reboot was triggered
|
||||
uint32_t p1 = rebootFile.lastChip << 16 | rebootFile.lastCopy;
|
||||
uint32_t p1 = rebootWatchdogFile.lastChip << 16 | rebootWatchdogFile.lastCopy;
|
||||
triggerEvent(core::REBOOT_MECHANISM_TRIGGERED, p1, 0);
|
||||
// Clear the boot flag
|
||||
rebootFile.bootFlag = false;
|
||||
rebootWatchdogFile.bootFlag = false;
|
||||
}
|
||||
|
||||
announceBootCounts();
|
||||
|
||||
if (rebootFile.mechanismNextChip != xsc::NO_CHIP and
|
||||
rebootFile.mechanismNextCopy != xsc::NO_COPY) {
|
||||
if (CURRENT_CHIP != rebootFile.mechanismNextChip or
|
||||
CURRENT_COPY != rebootFile.mechanismNextCopy) {
|
||||
std::string infoString = std::to_string(rebootFile.mechanismNextChip) + " " +
|
||||
std::to_string(rebootFile.mechanismNextCopy);
|
||||
if (rebootWatchdogFile.mechanismNextChip != xsc::NO_CHIP and
|
||||
rebootWatchdogFile.mechanismNextCopy != xsc::NO_COPY) {
|
||||
if (CURRENT_CHIP != rebootWatchdogFile.mechanismNextChip or
|
||||
CURRENT_COPY != rebootWatchdogFile.mechanismNextCopy) {
|
||||
std::string infoString = std::to_string(rebootWatchdogFile.mechanismNextChip) + " " +
|
||||
std::to_string(rebootWatchdogFile.mechanismNextCopy);
|
||||
sif::warning << "CoreController::performRebootFileHandling: Expected to be on image "
|
||||
<< infoString << " but currently on other image. Locking " << infoString
|
||||
<< std::endl;
|
||||
// Firmware or other component might be corrupt and we are on another image then the target
|
||||
// image specified by the mechanism. We can't really trust the target image anymore.
|
||||
// Lock it for now
|
||||
if (rebootFile.mechanismNextChip == xsc::CHIP_0) {
|
||||
if (rebootFile.mechanismNextCopy == xsc::COPY_0) {
|
||||
rebootFile.img00Lock = true;
|
||||
if (rebootWatchdogFile.mechanismNextChip == xsc::CHIP_0) {
|
||||
if (rebootWatchdogFile.mechanismNextCopy == xsc::COPY_0) {
|
||||
rebootWatchdogFile.img00Lock = true;
|
||||
} else {
|
||||
rebootFile.img01Lock = true;
|
||||
rebootWatchdogFile.img01Lock = true;
|
||||
}
|
||||
} else {
|
||||
if (rebootFile.mechanismNextCopy == xsc::COPY_0) {
|
||||
rebootFile.img10Lock = true;
|
||||
if (rebootWatchdogFile.mechanismNextCopy == xsc::COPY_0) {
|
||||
rebootWatchdogFile.img10Lock = true;
|
||||
} else {
|
||||
rebootFile.img11Lock = true;
|
||||
rebootWatchdogFile.img11Lock = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rebootFile.lastChip = CURRENT_CHIP;
|
||||
rebootFile.lastCopy = CURRENT_COPY;
|
||||
rebootWatchdogFile.lastChip = CURRENT_CHIP;
|
||||
rebootWatchdogFile.lastCopy = CURRENT_COPY;
|
||||
// Only reboot if the reboot functionality is enabled.
|
||||
// The handler will still increment the boot counts
|
||||
if (rebootFile.enabled and (*rebootFile.relevantBootCnt >= rebootFile.maxCount)) {
|
||||
if (rebootWatchdogFile.enabled and
|
||||
(*rebootWatchdogFile.relevantBootCnt >= rebootWatchdogFile.maxCount)) {
|
||||
// Reboot to other image
|
||||
bool doReboot = false;
|
||||
xsc::Chip tgtChip = xsc::NO_CHIP;
|
||||
xsc::Copy tgtCopy = xsc::NO_COPY;
|
||||
determineAndExecuteReboot(rebootFile, doReboot, tgtChip, tgtCopy);
|
||||
rebootWatchdogAlgorithm(rebootWatchdogFile, doReboot, tgtChip, tgtCopy);
|
||||
if (doReboot) {
|
||||
rebootFile.bootFlag = true;
|
||||
rebootWatchdogFile.bootFlag = true;
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Boot counter for image " << CURRENT_CHIP << " " << CURRENT_COPY
|
||||
<< " too high. Rebooting to " << tgtChip << " " << tgtCopy << std::endl;
|
||||
#endif
|
||||
rebootFile.mechanismNextChip = tgtChip;
|
||||
rebootFile.mechanismNextCopy = tgtCopy;
|
||||
rewriteRebootFile(rebootFile);
|
||||
xsc_boot_copy(static_cast<xsc_libnor_chip_t>(tgtChip),
|
||||
static_cast<xsc_libnor_copy_t>(tgtCopy));
|
||||
rebootWatchdogFile.mechanismNextChip = tgtChip;
|
||||
rebootWatchdogFile.mechanismNextCopy = tgtCopy;
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
performGracefulShutdown(tgtChip, tgtCopy);
|
||||
}
|
||||
} else {
|
||||
rebootFile.mechanismNextChip = xsc::NO_CHIP;
|
||||
rebootFile.mechanismNextCopy = xsc::NO_COPY;
|
||||
rebootWatchdogFile.mechanismNextChip = xsc::NO_CHIP;
|
||||
rebootWatchdogFile.mechanismNextCopy = xsc::NO_COPY;
|
||||
}
|
||||
rewriteRebootFile(rebootFile);
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
}
|
||||
|
||||
void CoreController::determineAndExecuteReboot(RebootFile &rf, bool &needsReboot,
|
||||
void CoreController::rebootWatchdogAlgorithm(RebootWatchdogFile &rf, bool &needsReboot,
|
||||
xsc::Chip &tgtChip, xsc::Copy &tgtCopy) {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_0;
|
||||
@ -1803,7 +1803,7 @@ void CoreController::determineAndExecuteReboot(RebootFile &rf, bool &needsReboot
|
||||
}
|
||||
}
|
||||
|
||||
bool CoreController::parseRebootFile(std::string path, RebootFile &rf) {
|
||||
bool CoreController::parseRebootWatchdogFile(std::string path, RebootWatchdogFile &rf) {
|
||||
using namespace std;
|
||||
std::string selfMatch;
|
||||
if (CURRENT_CHIP == xsc::CHIP_0) {
|
||||
@ -1985,35 +1985,123 @@ bool CoreController::parseRebootFile(std::string path, RebootFile &rf) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||
std::string path = currMntPrefix + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
bool CoreController::parseRebootCountersFile(std::string path, RebootCountersFile &rf) {
|
||||
using namespace std;
|
||||
ifstream file(path);
|
||||
string word;
|
||||
string line;
|
||||
uint8_t lineIdx = 0;
|
||||
while (std::getline(file, line)) {
|
||||
istringstream iss(line);
|
||||
switch (lineIdx) {
|
||||
case 0: {
|
||||
iss >> word;
|
||||
if (word.find("img00:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img00Cnt;
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
iss >> word;
|
||||
if (word.find("img01:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img01Cnt;
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
iss >> word;
|
||||
if (word.find("img10:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img10Cnt;
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
iss >> word;
|
||||
if (word.find("img11:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img11Cnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
lineIdx++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CoreController::resetRebootWatchdogCounters(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||
std::string path = currMntPrefix + REBOOT_WATCHDOG_FILE;
|
||||
parseRebootWatchdogFile(path, rebootWatchdogFile);
|
||||
if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
rebootFile.img01Cnt = 0;
|
||||
rebootFile.img10Cnt = 0;
|
||||
rebootFile.img11Cnt = 0;
|
||||
rebootWatchdogFile.img00Cnt = 0;
|
||||
rebootWatchdogFile.img01Cnt = 0;
|
||||
rebootWatchdogFile.img10Cnt = 0;
|
||||
rebootWatchdogFile.img11Cnt = 0;
|
||||
} else {
|
||||
if (tgtChip == xsc::CHIP_0) {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
rebootWatchdogFile.img00Cnt = 0;
|
||||
} else {
|
||||
rebootFile.img01Cnt = 0;
|
||||
rebootWatchdogFile.img01Cnt = 0;
|
||||
}
|
||||
} else {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img10Cnt = 0;
|
||||
rebootWatchdogFile.img10Cnt = 0;
|
||||
} else {
|
||||
rebootFile.img11Cnt = 0;
|
||||
rebootWatchdogFile.img11Cnt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
rewriteRebootFile(rebootFile);
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
}
|
||||
|
||||
void CoreController::rewriteRebootFile(RebootFile file) {
|
||||
std::string path = currMntPrefix + REBOOT_FILE;
|
||||
void CoreController::performRebootCountersHandling(bool recreateFile) {
|
||||
std::string path = currMntPrefix + REBOOT_COUNTERS_FILE;
|
||||
std::error_code e;
|
||||
if (not std::filesystem::exists(path, e) or recreateFile) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "CoreController::performRebootFileHandling: Recreating reboot counters file"
|
||||
<< std::endl;
|
||||
#endif
|
||||
rebootCountersFile.img00Cnt = 0;
|
||||
rebootCountersFile.img01Cnt = 0;
|
||||
rebootCountersFile.img10Cnt = 0;
|
||||
rebootCountersFile.img11Cnt = 0;
|
||||
rewriteRebootCountersFile(rebootCountersFile);
|
||||
} else {
|
||||
if (not parseRebootCountersFile(path, rebootCountersFile)) {
|
||||
performRebootCountersHandling(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (CURRENT_CHIP == xsc::CHIP_0) {
|
||||
if (CURRENT_COPY == xsc::COPY_0) {
|
||||
rebootCountersFile.img00Cnt++;
|
||||
} else {
|
||||
rebootCountersFile.img01Cnt++;
|
||||
}
|
||||
} else {
|
||||
if (CURRENT_COPY == xsc::COPY_0) {
|
||||
rebootCountersFile.img10Cnt++;
|
||||
} else {
|
||||
rebootCountersFile.img11Cnt++;
|
||||
}
|
||||
}
|
||||
announceBootCounts();
|
||||
rewriteRebootCountersFile(rebootCountersFile);
|
||||
}
|
||||
void CoreController::rewriteRebootWatchdogFile(RebootWatchdogFile file) {
|
||||
using namespace std::filesystem;
|
||||
std::string path = currMntPrefix + REBOOT_WATCHDOG_FILE;
|
||||
std::string legacyPath = currMntPrefix + LEGACY_REBOOT_WATCHDOG_FILE;
|
||||
{
|
||||
std::ofstream rebootFile(path);
|
||||
if (rebootFile.is_open()) {
|
||||
// Initiate reboot file first. Reboot handling will be on on initialization
|
||||
@ -2027,26 +2115,44 @@ void CoreController::rewriteRebootFile(RebootFile file) {
|
||||
<< "\nnext: " << static_cast<int>(file.mechanismNextChip) << " "
|
||||
<< static_cast<int>(file.mechanismNextCopy) << "\n";
|
||||
}
|
||||
}
|
||||
std::error_code e;
|
||||
// TODO: Remove at some point in the future when all images have been updated.
|
||||
if (std::filesystem::exists(legacyPath)) {
|
||||
// Keep those two files in sync
|
||||
std::filesystem::copy(path, legacyPath, std::filesystem::copy_options::overwrite_existing, e);
|
||||
if (e) {
|
||||
sif::error << "File copy has failed: " << e.message() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::rewriteRebootCountersFile(RebootCountersFile file) {
|
||||
std::string path = currMntPrefix + REBOOT_COUNTERS_FILE;
|
||||
std::ofstream rebootFile(path);
|
||||
if (rebootFile.is_open()) {
|
||||
rebootFile << "img00: " << file.img00Cnt << "\nimg01: " << file.img01Cnt
|
||||
<< "\nimg10: " << file.img10Cnt << "\nimg11: " << file.img11Cnt << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||
std::string path = currMntPrefix + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
std::string path = currMntPrefix + REBOOT_WATCHDOG_FILE;
|
||||
parseRebootWatchdogFile(path, rebootWatchdogFile);
|
||||
if (tgtChip == xsc::CHIP_0) {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img00Lock = lock;
|
||||
rebootWatchdogFile.img00Lock = lock;
|
||||
} else {
|
||||
rebootFile.img01Lock = lock;
|
||||
rebootWatchdogFile.img01Lock = lock;
|
||||
}
|
||||
} else {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img10Lock = lock;
|
||||
rebootWatchdogFile.img10Lock = lock;
|
||||
} else {
|
||||
rebootFile.img11Lock = lock;
|
||||
rebootWatchdogFile.img11Lock = lock;
|
||||
}
|
||||
}
|
||||
rewriteRebootFile(rebootFile);
|
||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::backupTimeFileHandler() {
|
||||
@ -2333,10 +2439,12 @@ bool CoreController::startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mo
|
||||
}
|
||||
|
||||
void CoreController::announceBootCounts() {
|
||||
uint64_t totalBootCount =
|
||||
rebootFile.img00Cnt + rebootFile.img01Cnt + rebootFile.img10Cnt + rebootFile.img11Cnt;
|
||||
uint32_t individualBootCountsP1 = (rebootFile.img00Cnt << 16) | rebootFile.img01Cnt;
|
||||
uint32_t individualBootCountsP2 = (rebootFile.img10Cnt << 16) | rebootFile.img11Cnt;
|
||||
uint64_t totalBootCount = rebootCountersFile.img00Cnt + rebootCountersFile.img01Cnt +
|
||||
rebootCountersFile.img10Cnt + rebootCountersFile.img11Cnt;
|
||||
uint32_t individualBootCountsP1 =
|
||||
(rebootCountersFile.img00Cnt << 16) | rebootCountersFile.img01Cnt;
|
||||
uint32_t individualBootCountsP2 =
|
||||
(rebootCountersFile.img10Cnt << 16) | rebootCountersFile.img11Cnt;
|
||||
triggerEvent(core::INDIVIDUAL_BOOT_COUNTS, individualBootCountsP1, individualBootCountsP2);
|
||||
triggerEvent(core::REBOOT_COUNTER, (totalBootCount >> 32) & 0xffffffff,
|
||||
totalBootCount & 0xffffffff);
|
||||
@ -2346,6 +2454,135 @@ MessageQueueId_t CoreController::getCommandQueue() const {
|
||||
return ExtendedControllerBase::getCommandQueue();
|
||||
}
|
||||
|
||||
void CoreController::dirListingDumpHandler() {
|
||||
if (dumpContext.firstDump) {
|
||||
dumpContext.firstDump = false;
|
||||
return;
|
||||
}
|
||||
size_t nextDumpLen = 0;
|
||||
size_t dummy = 0;
|
||||
ReturnValue_t result;
|
||||
std::error_code e;
|
||||
std::ifstream ifile(LIST_DIR_DUMP_WORK_FILE, std::ios::binary);
|
||||
if (ifile.bad()) {
|
||||
return;
|
||||
}
|
||||
while (dumpContext.dumpedBytes < dumpContext.totalFileSize) {
|
||||
ifile.seekg(dumpContext.dumpedBytes, std::ios::beg);
|
||||
nextDumpLen = dumpContext.maxDumpLen;
|
||||
if (dumpContext.totalFileSize - dumpContext.dumpedBytes < dumpContext.maxDumpLen) {
|
||||
nextDumpLen = dumpContext.totalFileSize - dumpContext.dumpedBytes;
|
||||
}
|
||||
SerializeAdapter::serialize(&dumpContext.segmentIdx, dirListingBuf.data(), &dummy,
|
||||
dirListingBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||
ifile.read(reinterpret_cast<char *>(dirListingBuf.data() + dumpContext.listingDataOffset),
|
||||
nextDumpLen);
|
||||
result =
|
||||
actionHelper.reportData(dumpContext.commander, dumpContext.actionId, dirListingBuf.data(),
|
||||
dumpContext.listingDataOffset + nextDumpLen);
|
||||
if (result != returnvalue::OK) {
|
||||
// Remove work file when we are done
|
||||
std::filesystem::remove(LIST_DIR_DUMP_WORK_FILE, e);
|
||||
dumpContext.active = false;
|
||||
actionHelper.finish(false, dumpContext.commander, dumpContext.actionId, result);
|
||||
return;
|
||||
}
|
||||
dumpContext.segmentIdx++;
|
||||
dumpContext.dumpedBytes += nextDumpLen;
|
||||
// Dump takes multiple task cycles, so cache the dump state and continue dump the next cycles.
|
||||
if (dumpContext.segmentIdx == 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dumpContext.dumpedBytes >= dumpContext.totalFileSize) {
|
||||
actionHelper.finish(true, dumpContext.commander, dumpContext.actionId, result);
|
||||
dumpContext.active = false;
|
||||
// Remove work file when we are done
|
||||
std::filesystem::remove(LIST_DIR_DUMP_WORK_FILE, e);
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::announceVersionInfo() {
|
||||
using namespace core;
|
||||
uint32_t p1 = (common::OBSW_VERSION_MAJOR << 24) | (common::OBSW_VERSION_MINOR << 16) |
|
||||
(common::OBSW_VERSION_REVISION << 8);
|
||||
uint32_t p2 = 0;
|
||||
if (strcmp("", common::OBSW_VERSION_CST_GIT_SHA1) != 0) {
|
||||
p1 |= 1;
|
||||
auto shaAsStr = std::string(common::OBSW_VERSION_CST_GIT_SHA1);
|
||||
size_t posDash = shaAsStr.find("-");
|
||||
auto gitHash = shaAsStr.substr(posDash + 2, 4);
|
||||
// Only copy first 4 letters of git hash
|
||||
memcpy(&p2, gitHash.c_str(), 4);
|
||||
}
|
||||
|
||||
triggerEvent(VERSION_INFO, p1, p2);
|
||||
p1 = (core::FW_VERSION_MAJOR << 24) | (core::FW_VERSION_MINOR << 16) |
|
||||
(core::FW_VERSION_REVISION << 8) | (core::FW_VERSION_HAS_SHA);
|
||||
std::memcpy(&p2, core::FW_VERSION_GIT_SHA, 4);
|
||||
triggerEvent(FIRMWARE_INFO, p1, p2);
|
||||
}
|
||||
|
||||
void CoreController::announceCurrentImageInfo() {
|
||||
using namespace core;
|
||||
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::performGracefulShutdown(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||
bool protOpPerformed = false;
|
||||
// This function can not really fail
|
||||
gracefulShutdownTasks(tgtChip, tgtCopy, protOpPerformed);
|
||||
|
||||
switch (tgtChip) {
|
||||
case (xsc::Chip::CHIP_0): {
|
||||
switch (tgtCopy) {
|
||||
case (xsc::Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case (xsc::Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (xsc::Chip::CHIP_1): {
|
||||
switch (tgtCopy) {
|
||||
case (xsc::Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case (xsc::Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void CoreController::announceSdInfo(SdCardManager::SdStatePair sdStates) {
|
||||
auto activeSdCard = sdcMan->getActiveSdCard();
|
||||
uint32_t p1 = sd::SdCard::NONE;
|
||||
if (activeSdCard.has_value()) {
|
||||
p1 = static_cast<uint32_t>(activeSdCard.value());
|
||||
}
|
||||
uint32_t p2 =
|
||||
(static_cast<uint32_t>(sdStates.first) << 16) | static_cast<uint32_t>(sdStates.second);
|
||||
triggerEvent(core::ACTIVE_SD_INFO, p1, p2);
|
||||
}
|
||||
|
||||
bool CoreController::isNumber(const std::string &s) {
|
||||
return !s.empty() && std::find_if(s.begin(), s.end(),
|
||||
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
||||
|
@ -1,11 +1,13 @@
|
||||
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||
|
||||
#include <bsp_q7s/core/defs.h>
|
||||
#include <fsfw/container/DynamicFIFO.h>
|
||||
#include <fsfw/container/SimpleRingBuffer.h>
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include <fsfw/parameters/ParameterHelper.h>
|
||||
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
||||
#include <fsfw_hal/linux/uio/UioMapper.h>
|
||||
#include <libxiphos.h>
|
||||
#include <mission/acs/archive/GPSDefinitions.h>
|
||||
#include <mission/utility/trace.h>
|
||||
@ -13,7 +15,6 @@
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
|
||||
#include "CoreDefinitions.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/fs/SdCardManager.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
@ -23,7 +24,7 @@
|
||||
class Timer;
|
||||
class SdCardManager;
|
||||
|
||||
struct RebootFile {
|
||||
struct RebootWatchdogFile {
|
||||
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
||||
|
||||
bool enabled = true;
|
||||
@ -44,6 +45,93 @@ struct RebootFile {
|
||||
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
|
||||
};
|
||||
|
||||
class RebootWatchdogPacket : public SerialLinkedListAdapter<SerializeIF> {
|
||||
public:
|
||||
RebootWatchdogPacket(RebootWatchdogFile& rf) {
|
||||
enabled = rf.enabled;
|
||||
maxCount = rf.maxCount;
|
||||
img00Count = rf.img00Cnt;
|
||||
img01Count = rf.img01Cnt;
|
||||
img10Count = rf.img10Cnt;
|
||||
img11Count = rf.img11Cnt;
|
||||
img00Lock = rf.img00Lock;
|
||||
img01Lock = rf.img01Lock;
|
||||
img10Lock = rf.img10Lock;
|
||||
img11Lock = rf.img11Lock;
|
||||
lastChip = static_cast<uint8_t>(rf.lastChip);
|
||||
lastCopy = static_cast<uint8_t>(rf.lastCopy);
|
||||
nextChip = static_cast<uint8_t>(rf.mechanismNextChip);
|
||||
nextCopy = static_cast<uint8_t>(rf.mechanismNextCopy);
|
||||
setLinks();
|
||||
}
|
||||
|
||||
private:
|
||||
void setLinks() {
|
||||
setStart(&enabled);
|
||||
enabled.setNext(&maxCount);
|
||||
maxCount.setNext(&img00Count);
|
||||
img00Count.setNext(&img01Count);
|
||||
img01Count.setNext(&img10Count);
|
||||
img10Count.setNext(&img11Count);
|
||||
img11Count.setNext(&img00Lock);
|
||||
img00Lock.setNext(&img01Lock);
|
||||
img01Lock.setNext(&img10Lock);
|
||||
img10Lock.setNext(&img11Lock);
|
||||
img11Lock.setNext(&lastChip);
|
||||
lastChip.setNext(&lastCopy);
|
||||
lastCopy.setNext(&nextChip);
|
||||
nextChip.setNext(&nextCopy);
|
||||
setLast(&nextCopy);
|
||||
}
|
||||
|
||||
SerializeElement<uint8_t> enabled = false;
|
||||
SerializeElement<uint32_t> maxCount = 0;
|
||||
SerializeElement<uint32_t> img00Count = 0;
|
||||
SerializeElement<uint32_t> img01Count = 0;
|
||||
SerializeElement<uint32_t> img10Count = 0;
|
||||
SerializeElement<uint32_t> img11Count = 0;
|
||||
SerializeElement<uint8_t> img00Lock = false;
|
||||
SerializeElement<uint8_t> img01Lock = false;
|
||||
SerializeElement<uint8_t> img10Lock = false;
|
||||
SerializeElement<uint8_t> img11Lock = false;
|
||||
SerializeElement<uint8_t> lastChip = 0;
|
||||
SerializeElement<uint8_t> lastCopy = 0;
|
||||
SerializeElement<uint8_t> nextChip = 0;
|
||||
SerializeElement<uint8_t> nextCopy = 0;
|
||||
};
|
||||
|
||||
struct RebootCountersFile {
|
||||
// 16 bit values so all boot counters fit into one event.
|
||||
uint16_t img00Cnt = 0;
|
||||
uint16_t img01Cnt = 0;
|
||||
uint16_t img10Cnt = 0;
|
||||
uint16_t img11Cnt = 0;
|
||||
};
|
||||
|
||||
class RebootCountersPacket : public SerialLinkedListAdapter<SerializeIF> {
|
||||
RebootCountersPacket(RebootCountersFile& rf) {
|
||||
img00Count = rf.img00Cnt;
|
||||
img01Count = rf.img01Cnt;
|
||||
img10Count = rf.img10Cnt;
|
||||
img11Count = rf.img11Cnt;
|
||||
setLinks();
|
||||
}
|
||||
|
||||
private:
|
||||
void setLinks() {
|
||||
setStart(&img00Count);
|
||||
img00Count.setNext(&img01Count);
|
||||
img01Count.setNext(&img10Count);
|
||||
img10Count.setNext(&img11Count);
|
||||
setLast(&img11Count);
|
||||
}
|
||||
|
||||
SerializeElement<uint16_t> img00Count = 0;
|
||||
SerializeElement<uint16_t> img01Count = 0;
|
||||
SerializeElement<uint16_t> img10Count = 0;
|
||||
SerializeElement<uint16_t> img11Count = 0;
|
||||
};
|
||||
|
||||
class CoreController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
|
||||
public:
|
||||
enum ParamId : uint8_t { PREF_SD = 0, NUM_IDS };
|
||||
@ -57,10 +145,15 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
||||
|
||||
const std::string VERSION_FILE =
|
||||
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::VERSION_FILE_NAME);
|
||||
const std::string REBOOT_FILE =
|
||||
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::REBOOT_FILE_NAME);
|
||||
const std::string LEGACY_REBOOT_WATCHDOG_FILE =
|
||||
"/" + std::string(core::CONF_FOLDER) + "/" +
|
||||
std::string(core::LEGACY_REBOOT_WATCHDOG_FILE_NAME);
|
||||
const std::string REBOOT_WATCHDOG_FILE =
|
||||
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::REBOOT_WATCHDOG_FILE_NAME);
|
||||
const std::string BACKUP_TIME_FILE =
|
||||
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::TIME_FILE_NAME);
|
||||
const std::string REBOOT_COUNTERS_FILE =
|
||||
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::REBOOT_COUNTER_FILE_NAME);
|
||||
|
||||
static constexpr char CHIP_0_COPY_0_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi0-nom-rootfs";
|
||||
static constexpr char CHIP_0_COPY_1_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi0-gold-rootfs";
|
||||
@ -142,6 +235,7 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
||||
|
||||
static constexpr bool BLOCKING_SD_INIT = false;
|
||||
|
||||
uint32_t* mappedSysRomAddr = nullptr;
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
|
||||
@ -177,7 +271,22 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
||||
DeviceCommandId_t actionId;
|
||||
} sdCommandingInfo;
|
||||
|
||||
RebootFile rebootFile = {};
|
||||
struct DirListingDumpContext {
|
||||
bool active;
|
||||
bool firstDump;
|
||||
size_t dumpedBytes;
|
||||
size_t totalFileSize;
|
||||
size_t listingDataOffset;
|
||||
size_t maxDumpLen;
|
||||
uint32_t segmentIdx;
|
||||
MessageQueueId_t commander = MessageQueueIF::NO_QUEUE;
|
||||
DeviceCommandId_t actionId;
|
||||
};
|
||||
std::array<uint8_t, 1024> dirListingBuf{};
|
||||
DirListingDumpContext dumpContext{};
|
||||
|
||||
RebootWatchdogFile rebootWatchdogFile = {};
|
||||
RebootCountersFile rebootCountersFile = {};
|
||||
|
||||
CommandExecutor cmdExecutor;
|
||||
SimpleRingBuffer cmdReplyBuf;
|
||||
@ -247,12 +356,14 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||
void executeNextExternalSdCommand();
|
||||
void checkExternalSdCommandStatus();
|
||||
void performRebootFileHandling(bool recreateFile);
|
||||
void performRebootWatchdogHandling(bool recreateFile);
|
||||
void performRebootCountersHandling(bool recreateFile);
|
||||
|
||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
ReturnValue_t actionListDirectoryDumpDirectly(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
ReturnValue_t performGracefulShutdown(xsc::Chip targetChip, xsc::Copy targetCopy);
|
||||
|
||||
ReturnValue_t actionListDirectoryCommonCommandCreator(const uint8_t* data, size_t size,
|
||||
std::ostringstream& oss);
|
||||
@ -266,14 +377,20 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
||||
int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
|
||||
void rebootWatchdogAlgorithm(RebootWatchdogFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
|
||||
xsc::Copy& tgtCopy);
|
||||
void resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||
void resetRebootWatchdogCounters(xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||
bool parseRebootFile(std::string path, RebootFile& file);
|
||||
void rewriteRebootFile(RebootFile file);
|
||||
bool parseRebootWatchdogFile(std::string path, RebootWatchdogFile& file);
|
||||
bool parseRebootCountersFile(std::string path, RebootCountersFile& file);
|
||||
void rewriteRebootWatchdogFile(RebootWatchdogFile file);
|
||||
void rewriteRebootCountersFile(RebootCountersFile file);
|
||||
void announceBootCounts();
|
||||
void announceVersionInfo();
|
||||
void announceCurrentImageInfo();
|
||||
void announceSdInfo(SdCardManager::SdStatePair sdStates);
|
||||
void readHkData();
|
||||
void dirListingDumpHandler();
|
||||
bool isNumber(const std::string& s);
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,16 @@
|
||||
#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
|
||||
#define BSP_Q7S_CORE_COREDEFINITIONS_H_
|
||||
#ifndef BSP_Q7S_CORE_DEFS_H_
|
||||
#define BSP_Q7S_CORE_DEFS_H_
|
||||
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
|
||||
namespace core {
|
||||
|
||||
extern uint8_t FW_VERSION_MAJOR;
|
||||
extern uint8_t FW_VERSION_MINOR;
|
||||
extern uint8_t FW_VERSION_REVISION;
|
||||
extern bool FW_VERSION_HAS_SHA;
|
||||
extern char FW_VERSION_GIT_SHA[4];
|
||||
|
||||
static const uint8_t HK_SET_ENTRIES = 3;
|
||||
static const uint32_t HK_SET_ID = 5;
|
||||
|
||||
@ -36,4 +42,4 @@ class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
||||
|
||||
} // namespace core
|
||||
|
||||
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */
|
||||
#endif /* BSP_Q7S_CORE_DEFS_H_ */
|
@ -1,4 +1,5 @@
|
||||
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
|
||||
#include <bsp_q7s/objectFactory.h>
|
||||
#include <dummies/ComCookieDummy.h>
|
||||
#include <dummies/PcduHandlerDummy.h>
|
||||
#include <fsfw/health/HealthTableIF.h>
|
||||
@ -10,8 +11,8 @@
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/core/CoreController.h"
|
||||
#include "bsp_q7s/core/ObjectFactory.h"
|
||||
#include "busConf.h"
|
||||
#include "common/config/devices/addresses.h"
|
||||
#include "devConf.h"
|
||||
#include "dummies/helperFactory.h"
|
||||
#include "eive/objects.h"
|
||||
@ -35,18 +36,20 @@ void ObjectFactory::produce(void* args) {
|
||||
#endif
|
||||
|
||||
PersistentTmStores stores;
|
||||
readFirmwareVersion();
|
||||
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
|
||||
*SdCardManager::instance(), &ipcStore, &tmStore, stores,
|
||||
200);
|
||||
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
|
||||
enableHkSets);
|
||||
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
SerialComIF* uartComIF = nullptr;
|
||||
SpiComIF* spiMainComIF = nullptr;
|
||||
I2cComIF* i2cComIF = nullptr;
|
||||
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF);
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
// Adding GPIOs for chip select decoding and initializing them.
|
||||
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
|
||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||
createPlI2cResetGpio(gpioComIF);
|
||||
|
||||
// Hardware is usually not connected to EM, so we need to create dummies which replace lower
|
||||
// level components.
|
||||
@ -59,11 +62,32 @@ void ObjectFactory::produce(void* args) {
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1 || OBSW_ADD_PLOC_MPSOC == 1
|
||||
dummyCfg.addPlocDummies = false;
|
||||
#endif
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd = {{
|
||||
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
|
||||
{objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
|
||||
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
|
||||
}};
|
||||
createTmpComponents(tmpDevsToAdd);
|
||||
dummy::Tmp1075Cfg tmpCfg{};
|
||||
tmpCfg.addTcsBrd0 = true;
|
||||
tmpCfg.addTcsBrd1 = true;
|
||||
tmpCfg.addPlPcdu0 = false;
|
||||
tmpCfg.addPlPcdu1 = false;
|
||||
tmpCfg.addIfBrd = false;
|
||||
dummyCfg.tmp1075Cfg = tmpCfg;
|
||||
#endif
|
||||
#if OBSW_ADD_GOMSPACE_PCDU == 1
|
||||
dummyCfg.addPowerDummies = false;
|
||||
// The ACU broke.
|
||||
dummyCfg.addOnlyAcuDummy = true;
|
||||
#endif
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
dummyCfg.addStrDummy = false;
|
||||
#endif
|
||||
#if OBSW_ADD_SCEX_DEVICE == 0
|
||||
dummyCfg.addScexDummy = true;
|
||||
#endif
|
||||
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
||||
dummyCfg.addBpxBattDummy = false;
|
||||
#endif
|
||||
@ -83,24 +107,10 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
new CoreController(objects::CORE_CONTROLLER, enableHkSets);
|
||||
|
||||
// Regular FM code, does not work for EM if the hardware is not connected
|
||||
// createPcduComponents(gpioComIF, &pwrSwitcher);
|
||||
// createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
|
||||
// createSyrlinksComponents(pwrSwitcher);
|
||||
// createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
||||
// createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
|
||||
// createTmpComponents();
|
||||
// createSolarArrayDeploymentComponents();
|
||||
// createPayloadComponents(gpioComIF);
|
||||
// createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
|
||||
|
||||
// TODO: Careful! Switching this on somehow messes with the communication with the ProASIC
|
||||
// and will cause xsc_boot_copy commands to always boot to 0 0
|
||||
// createRadSensorComponent(gpioComIF);
|
||||
// Initialize chip select to avoid SPI bus issues.
|
||||
createRadSensorChipSelect(gpioComIF);
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
// Still initialize chip select to avoid SPI bus issues.
|
||||
createRadSensorChipSelect(gpioComIF);
|
||||
createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true,
|
||||
adis1650x::Type::ADIS16507);
|
||||
#else
|
||||
@ -110,8 +120,12 @@ void ObjectFactory::produce(void* args) {
|
||||
gpioChecker(gpioComIF->addGpios(acsBoardGpios), "ACS Board");
|
||||
#endif
|
||||
|
||||
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
|
||||
if (core::FW_VERSION_MAJOR >= 4) {
|
||||
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
|
||||
}
|
||||
#if OBSW_ADD_MGT == 1
|
||||
createImtqComponents(pwrSwitcher, enableHkSets);
|
||||
createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev);
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_SYRLINKS == 1
|
||||
@ -123,7 +137,7 @@ void ObjectFactory::produce(void* args) {
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
||||
createBpxBatteryComponent(enableHkSets);
|
||||
createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
@ -140,6 +154,7 @@ void ObjectFactory::produce(void* args) {
|
||||
#if OBSW_TM_TO_PTME == 1
|
||||
if (ccsdsArgs.liveDestination != nullptr) {
|
||||
pusFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
|
||||
cfdpFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
|
||||
}
|
||||
#endif
|
||||
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
|
||||
@ -154,7 +169,6 @@ void ObjectFactory::produce(void* args) {
|
||||
createAcsController(true, enableHkSets);
|
||||
HeaterHandler* heaterHandler;
|
||||
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
|
||||
createThermalController(*heaterHandler);
|
||||
createPowerController(enableHkSets);
|
||||
satsystem::init();
|
||||
createThermalController(*heaterHandler, true);
|
||||
satsystem::init(true);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
|
||||
#include <bsp_q7s/objectFactory.h>
|
||||
#include <devices/gpioIds.h>
|
||||
#include <fsfw/storagemanager/LocalPool.h>
|
||||
#include <fsfw/storagemanager/PoolManager.h>
|
||||
@ -7,9 +8,9 @@
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/core/CoreController.h"
|
||||
#include "bsp_q7s/core/ObjectFactory.h"
|
||||
#include "busConf.h"
|
||||
#include "devConf.h"
|
||||
#include "devices/addresses.h"
|
||||
#include "eive/objects.h"
|
||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "linux/ObjectFactory.h"
|
||||
@ -32,9 +33,10 @@ void ObjectFactory::produce(void* args) {
|
||||
#endif
|
||||
|
||||
PersistentTmStores stores;
|
||||
readFirmwareVersion();
|
||||
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
|
||||
*SdCardManager::instance(), &ipcStore, &tmStore, stores,
|
||||
200);
|
||||
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
|
||||
true);
|
||||
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
SerialComIF* uartComIF = nullptr;
|
||||
@ -45,6 +47,7 @@ void ObjectFactory::produce(void* args) {
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
|
||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||
createPlI2cResetGpio(gpioComIF);
|
||||
|
||||
new CoreController(objects::CORE_CONTROLLER, enableHkSets);
|
||||
createPcduComponents(gpioComIF, &pwrSwitcher, enableHkSets);
|
||||
@ -66,7 +69,16 @@ void ObjectFactory::produce(void* args) {
|
||||
HeaterHandler* heaterHandler;
|
||||
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
createTmpComponents();
|
||||
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd = {{
|
||||
{objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0},
|
||||
{objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1},
|
||||
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
|
||||
// damaged
|
||||
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
|
||||
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
|
||||
}};
|
||||
|
||||
createTmpComponents(tmpDevsToAdd);
|
||||
#endif
|
||||
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
|
||||
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
|
||||
@ -76,13 +88,17 @@ void ObjectFactory::produce(void* args) {
|
||||
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
|
||||
createPayloadComponents(gpioComIF, *pwrSwitcher);
|
||||
|
||||
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
|
||||
if (core::FW_VERSION_MAJOR >= 4) {
|
||||
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
|
||||
}
|
||||
#if OBSW_ADD_MGT == 1
|
||||
createImtqComponents(pwrSwitcher, enableHkSets);
|
||||
createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev);
|
||||
#endif
|
||||
createReactionWheelComponents(gpioComIF, pwrSwitcher);
|
||||
|
||||
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
||||
createBpxBatteryComponent(enableHkSets);
|
||||
createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
@ -97,6 +113,7 @@ void ObjectFactory::produce(void* args) {
|
||||
#if OBSW_TM_TO_PTME == 1
|
||||
if (ccsdsArgs.liveDestination != nullptr) {
|
||||
pusFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
|
||||
cfdpFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
|
||||
}
|
||||
#endif
|
||||
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
|
||||
@ -111,8 +128,7 @@ void ObjectFactory::produce(void* args) {
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
createMiscComponents();
|
||||
createThermalController(*heaterHandler);
|
||||
createThermalController(*heaterHandler, false);
|
||||
createAcsController(true, enableHkSets);
|
||||
createPowerController(enableHkSets);
|
||||
satsystem::init();
|
||||
satsystem::init(false);
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "ObjectFactory.h"
|
||||
#include "objectFactory.h"
|
||||
|
||||
#include <fsfw/devicehandlers/HealthDevice.h>
|
||||
#include <fsfw/subsystem/Subsystem.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw_hal/linux/uio/UioMapper.h>
|
||||
#include <linux/acs/AcsBoardPolling.h>
|
||||
#include <linux/acs/GpsHyperionLinuxController.h>
|
||||
#include <linux/acs/ImtqPollingTask.h>
|
||||
@ -31,6 +33,9 @@
|
||||
#include <mission/system/objects/CamSwitcher.h>
|
||||
#include <mission/system/tcs/TmpDevFdir.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
||||
#include "bsp_q7s/callbacks/gnssCallback.h"
|
||||
@ -99,6 +104,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "bsp_q7s/core/defs.h"
|
||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||
@ -129,6 +135,11 @@ ResetArgs RESET_ARGS_GNSS;
|
||||
std::atomic_bool LINK_STATE = CcsdsIpCoreHandler::LINK_DOWN;
|
||||
std::atomic_bool PTME_LOCKED = false;
|
||||
std::atomic_uint16_t I2C_FATAL_ERRORS = 0;
|
||||
uint8_t core::FW_VERSION_MAJOR = 0;
|
||||
uint8_t core::FW_VERSION_MINOR = 0;
|
||||
uint8_t core::FW_VERSION_REVISION = 0;
|
||||
bool core::FW_VERSION_HAS_SHA = false;
|
||||
char core::FW_VERSION_GIT_SHA[4] = {};
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
@ -150,28 +161,23 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
|
||||
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
||||
|
||||
void ObjectFactory::createTmpComponents() {
|
||||
std::vector<std::pair<object_id_t, address_t>> tmpDevIds = {{
|
||||
{objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0},
|
||||
{objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1},
|
||||
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
|
||||
// damaged
|
||||
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
|
||||
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
|
||||
}};
|
||||
void ObjectFactory::createTmpComponents(
|
||||
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd) {
|
||||
const char* tmpI2cDev = q7s::I2C_PS_EIVE;
|
||||
if (core::FW_VERSION_MAJOR == 4) {
|
||||
tmpI2cDev = q7s::I2C_PL_EIVE;
|
||||
} else if (core::FW_VERSION_MAJOR >= 5) {
|
||||
tmpI2cDev = q7s::I2C_Q7_EIVE;
|
||||
}
|
||||
std::vector<I2cCookie*> tmpDevCookies;
|
||||
|
||||
for (size_t idx = 0; idx < tmpDevIds.size(); idx++) {
|
||||
for (size_t idx = 0; idx < tmpDevsToAdd.size(); idx++) {
|
||||
tmpDevCookies.push_back(
|
||||
new I2cCookie(tmpDevIds[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_PS_EIVE));
|
||||
new I2cCookie(tmpDevsToAdd[idx].second, TMP1075::MAX_REPLY_LENGTH, tmpI2cDev));
|
||||
auto* tmpDevHandler =
|
||||
new Tmp1075Handler(tmpDevIds[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]);
|
||||
tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevIds[idx].first));
|
||||
new Tmp1075Handler(tmpDevsToAdd[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]);
|
||||
tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first));
|
||||
tmpDevHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
|
||||
// TODO: Remove this after TCS subsystem was added
|
||||
// These devices are connected to the 3V3 stack and should be powered permanently. Therefore,
|
||||
// we set them to normal mode immediately here.
|
||||
tmpDevHandler->setModeNormal();
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +249,7 @@ ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF,
|
||||
createRadSensorChipSelect(gpioComIF);
|
||||
|
||||
SpiCookie* spiCookieRadSensor =
|
||||
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, RAD_SENSOR::READ_SIZE,
|
||||
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, radSens::READ_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
spiCookieRadSensor->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RAD_SENSOR_CS_TIMEOUT);
|
||||
auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_MAIN_COM_IF,
|
||||
@ -505,7 +511,7 @@ void ObjectFactory::createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF*
|
||||
debugGps = true;
|
||||
#endif
|
||||
RESET_ARGS_GNSS.gpioComIF = gpioComIF;
|
||||
RESET_ARGS_GNSS.waitPeriodMs = 100;
|
||||
RESET_ARGS_GNSS.waitPeriodMs = 5;
|
||||
auto gpsCtrl = new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT,
|
||||
enableHkSets, debugGps);
|
||||
gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS);
|
||||
@ -931,16 +937,7 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
|
||||
starTrackerCookie->setNoFixedSizeReply();
|
||||
StrComHandler* strComIF = new StrComHandler(objects::STR_COM_IF);
|
||||
|
||||
const char* paramJsonFile = nullptr;
|
||||
#ifdef EGSE
|
||||
paramJsonFile = "/home/pi/arcsec/json/flight-config.json";
|
||||
#else
|
||||
#if OBSW_STAR_TRACKER_GROUND_CONFIG == 1
|
||||
paramJsonFile = "/mnt/sd0/startracker/ground-config.json";
|
||||
#else
|
||||
paramJsonFile = "/mnt/sd0/startracker/flight-config.json";
|
||||
#endif
|
||||
#endif
|
||||
const char* paramJsonFile = "/mnt/sd0/startracker/flight-config.json";
|
||||
if (paramJsonFile == nullptr) {
|
||||
sif::error << "No valid Star Tracker parameter JSON file" << std::endl;
|
||||
}
|
||||
@ -953,12 +950,13 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
|
||||
starTracker->setCustomFdir(strFdir);
|
||||
}
|
||||
|
||||
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets) {
|
||||
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets,
|
||||
const char* i2cDev) {
|
||||
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
|
||||
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
|
||||
|
||||
new ImtqPollingTask(objects::IMTQ_POLLING, I2C_FATAL_ERRORS);
|
||||
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, imtq::MAX_REPLY_SIZE, q7s::I2C_PL_EIVE);
|
||||
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, imtq::MAX_REPLY_SIZE, i2cDev);
|
||||
auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::IMTQ_POLLING, imtqI2cCookie,
|
||||
power::Switches::PDU1_CH3_MGT_5V, enableHkSets);
|
||||
imtqHandler->enableThermalModule(ThermalStateCfg());
|
||||
@ -974,8 +972,8 @@ void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enable
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectFactory::createBpxBatteryComponent(bool enableHkSets) {
|
||||
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_PL_EIVE);
|
||||
void ObjectFactory::createBpxBatteryComponent(bool enableHkSets, const char* i2cDev) {
|
||||
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, i2cDev);
|
||||
BpxBatteryHandler* bpxHandler = new BpxBatteryHandler(
|
||||
objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie, enableHkSets);
|
||||
bpxHandler->setStartUpImmediately();
|
||||
@ -1013,3 +1011,50 @@ void ObjectFactory::createRadSensorChipSelect(LinuxLibgpioIF* gpioIF) {
|
||||
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
|
||||
gpioChecker(gpioIF->addGpios(gpioCookieRadSensor), "RAD sensor");
|
||||
}
|
||||
|
||||
void ObjectFactory::createPlI2cResetGpio(LinuxLibgpioIF* gpioIF) {
|
||||
using namespace gpio;
|
||||
if (common::OBSW_VERSION_MAJOR >= 6 or common::OBSW_VERSION_MAJOR == 4) {
|
||||
if (gpioIF == nullptr) {
|
||||
return;
|
||||
}
|
||||
GpioCookie* gpioI2cResetnCookie = new GpioCookie;
|
||||
GpiodRegularByLineName* gpioI2cResetn = new GpiodRegularByLineName(
|
||||
q7s::gpioNames::PL_I2C_ARESETN, "PL_I2C_ARESETN", Direction::OUT, Levels::HIGH);
|
||||
gpioI2cResetnCookie->addGpio(gpioIds::PL_I2C_ARESETN, gpioI2cResetn);
|
||||
gpioChecker(gpioIF->addGpios(gpioI2cResetnCookie), "PL I2C ARESETN");
|
||||
// Reset I2C explicitely again.
|
||||
gpioIF->pullLow(gpioIds::PL_I2C_ARESETN);
|
||||
TaskFactory::delayTask(1);
|
||||
gpioIF->pullHigh(gpioIds::PL_I2C_ARESETN);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t ObjectFactory::readFirmwareVersion() {
|
||||
uint32_t* mappedSysRomAddr = nullptr;
|
||||
// The SYS ROM FPGA block is only available in those versions.
|
||||
if (not(common::OBSW_VERSION_MAJOR >= 6) or (common::OBSW_VERSION_MAJOR == 4)) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
// This has to come before the version announce because it might be required for retrieving
|
||||
// the firmware version.
|
||||
UioMapper sysRomMapper(q7s::UIO_SYS_ROM);
|
||||
ReturnValue_t result =
|
||||
sysRomMapper.getMappedAdress(&mappedSysRomAddr, UioMapper::Permissions::READ_ONLY);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "Getting mapped SYS ROM UIO address failed" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
if (mappedSysRomAddr != nullptr) {
|
||||
uint32_t firstEntry = *(reinterpret_cast<uint32_t*>(mappedSysRomAddr));
|
||||
uint32_t secondEntry = *(reinterpret_cast<uint32_t*>(mappedSysRomAddr) + 1);
|
||||
core::FW_VERSION_MAJOR = (firstEntry >> 24) & 0xff;
|
||||
core::FW_VERSION_MINOR = (firstEntry >> 16) & 0xff;
|
||||
core::FW_VERSION_REVISION = (firstEntry >> 8) & 0xff;
|
||||
bool hasGitSha = (firstEntry & 0x0b1);
|
||||
if (hasGitSha) {
|
||||
std::memcpy(core::FW_VERSION_GIT_SHA, &secondEntry, 4);
|
||||
}
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
@ -58,7 +58,7 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
|
||||
bool enableHkSets);
|
||||
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||
PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler);
|
||||
void createTmpComponents();
|
||||
void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd);
|
||||
void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF);
|
||||
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
|
||||
void createAcsBoardGpios(GpioCookie& cookie);
|
||||
@ -67,17 +67,19 @@ void createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF* gpioComIF, Ser
|
||||
adis1650x::Type adisType);
|
||||
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable,
|
||||
HeaterHandler*& heaterHandler);
|
||||
void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets);
|
||||
void createBpxBatteryComponent(bool enableHkSets);
|
||||
void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets, const char* i2cDev);
|
||||
void createBpxBatteryComponent(bool enableHkSets, const char* i2cDev);
|
||||
void createStrComponents(PowerSwitchIF* pwrSwitcher);
|
||||
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
|
||||
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
||||
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
|
||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
|
||||
ReturnValue_t createCcsdsComponents(CcsdsComponentArgs& args);
|
||||
ReturnValue_t readFirmwareVersion();
|
||||
void createMiscComponents();
|
||||
|
||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createPlI2cResetGpio(LinuxLibgpioIF* gpioComIF);
|
||||
|
||||
void testAcsBrdAss(AcsBoardAssembly* assAss);
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/core/WatchdogHandler.h"
|
||||
#include "commonConfig.h"
|
||||
#include "core/scheduling.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "fsfw/version.h"
|
||||
#include "mission/acs/defs.h"
|
||||
#include "mission/com/defs.h"
|
||||
#include "mission/system/systemTree.h"
|
||||
#include "q7sConfig.h"
|
||||
#include "scheduling.h"
|
||||
#include "watchdog/definitions.h"
|
||||
|
||||
static constexpr int OBSW_ALREADY_RUNNING = -2;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/core/ObjectFactory.h"
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||
#include "fsfw/platform.h"
|
||||
@ -21,6 +20,8 @@
|
||||
#include "mission/pollingSeqTables.h"
|
||||
#include "mission/scheduling.h"
|
||||
#include "mission/utility/InitMission.h"
|
||||
#include "objectFactory.h"
|
||||
#include "q7sConfig.h"
|
||||
|
||||
/* This is configured for linux without CR */
|
||||
#ifdef PLATFORM_UNIX
|
||||
@ -324,6 +325,10 @@ void scheduling::initTasks() {
|
||||
if (result != returnvalue::OK) {
|
||||
scheduling::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
|
||||
}
|
||||
result = tcsSystemTask->addComponent(objects::HEATER_HANDLER);
|
||||
if (result != returnvalue::OK) {
|
||||
scheduling::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_SYRLINKS == 1
|
||||
PeriodicTaskIF* syrlinksCom = factory->createPeriodicTask(
|
||||
@ -527,7 +532,15 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
|
||||
FixedTimeslotTaskIF* i2cPst =
|
||||
factory.createFixedTimeslotTask("I2C_PS_PST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.6,
|
||||
missedDeadlineFunc, &RR_SCHEDULING);
|
||||
result = pst::pstI2cProcessingSystem(i2cPst);
|
||||
pst::TmpSchedConfig tmpSchedConf;
|
||||
#if OBSW_Q7S_EM == 1
|
||||
tmpSchedConf.scheduleTmpDev0 = true;
|
||||
tmpSchedConf.scheduleTmpDev1 = true;
|
||||
tmpSchedConf.schedulePlPcduDev0 = true;
|
||||
tmpSchedConf.schedulePlPcduDev1 = true;
|
||||
tmpSchedConf.scheduleIfBoardDev = true;
|
||||
#endif
|
||||
result = pst::pstI2c(tmpSchedConf, i2cPst);
|
||||
if (result != returnvalue::OK) {
|
||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||
sif::warning << "scheduling::initTasks: I2C PST is empty" << std::endl;
|
@ -129,7 +129,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
||||
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
char valstring[MAX_STR_LENGTH] = "";
|
||||
char valstring[MAX_STR_LENGTH]{};
|
||||
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
|
||||
if (returnVal == nullptr) {
|
||||
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
|
||||
@ -139,6 +139,11 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
||||
}
|
||||
std::istringstream valSstream(valstring);
|
||||
valSstream >> val;
|
||||
if (valSstream.bad()) {
|
||||
sif::warning << "Xadc: Conversion of value to target type failed" << std::endl;
|
||||
fclose(fp);
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
fclose(fp);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ enum gpioId_t {
|
||||
CS_RAD_SENSOR,
|
||||
ENABLE_RADFET,
|
||||
|
||||
PL_I2C_ARESETN,
|
||||
|
||||
PAPB_BUSY_N,
|
||||
PAPB_EMPTY,
|
||||
|
||||
|
@ -11,6 +11,8 @@ static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1";
|
||||
static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz";
|
||||
static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped";
|
||||
static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt";
|
||||
static constexpr char PUS_SEQUENCE_COUNT_FILE[] = "pus-sequence-count.txt";
|
||||
static constexpr char CFDP_SEQUENCE_COUNT_FILE[] = "cfdp-sequence-count.txt";
|
||||
|
||||
static constexpr char OBSW_PATH[] = "/usr/bin/eive-obsw";
|
||||
static constexpr char OBSW_VERSION_FILE_PATH[] = "/usr/share/eive-obsw/obsw_version.txt";
|
||||
@ -58,7 +60,9 @@ static constexpr uint32_t CFDP_STORE_QUEUE_SIZE = 300;
|
||||
|
||||
static constexpr uint32_t MAX_PUS_FUNNEL_QUEUE_DEPTH = 100;
|
||||
static constexpr uint32_t MAX_CFDP_FUNNEL_QUEUE_DEPTH = 80;
|
||||
static constexpr uint32_t VERIFICATION_SERVICE_QUEUE_DEPTH = 120;
|
||||
static constexpr uint32_t HK_SERVICE_QUEUE_DEPTH = 60;
|
||||
static constexpr uint32_t ACTION_SERVICE_QUEUE_DEPTH = 60;
|
||||
|
||||
static constexpr uint32_t MAX_STORED_CMDS_UDP = 150;
|
||||
static constexpr uint32_t MAX_STORED_CMDS_TCP = 180;
|
||||
|
@ -19,6 +19,7 @@ target_sources(
|
||||
GpsCtrlDummy.cpp
|
||||
GyroAdisDummy.cpp
|
||||
GyroL3GD20Dummy.cpp
|
||||
RadSensorDummy.cpp
|
||||
MgmLIS3MDLDummy.cpp
|
||||
PlPcduDummy.cpp
|
||||
ExecutableComIfDummy.cpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "CoreControllerDummy.h"
|
||||
|
||||
#include <bsp_q7s/core/CoreDefinitions.h>
|
||||
#include <bsp_q7s/core/defs.h>
|
||||
#include <objects/systemObjectList.h>
|
||||
|
||||
#include <cmath>
|
||||
|
@ -5,14 +5,19 @@
|
||||
ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
|
||||
power::Switch_t pwrSwitcher, bool enableHkSets)
|
||||
: DeviceHandlerBase(objectId, comif, comCookie),
|
||||
setNoTorque(this),
|
||||
setWithTorque(this),
|
||||
enableHkSets(enableHkSets),
|
||||
statusSet(this),
|
||||
dipoleSet(*this),
|
||||
rawMtmNoTorque(this),
|
||||
hkDatasetNoTorque(this),
|
||||
rawMtmWithTorque(this),
|
||||
hkDatasetWithTorque(this),
|
||||
calMtmMeasurementSet(this),
|
||||
switcher(pwrSwitcher) {}
|
||||
|
||||
ImtqDummy::~ImtqDummy() = default;
|
||||
|
||||
void ImtqDummy::doStartUp() { setMode(MODE_NORMAL); }
|
||||
void ImtqDummy::doStartUp() { setMode(MODE_ON); }
|
||||
|
||||
void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
||||
|
||||
@ -79,17 +84,37 @@ ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataP
|
||||
localDataPoolMap.emplace(imtq::MCU_TEMPERATURE_WT, new PoolEntry<int16_t>({0}));
|
||||
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(setNoTorque.getSid(), enableHkSets, 30.0));
|
||||
subdp::DiagnosticsHkPeriodicParams(hkDatasetNoTorque.getSid(), enableHkSets, 30.0));
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(setWithTorque.getSid(), enableHkSets, 30.0));
|
||||
subdp::DiagnosticsHkPeriodicParams(hkDatasetWithTorque.getSid(), enableHkSets, 30.0));
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(rawMtmNoTorque.getSid(), false, 10.0));
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(rawMtmWithTorque.getSid(), false, 10.0));
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(calMtmMeasurementSet.getSid(), false, 10.0));
|
||||
poolManager.subscribeForRegularPeriodicPacket(
|
||||
subdp::RegularHkPeriodicParams(statusSet.getSid(), false, 10.0));
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(dipoleSet.getSid(), false, 10.0));
|
||||
return DeviceHandlerBase::initializeLocalDataPool(localDataPoolMap, poolManager);
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase *ImtqDummy::getDataSetHandle(sid_t sid) {
|
||||
if (sid == setNoTorque.getSid()) {
|
||||
return &setNoTorque;
|
||||
} else if (sid == setWithTorque.getSid()) {
|
||||
return &setWithTorque;
|
||||
if (sid == hkDatasetNoTorque.getSid()) {
|
||||
return &hkDatasetNoTorque;
|
||||
} else if (sid == dipoleSet.getSid()) {
|
||||
return &dipoleSet;
|
||||
} else if (sid == statusSet.getSid()) {
|
||||
return &statusSet;
|
||||
} else if (sid == hkDatasetWithTorque.getSid()) {
|
||||
return &hkDatasetWithTorque;
|
||||
} else if (sid == rawMtmWithTorque.getSid()) {
|
||||
return &rawMtmWithTorque;
|
||||
} else if (sid == calMtmMeasurementSet.getSid()) {
|
||||
return &calMtmMeasurementSet;
|
||||
} else if (sid == rawMtmNoTorque.getSid()) {
|
||||
return &rawMtmNoTorque;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -18,11 +18,18 @@ class ImtqDummy : public DeviceHandlerBase {
|
||||
~ImtqDummy() override;
|
||||
|
||||
protected:
|
||||
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
|
||||
imtq::HkDatasetNoTorque setNoTorque;
|
||||
imtq::HkDatasetWithTorque setWithTorque;
|
||||
bool enableHkSets;
|
||||
|
||||
imtq::StatusDataset statusSet;
|
||||
imtq::DipoleActuationSet dipoleSet;
|
||||
imtq::RawMtmMeasurementNoTorque rawMtmNoTorque;
|
||||
imtq::HkDatasetNoTorque hkDatasetNoTorque;
|
||||
|
||||
imtq::RawMtmMeasurementWithTorque rawMtmWithTorque;
|
||||
imtq::HkDatasetWithTorque hkDatasetWithTorque;
|
||||
|
||||
imtq::CalibratedMtmMeasurementSet calMtmMeasurementSet;
|
||||
|
||||
PoolEntry<uint8_t> statusMode = PoolEntry<uint8_t>({0});
|
||||
PoolEntry<uint8_t> statusError = PoolEntry<uint8_t>({0});
|
||||
PoolEntry<uint8_t> statusConfig = PoolEntry<uint8_t>({0});
|
||||
@ -42,6 +49,8 @@ class ImtqDummy : public DeviceHandlerBase {
|
||||
|
||||
power::Switch_t switcher = power::NO_SWITCH;
|
||||
|
||||
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
|
||||
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||
|
@ -7,15 +7,21 @@ using namespace returnvalue;
|
||||
Max31865Dummy::Max31865Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||
: DeviceHandlerBase(objectId, comif, comCookie), set(this, EiveMax31855::EXCHANGE_SET_ID) {}
|
||||
void Max31865Dummy::doStartUp() { setMode(MODE_ON); }
|
||||
void Max31865Dummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
||||
void Max31865Dummy::doShutDown() {
|
||||
PoolReadGuard pg(&set);
|
||||
set.setValidity(false, true);
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
ReturnValue_t Max31865Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
ReturnValue_t Max31865Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { return OK; }
|
||||
ReturnValue_t Max31865Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
ReturnValue_t Max31865Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
return 0;
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
ReturnValue_t Max31865Dummy::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
|
@ -7,7 +7,7 @@ PlPcduDummy::PlPcduDummy(object_id_t objectId, object_id_t comif, CookieIF *comC
|
||||
|
||||
PlPcduDummy::~PlPcduDummy() {}
|
||||
|
||||
void PlPcduDummy::doStartUp() { setMode(MODE_NORMAL); }
|
||||
void PlPcduDummy::doStartUp() { setMode(MODE_ON); }
|
||||
|
||||
void PlPcduDummy::doShutDown() { setMode(MODE_OFF); }
|
||||
|
||||
|
55
dummies/RadSensorDummy.cpp
Normal file
55
dummies/RadSensorDummy.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "RadSensorDummy.h"
|
||||
|
||||
RadSensorDummy::RadSensorDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||
: DeviceHandlerBase(objectId, comif, comCookie), sensorSet(this) {}
|
||||
|
||||
RadSensorDummy::~RadSensorDummy() {}
|
||||
|
||||
void RadSensorDummy::doStartUp() { setMode(MODE_ON); }
|
||||
|
||||
void RadSensorDummy::doShutDown() { setMode(MODE_OFF); }
|
||||
|
||||
ReturnValue_t RadSensorDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t RadSensorDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t RadSensorDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t RadSensorDummy::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t RadSensorDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void RadSensorDummy::fillCommandAndReplyMap() {}
|
||||
|
||||
uint32_t RadSensorDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||
|
||||
ReturnValue_t RadSensorDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(radSens::TEMPERATURE_C, new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(radSens::AIN0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN6, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN7, new PoolEntry<uint16_t>({0}));
|
||||
poolManager.subscribeForRegularPeriodicPacket(
|
||||
subdp::RegularHkPeriodicParams(sensorSet.getSid(), false, 20.0));
|
||||
return returnvalue::OK;
|
||||
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase *RadSensorDummy::getDataSetHandle(sid_t sid) { return &sensorSet; }
|
35
dummies/RadSensorDummy.h
Normal file
35
dummies/RadSensorDummy.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
|
||||
#include "mission/payload/radSensorDefinitions.h"
|
||||
|
||||
class RadSensorDummy : public DeviceHandlerBase {
|
||||
public:
|
||||
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||
|
||||
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||
|
||||
RadSensorDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
|
||||
virtual ~RadSensorDummy();
|
||||
|
||||
protected:
|
||||
radSens::RadSensorDataset sensorSet;
|
||||
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||
size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) override;
|
||||
LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override;
|
||||
};
|
@ -3,13 +3,24 @@
|
||||
#include <mission/acs/rwHelpers.h>
|
||||
|
||||
RwDummy::RwDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||
: DeviceHandlerBase(objectId, comif, comCookie) {}
|
||||
: DeviceHandlerBase(objectId, comif, comCookie),
|
||||
|
||||
statusSet(this),
|
||||
lastResetStatusSet(this),
|
||||
tmDataset(this),
|
||||
rwSpeedActuationSet(*this) {}
|
||||
|
||||
RwDummy::~RwDummy() {}
|
||||
|
||||
void RwDummy::doStartUp() { setMode(MODE_ON); }
|
||||
void RwDummy::doStartUp() {
|
||||
statusSet.setReportingEnabled(true);
|
||||
setMode(MODE_ON);
|
||||
}
|
||||
|
||||
void RwDummy::doShutDown() { setMode(MODE_OFF); }
|
||||
void RwDummy::doShutDown() {
|
||||
statusSet.setReportingEnabled(false);
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
|
||||
ReturnValue_t RwDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
|
||||
|
||||
@ -74,5 +85,11 @@ ReturnValue_t RwDummy::initializeLocalDataPool(localpool::DataPool &localDataPoo
|
||||
localDataPoolMap.emplace(rws::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(rws::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(rws::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||
poolManager.subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams(statusSet.getSid(), false, 12.0));
|
||||
poolManager.subscribeForRegularPeriodicPacket(
|
||||
subdp::RegularHkPeriodicParams(tmDataset.getSid(), false, 30.0));
|
||||
poolManager.subscribeForRegularPeriodicPacket(
|
||||
subdp::RegularHkPeriodicParams(lastResetStatusSet.getSid(), false, 30.0));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define DUMMIES_RWDUMMY_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <mission/acs/rwHelpers.h>
|
||||
|
||||
class RwDummy : public DeviceHandlerBase {
|
||||
public:
|
||||
@ -15,6 +16,11 @@ class RwDummy : public DeviceHandlerBase {
|
||||
virtual ~RwDummy();
|
||||
|
||||
protected:
|
||||
rws::StatusSet statusSet;
|
||||
rws::LastResetSatus lastResetStatusSet;
|
||||
rws::TmDataset tmDataset;
|
||||
rws::RwSpeedActuationSet rwSpeedActuationSet;
|
||||
|
||||
PoolEntry<int32_t> rwSpeed = PoolEntry<int32_t>({0});
|
||||
PoolEntry<uint16_t> rampTime = PoolEntry<uint16_t>({10});
|
||||
|
||||
|
@ -5,7 +5,7 @@ SusDummy::SusDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||
|
||||
SusDummy::~SusDummy() {}
|
||||
|
||||
void SusDummy::doStartUp() { setMode(MODE_NORMAL); }
|
||||
void SusDummy::doStartUp() { setMode(MODE_ON); }
|
||||
|
||||
void SusDummy::doShutDown() { setMode(MODE_OFF); }
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId,
|
||||
Max31865DummyMap tempSensorDummies_,
|
||||
Tmp1075DummyMap tempTmpSensorDummies_)
|
||||
TemperatureSensorInserter::TemperatureSensorInserter(
|
||||
object_id_t objectId, Max31865DummyMap tempSensorDummies_,
|
||||
std::optional<Tmp1075DummyMap> tempTmpSensorDummies_)
|
||||
: SystemObject(objectId),
|
||||
max31865DummyMap(std::move(tempSensorDummies_)),
|
||||
tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {}
|
||||
@ -25,9 +25,11 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
|
||||
for (auto& rtdDummy : max31865DummyMap) {
|
||||
rtdDummy.second->setTemperature(10, true);
|
||||
}
|
||||
for (auto& tmpDummy : tmp1075DummyMap) {
|
||||
if (tmp1075DummyMap.has_value()) {
|
||||
for (auto& tmpDummy : tmp1075DummyMap.value()) {
|
||||
tmpDummy.second->setTemperature(10, true);
|
||||
}
|
||||
}
|
||||
tempsWereInitialized = true;
|
||||
}
|
||||
|
||||
@ -96,6 +98,25 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (TestCase::COLD_PLOC_CONSECUTIVE): {
|
||||
if (cycles == 15) {
|
||||
sif::debug << "Setting cold PLOC temperature" << std::endl;
|
||||
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(-15, true);
|
||||
}
|
||||
if (cycles == 30) {
|
||||
sif::debug << "Setting warmer PLOC temperature" << std::endl;
|
||||
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(0, true);
|
||||
}
|
||||
if (cycles == 45) {
|
||||
sif::debug << "Setting cold PLOC temperature again" << std::endl;
|
||||
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(-15, true);
|
||||
}
|
||||
if (cycles == 60) {
|
||||
sif::debug << "Setting warmer PLOC temperature again" << std::endl;
|
||||
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(0, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (TestCase::COLD_CAMERA): {
|
||||
if (cycles == 15) {
|
||||
sif::debug << "Setting cold CAM temperature" << std::endl;
|
||||
@ -105,6 +126,21 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
|
||||
sif::debug << "Setting CAM temperature back to normal" << std::endl;
|
||||
max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(0, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (TestCase::COLD_PLOC_STAYS_COLD): {
|
||||
if (cycles == 15) {
|
||||
sif::debug << "Setting cold PLOC temperature" << std::endl;
|
||||
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(-40, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (TestCase::COLD_CAMERA_STAYS_COLD): {
|
||||
if (cycles == 15) {
|
||||
sif::debug << "Setting cold PLOC temperature" << std::endl;
|
||||
max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(-40, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
cycles++;
|
||||
|
@ -12,7 +12,7 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
|
||||
using Max31865DummyMap = std::map<object_id_t, Max31865Dummy*>;
|
||||
using Tmp1075DummyMap = std::map<object_id_t, Tmp1075Dummy*>;
|
||||
explicit TemperatureSensorInserter(object_id_t objectId, Max31865DummyMap tempSensorDummies_,
|
||||
Tmp1075DummyMap tempTmpSensorDummies_);
|
||||
std::optional<Tmp1075DummyMap> tempTmpSensorDummies_);
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
@ -22,7 +22,7 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
|
||||
|
||||
private:
|
||||
Max31865DummyMap max31865DummyMap;
|
||||
Tmp1075DummyMap tmp1075DummyMap;
|
||||
std::optional<Tmp1075DummyMap> tmp1075DummyMap;
|
||||
|
||||
enum TestCase {
|
||||
NONE = 0,
|
||||
@ -32,6 +32,9 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
|
||||
COLD_STR = 4,
|
||||
COLD_STR_CONSECUTIVE = 5,
|
||||
COLD_CAMERA = 6,
|
||||
COLD_PLOC_CONSECUTIVE = 7,
|
||||
COLD_PLOC_STAYS_COLD = 8,
|
||||
COLD_CAMERA_STAYS_COLD = 9
|
||||
};
|
||||
int iteration = 0;
|
||||
uint32_t cycles = 0;
|
||||
|
@ -8,35 +8,57 @@ using namespace returnvalue;
|
||||
Tmp1075Dummy::Tmp1075Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||
: DeviceHandlerBase(objectId, comif, comCookie), set(this) {}
|
||||
|
||||
void Tmp1075Dummy::doStartUp() { setMode(MODE_NORMAL); }
|
||||
void Tmp1075Dummy::doShutDown() { setMode(MODE_OFF); }
|
||||
void Tmp1075Dummy::doStartUp() { setMode(MODE_ON); }
|
||||
void Tmp1075Dummy::doShutDown() {
|
||||
PoolReadGuard pg(&set);
|
||||
set.setValidity(false, true);
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
ReturnValue_t Tmp1075Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { return OK; }
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
return 0;
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Tmp1075Dummy::setTemperature(float temperature, bool valid) {
|
||||
PoolReadGuard pg(&set);
|
||||
set.temperatureCelcius.value = temperature;
|
||||
set.setValidity(valid, true);
|
||||
}
|
||||
|
||||
void Tmp1075Dummy::fillCommandAndReplyMap() {}
|
||||
|
||||
uint32_t Tmp1075Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; }
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry<float>({10.0}, true));
|
||||
return OK;
|
||||
}
|
||||
|
||||
ReturnValue_t Tmp1075Dummy::setHealth(HealthState health) {
|
||||
if (health == FAULTY or health == PERMANENT_FAULTY) {
|
||||
setMode(_MODE_SHUT_DOWN);
|
||||
}
|
||||
return DeviceHandlerBase::setHealth(health);
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase *Tmp1075Dummy::getDataSetHandle(sid_t sid) { return &set; }
|
||||
|
@ -26,6 +26,7 @@ class Tmp1075Dummy : public DeviceHandlerBase {
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) override;
|
||||
ReturnValue_t setHealth(HealthState health) override;
|
||||
|
||||
protected:
|
||||
LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <dummies/PlPcduDummy.h>
|
||||
#include <dummies/PlocMpsocDummy.h>
|
||||
#include <dummies/PlocSupervisorDummy.h>
|
||||
#include <dummies/RadSensorDummy.h>
|
||||
#include <dummies/RwDummy.h>
|
||||
#include <dummies/SaDeploymentDummy.h>
|
||||
#include <dummies/ScexDummy.h>
|
||||
@ -34,6 +35,7 @@
|
||||
|
||||
#include "TemperatureSensorInserter.h"
|
||||
#include "dummies/Max31865Dummy.h"
|
||||
#include "dummies/SusDummy.h"
|
||||
#include "dummies/Tmp1075Dummy.h"
|
||||
#include "mission/genericFactory.h"
|
||||
#include "mission/system/acs/acsModeTree.h"
|
||||
@ -63,11 +65,14 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
|
||||
rws[3] = new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
ObjectFactory::createRwAssy(pwrSwitcher, power::Switches::PDU2_CH2_RW_5V, rws, rwIds);
|
||||
new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER);
|
||||
|
||||
if (cfg.addStrDummy) {
|
||||
auto* strAssy = new StrAssembly(objects::STR_ASSY);
|
||||
strAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
|
||||
auto* strDummy =
|
||||
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
strDummy->connectModeTreeParent(*strAssy);
|
||||
}
|
||||
if (cfg.addSyrlinksDummies) {
|
||||
auto* syrlinksDummy =
|
||||
new SyrlinksDummy(objects::SYRLINKS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
@ -191,25 +196,36 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
|
||||
objects::RTD_15_IC18_IMTQ,
|
||||
new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy));
|
||||
|
||||
std::map<object_id_t, Tmp1075Dummy*> tmpSensorDummies;
|
||||
tmpSensorDummies.emplace(
|
||||
objects::TMP1075_HANDLER_TCS_0,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy));
|
||||
tmpSensorDummies.emplace(
|
||||
objects::TMP1075_HANDLER_TCS_1,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_1, objects::DUMMY_COM_IF, comCookieDummy));
|
||||
tmpSensorDummies.emplace(
|
||||
objects::TMP1075_HANDLER_PLPCDU_0,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy));
|
||||
// damaged.
|
||||
// tmpSensorDummies.emplace(
|
||||
// objects::TMP1075_HANDLER_PLPCDU_1,
|
||||
// new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF,
|
||||
// comCookieDummy));
|
||||
tmpSensorDummies.emplace(
|
||||
objects::TMP1075_HANDLER_IF_BOARD,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
|
||||
|
||||
std::optional<TemperatureSensorInserter::Tmp1075DummyMap> tmpSensorDummies;
|
||||
if (cfg.addTmpDummies) {
|
||||
TemperatureSensorInserter::Tmp1075DummyMap tmpDummyMap;
|
||||
if (cfg.tmp1075Cfg.addTcsBrd0) {
|
||||
tmpDummyMap.emplace(objects::TMP1075_HANDLER_TCS_0,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF,
|
||||
comCookieDummy));
|
||||
}
|
||||
if (cfg.tmp1075Cfg.addTcsBrd1) {
|
||||
tmpDummyMap.emplace(objects::TMP1075_HANDLER_TCS_1,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_1, objects::DUMMY_COM_IF,
|
||||
comCookieDummy));
|
||||
}
|
||||
if (cfg.tmp1075Cfg.addPlPcdu0) {
|
||||
tmpDummyMap.emplace(objects::TMP1075_HANDLER_PLPCDU_0,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0,
|
||||
objects::DUMMY_COM_IF, comCookieDummy));
|
||||
}
|
||||
if (cfg.tmp1075Cfg.addPlPcdu1) {
|
||||
tmpDummyMap.emplace(objects::TMP1075_HANDLER_PLPCDU_1,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1,
|
||||
objects::DUMMY_COM_IF, comCookieDummy));
|
||||
}
|
||||
if (cfg.tmp1075Cfg.addIfBrd) {
|
||||
tmpDummyMap.emplace(objects::TMP1075_HANDLER_IF_BOARD,
|
||||
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD,
|
||||
objects::DUMMY_COM_IF, comCookieDummy));
|
||||
}
|
||||
tmpSensorDummies = std::move(tmpDummyMap);
|
||||
}
|
||||
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER, rtdSensorDummies,
|
||||
tmpSensorDummies);
|
||||
TcsBoardAssembly* tcsBoardAssy =
|
||||
@ -217,17 +233,21 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
|
||||
for (auto& rtd : rtdSensorDummies) {
|
||||
rtd.second->connectModeTreeParent(*tcsBoardAssy);
|
||||
}
|
||||
for (auto& tmp : tmpSensorDummies) {
|
||||
if (tmpSensorDummies.has_value()) {
|
||||
for (auto& tmp : tmpSensorDummies.value()) {
|
||||
tmp.second->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cfg.addCamSwitcherDummy) {
|
||||
auto* camSwitcher = new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher,
|
||||
power::Switches::PDU2_CH8_PAYLOAD_CAMERA);
|
||||
camSwitcher->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
}
|
||||
if (cfg.addScexDummy) {
|
||||
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
}
|
||||
auto* plPcduDummy =
|
||||
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
@ -239,4 +259,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
|
||||
objects::PLOC_SUPERVISOR_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, pwrSwitcher);
|
||||
plocSupervisorDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
}
|
||||
if (cfg.addRadSensorDummy) {
|
||||
auto* radSensorDummy =
|
||||
new RadSensorDummy(objects::RAD_SENSOR, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
radSensorDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,14 @@ class GpioIF;
|
||||
|
||||
namespace dummy {
|
||||
|
||||
struct Tmp1075Cfg {
|
||||
bool addTcsBrd0 = true;
|
||||
bool addTcsBrd1 = true;
|
||||
bool addPlPcdu0 = true;
|
||||
bool addPlPcdu1 = true;
|
||||
bool addIfBrd = true;
|
||||
};
|
||||
|
||||
// Default values targeted towards EM.
|
||||
struct DummyCfg {
|
||||
bool addCoreCtrlCfg = true;
|
||||
@ -19,7 +27,12 @@ struct DummyCfg {
|
||||
bool addTempSensorDummies = true;
|
||||
bool addRtdComIFDummy = true;
|
||||
bool addPlocDummies = true;
|
||||
bool addCamSwitcherDummy = true;
|
||||
bool addStrDummy = true;
|
||||
bool addTmpDummies = true;
|
||||
bool addRadSensorDummy = true;
|
||||
Tmp1075Cfg tmp1075Cfg;
|
||||
bool addCamSwitcherDummy = false;
|
||||
bool addScexDummy = false;
|
||||
};
|
||||
|
||||
void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch, GpioIF* gpioIF, bool enableHkSets);
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 4391823f01d792bcc078d47b60f7df7624f8cbe4
|
||||
Subproject commit d575da85407e029dabecaffa5368f0c9f1034941
|
@ -133,6 +133,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11802;0x2e1a;RESET_OCCURED;LOW;No description;mission/acs/rwHelpers.h
|
||||
11901;0x2e7d;BOOTING_FIRMWARE_FAILED_EVENT;LOW;Failed to boot firmware;mission/acs/str/StarTrackerHandler.h
|
||||
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED_EVENT;LOW;Failed to boot star tracker into bootloader mode;mission/acs/str/StarTrackerHandler.h
|
||||
11903;0x2e7f;COM_ERROR_REPLY_RECEIVED;LOW;Received COM error. P1: Communication Error ID (datasheet p32);mission/acs/str/StarTrackerHandler.h
|
||||
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/payload/PlocSupervisorHandler.h
|
||||
12002;0x2ee2;SUPV_UNKNOWN_TM;LOW;Unhandled event. P1: APID, P2: Service ID;linux/payload/PlocSupervisorHandler.h
|
||||
12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;No description;linux/payload/PlocSupervisorHandler.h
|
||||
@ -271,6 +272,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
14010;0x36ba;TRYING_I2C_RECOVERY;HIGH;I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices.;mission/sysDefs.h
|
||||
14011;0x36bb;I2C_REBOOT;HIGH;I2C is unavailable. Recovery did not work, performing full reboot.;mission/sysDefs.h
|
||||
14012;0x36bc;PDEC_REBOOT;HIGH;PDEC recovery through reset was not possible, performing full reboot.;mission/sysDefs.h
|
||||
14013;0x36bd;FIRMWARE_INFO;INFO;Version information of the firmware (not OBSW). P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set.;mission/sysDefs.h
|
||||
14014;0x36be;ACTIVE_SD_INFO;INFO;Active SD card info. 0: OFF, 1: ON, 2: MOUNTED. P1: SD Card 0, P2: SD Card 1.;mission/sysDefs.h
|
||||
14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
@ -279,6 +282,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
14106;0x371a;PCDU_SYSTEM_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14107;0x371b;HEATER_NOT_OFF_FOR_OFF_MODE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14108;0x371c;MGT_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14109;0x371d;TCS_SWITCHING_HEATER_ON;INFO;P1: Module index. P2: Heater index;mission/controller/tcsDefs.h
|
||||
14110;0x371e;TCS_SWITCHING_HEATER_OFF;INFO;P1: Module index. P2: Heater index;mission/controller/tcsDefs.h
|
||||
14111;0x371f;TCS_HEATER_MAX_BURN_TIME_REACHED;MEDIUM;P1: Heater index. P2: Maximum burn time for heater.;mission/controller/tcsDefs.h
|
||||
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/com/ComSubsystem.h
|
||||
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/com/ComSubsystem.h
|
||||
14300;0x37dc;POSSIBLE_FILE_CORRUPTION;LOW;P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp.;mission/persistentTmStoreDefs.h
|
||||
|
|
@ -133,6 +133,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11802;0x2e1a;RESET_OCCURED;LOW;No description;mission/acs/rwHelpers.h
|
||||
11901;0x2e7d;BOOTING_FIRMWARE_FAILED_EVENT;LOW;Failed to boot firmware;mission/acs/str/StarTrackerHandler.h
|
||||
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED_EVENT;LOW;Failed to boot star tracker into bootloader mode;mission/acs/str/StarTrackerHandler.h
|
||||
11903;0x2e7f;COM_ERROR_REPLY_RECEIVED;LOW;Received COM error. P1: Communication Error ID (datasheet p32);mission/acs/str/StarTrackerHandler.h
|
||||
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/payload/PlocSupervisorHandler.h
|
||||
12002;0x2ee2;SUPV_UNKNOWN_TM;LOW;Unhandled event. P1: APID, P2: Service ID;linux/payload/PlocSupervisorHandler.h
|
||||
12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;No description;linux/payload/PlocSupervisorHandler.h
|
||||
@ -271,6 +272,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
14010;0x36ba;TRYING_I2C_RECOVERY;HIGH;I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices.;mission/sysDefs.h
|
||||
14011;0x36bb;I2C_REBOOT;HIGH;I2C is unavailable. Recovery did not work, performing full reboot.;mission/sysDefs.h
|
||||
14012;0x36bc;PDEC_REBOOT;HIGH;PDEC recovery through reset was not possible, performing full reboot.;mission/sysDefs.h
|
||||
14013;0x36bd;FIRMWARE_INFO;INFO;Version information of the firmware (not OBSW). P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set.;mission/sysDefs.h
|
||||
14014;0x36be;ACTIVE_SD_INFO;INFO;Active SD card info. 0: OFF, 1: ON, 2: MOUNTED. P1: SD Card 0, P2: SD Card 1.;mission/sysDefs.h
|
||||
14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
@ -279,6 +282,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
14106;0x371a;PCDU_SYSTEM_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14107;0x371b;HEATER_NOT_OFF_FOR_OFF_MODE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14108;0x371c;MGT_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14109;0x371d;TCS_SWITCHING_HEATER_ON;INFO;P1: Module index. P2: Heater index;mission/controller/tcsDefs.h
|
||||
14110;0x371e;TCS_SWITCHING_HEATER_OFF;INFO;P1: Module index. P2: Heater index;mission/controller/tcsDefs.h
|
||||
14111;0x371f;TCS_HEATER_MAX_BURN_TIME_REACHED;MEDIUM;P1: Heater index. P2: Maximum burn time for heater.;mission/controller/tcsDefs.h
|
||||
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/com/ComSubsystem.h
|
||||
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/com/ComSubsystem.h
|
||||
14300;0x37dc;POSSIBLE_FILE_CORRUPTION;LOW;P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp.;mission/persistentTmStoreDefs.h
|
||||
|
|
@ -54,9 +54,13 @@ class BspConfig:
|
||||
|
||||
# Store this file in the root of the generators folder
|
||||
self.csv_filename = Path(f"{ROOT_DIR}/{self.bsp_dir_name}_events.csv")
|
||||
self.subsystems_csv_filename = Path(f"{ROOT_DIR}/{self.bsp_dir_name}_subsystems.csv")
|
||||
self.subsystems_csv_filename = Path(
|
||||
f"{ROOT_DIR}/{self.bsp_dir_name}_subsystems.csv"
|
||||
)
|
||||
self.csv_copy_dest = Path(f"{OBSW_ROOT_DIR}/tmtc/eive_tmtc/config/events.csv")
|
||||
self.subsystem_csv_copy_dest = Path(f"{OBSW_ROOT_DIR}/tmtc/eive_tmtc/config/subsystems.csv")
|
||||
self.subsystem_csv_copy_dest = Path(
|
||||
f"{OBSW_ROOT_DIR}/tmtc/eive_tmtc/config/subsystems.csv"
|
||||
)
|
||||
|
||||
if (
|
||||
self.bsp_select == BspType.BSP_Q7S
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 295 translations.
|
||||
* @brief Auto-generated event translation file. Contains 301 translations.
|
||||
* @details
|
||||
* Generated on: 2023-05-17 17:15:34
|
||||
* Generated on: 2023-07-21 11:04:23
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -139,6 +139,7 @@ const char *ERROR_STATE_STRING = "ERROR_STATE";
|
||||
const char *RESET_OCCURED_STRING = "RESET_OCCURED";
|
||||
const char *BOOTING_FIRMWARE_FAILED_EVENT_STRING = "BOOTING_FIRMWARE_FAILED_EVENT";
|
||||
const char *BOOTING_BOOTLOADER_FAILED_EVENT_STRING = "BOOTING_BOOTLOADER_FAILED_EVENT";
|
||||
const char *COM_ERROR_REPLY_RECEIVED_STRING = "COM_ERROR_REPLY_RECEIVED";
|
||||
const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_FAILURE";
|
||||
const char *SUPV_UNKNOWN_TM_STRING = "SUPV_UNKNOWN_TM";
|
||||
const char *SUPV_UNINIMPLEMENTED_TM_STRING = "SUPV_UNINIMPLEMENTED_TM";
|
||||
@ -277,6 +278,8 @@ const char *INDIVIDUAL_BOOT_COUNTS_STRING = "INDIVIDUAL_BOOT_COUNTS";
|
||||
const char *TRYING_I2C_RECOVERY_STRING = "TRYING_I2C_RECOVERY";
|
||||
const char *I2C_REBOOT_STRING = "I2C_REBOOT";
|
||||
const char *PDEC_REBOOT_STRING = "PDEC_REBOOT";
|
||||
const char *FIRMWARE_INFO_STRING = "FIRMWARE_INFO";
|
||||
const char *ACTIVE_SD_INFO_STRING = "ACTIVE_SD_INFO";
|
||||
const char *NO_VALID_SENSOR_TEMPERATURE_STRING = "NO_VALID_SENSOR_TEMPERATURE";
|
||||
const char *NO_HEALTHY_HEATER_AVAILABLE_STRING = "NO_HEALTHY_HEATER_AVAILABLE";
|
||||
const char *SYRLINKS_OVERHEATING_STRING = "SYRLINKS_OVERHEATING";
|
||||
@ -285,6 +288,9 @@ const char *CAMERA_OVERHEATING_STRING = "CAMERA_OVERHEATING";
|
||||
const char *PCDU_SYSTEM_OVERHEATING_STRING = "PCDU_SYSTEM_OVERHEATING";
|
||||
const char *HEATER_NOT_OFF_FOR_OFF_MODE_STRING = "HEATER_NOT_OFF_FOR_OFF_MODE";
|
||||
const char *MGT_OVERHEATING_STRING = "MGT_OVERHEATING";
|
||||
const char *TCS_SWITCHING_HEATER_ON_STRING = "TCS_SWITCHING_HEATER_ON";
|
||||
const char *TCS_SWITCHING_HEATER_OFF_STRING = "TCS_SWITCHING_HEATER_OFF";
|
||||
const char *TCS_HEATER_MAX_BURN_TIME_REACHED_STRING = "TCS_HEATER_MAX_BURN_TIME_REACHED";
|
||||
const char *TX_TIMER_EXPIRED_STRING = "TX_TIMER_EXPIRED";
|
||||
const char *BIT_LOCK_TX_ON_STRING = "BIT_LOCK_TX_ON";
|
||||
const char *POSSIBLE_FILE_CORRUPTION_STRING = "POSSIBLE_FILE_CORRUPTION";
|
||||
@ -571,6 +577,8 @@ const char *translateEvents(Event event) {
|
||||
return BOOTING_FIRMWARE_FAILED_EVENT_STRING;
|
||||
case (11902):
|
||||
return BOOTING_BOOTLOADER_FAILED_EVENT_STRING;
|
||||
case (11903):
|
||||
return COM_ERROR_REPLY_RECEIVED_STRING;
|
||||
case (12001):
|
||||
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||
case (12002):
|
||||
@ -847,6 +855,10 @@ const char *translateEvents(Event event) {
|
||||
return I2C_REBOOT_STRING;
|
||||
case (14012):
|
||||
return PDEC_REBOOT_STRING;
|
||||
case (14013):
|
||||
return FIRMWARE_INFO_STRING;
|
||||
case (14014):
|
||||
return ACTIVE_SD_INFO_STRING;
|
||||
case (14100):
|
||||
return NO_VALID_SENSOR_TEMPERATURE_STRING;
|
||||
case (14101):
|
||||
@ -863,6 +875,12 @@ const char *translateEvents(Event event) {
|
||||
return HEATER_NOT_OFF_FOR_OFF_MODE_STRING;
|
||||
case (14108):
|
||||
return MGT_OVERHEATING_STRING;
|
||||
case (14109):
|
||||
return TCS_SWITCHING_HEATER_ON_STRING;
|
||||
case (14110):
|
||||
return TCS_SWITCHING_HEATER_OFF_STRING;
|
||||
case (14111):
|
||||
return TCS_HEATER_MAX_BURN_TIME_REACHED_STRING;
|
||||
case (14201):
|
||||
return TX_TIMER_EXPIRED_STRING;
|
||||
case (14202):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 175 translations.
|
||||
* Generated on: 2023-05-17 17:15:34
|
||||
* Generated on: 2023-07-21 11:04:23
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -113,6 +113,7 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send
|
||||
if (req->mode != adis.mode) {
|
||||
if (req->mode == acs::SimpleSensorMode::NORMAL) {
|
||||
adis.type = req->type;
|
||||
adis.decRate = req->cfg.decRateReg;
|
||||
// The initial countdown is handled by the device handler now.
|
||||
// adis.countdown.setTimeout(adis1650x::START_UP_TIME);
|
||||
if (adis.type == adis1650x::Type::ADIS16507) {
|
||||
@ -376,6 +377,80 @@ void AcsBoardPolling::gyroL3gHandler(GyroL3g& l3g) {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t AcsBoardPolling::writeAdisReg(SpiCookie& cookie) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
int retval = 0;
|
||||
// Prepare transfer
|
||||
int fileDescriptor = 0;
|
||||
std::string device = spiComIF.getSpiDev();
|
||||
UnixFileGuard fileHelper(device, fileDescriptor, O_RDWR, "SpiComIF::sendMessage");
|
||||
if (fileHelper.getOpenResult() != returnvalue::OK) {
|
||||
return spi::OPENING_FILE_FAILED;
|
||||
}
|
||||
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
|
||||
uint32_t spiSpeed = 0;
|
||||
cookie.getSpiParameters(spiMode, spiSpeed, nullptr);
|
||||
spiComIF.setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
||||
cookie.assignWriteBuffer(cmdBuf.data());
|
||||
cookie.setTransferSize(2);
|
||||
|
||||
gpioId_t gpioId = cookie.getChipSelectPin();
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t timeoutMs = 0;
|
||||
MutexIF* mutex = spiComIF.getCsMutex();
|
||||
cookie.getMutexParams(timeoutType, timeoutMs);
|
||||
if (mutex == nullptr) {
|
||||
sif::warning << "GyroADIS16507Handler::spiSendCallback: "
|
||||
"Mutex or GPIO interface invalid"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
size_t idx = 0;
|
||||
spi_ioc_transfer* transferStruct = cookie.getTransferStructHandle();
|
||||
uint64_t origTx = transferStruct->tx_buf;
|
||||
uint64_t origRx = transferStruct->rx_buf;
|
||||
for (idx = 0; idx < 4; idx += 2) {
|
||||
result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "AcsBoardPolling: Failed to lock mutex" << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
// Pull SPI CS low. For now, no support for active high given
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF.pullLow(gpioId);
|
||||
}
|
||||
|
||||
// Execute transfer
|
||||
// Initiate a full duplex SPI transfer.
|
||||
retval = ioctl(fileDescriptor, SPI_IOC_MESSAGE(1), cookie.getTransferStructHandle());
|
||||
if (retval < 0) {
|
||||
utility::handleIoctlError("SpiComIF::sendMessage: ioctl error.");
|
||||
result = spi::FULL_DUPLEX_TRANSFER_FAILED;
|
||||
}
|
||||
#if FSFW_HAL_SPI_WIRETAPPING == 1
|
||||
comIf->performSpiWiretapping(cookie);
|
||||
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF.pullHigh(gpioId);
|
||||
}
|
||||
mutex->unlockMutex();
|
||||
|
||||
transferStruct->tx_buf += 2;
|
||||
transferStruct->rx_buf += 2;
|
||||
if (idx < 4) {
|
||||
usleep(adis1650x::STALL_TIME_MICROSECONDS);
|
||||
}
|
||||
}
|
||||
transferStruct->tx_buf = origTx;
|
||||
transferStruct->rx_buf = origRx;
|
||||
cookie.setTransferSize(0);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t AcsBoardPolling::readAdisCfg(SpiCookie& cookie, size_t transferLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
int retval = 0;
|
||||
@ -455,15 +530,20 @@ void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
|
||||
ReturnValue_t result;
|
||||
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||
bool mustPerformStartup = false;
|
||||
uint16_t decRate = 0;
|
||||
{
|
||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
||||
mode = gyro.mode;
|
||||
decRate = gyro.decRate;
|
||||
mustPerformStartup = gyro.performStartup;
|
||||
}
|
||||
if (mode == acs::SimpleSensorMode::OFF) {
|
||||
return;
|
||||
}
|
||||
if (mustPerformStartup) {
|
||||
adis1650x::prepareWriteRegCommand(adis1650x::DEC_RATE_REG, decRate, cmdBuf.data(),
|
||||
cmdBuf.size());
|
||||
writeAdisReg(*gyro.cookie);
|
||||
uint8_t regList[6];
|
||||
// Read configuration
|
||||
regList[0] = adis1650x::DIAG_STAT_REG;
|
||||
@ -491,13 +571,19 @@ void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
|
||||
gyro.replyResult = returnvalue::FAILED;
|
||||
return;
|
||||
}
|
||||
uint16_t decRateReadBack = (rawReply[10] << 8) | rawReply[11];
|
||||
if (decRateReadBack != decRate) {
|
||||
sif::warning << "AcsPollingTask: DEC rate configuration failed. Read " << decRateReadBack
|
||||
<< ", expected " << decRate << std::endl;
|
||||
gyro.replyResult = returnvalue::FAILED;
|
||||
}
|
||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
||||
gyro.ownReply.cfgWasSet = true;
|
||||
gyro.ownReply.cfg.diagStat = (rawReply[2] << 8) | rawReply[3];
|
||||
gyro.ownReply.cfg.filterSetting = (rawReply[4] << 8) | rawReply[5];
|
||||
gyro.ownReply.cfg.rangMdl = (rawReply[6] << 8) | rawReply[7];
|
||||
gyro.ownReply.cfg.mscCtrlReg = (rawReply[8] << 8) | rawReply[9];
|
||||
gyro.ownReply.cfg.decRateReg = (rawReply[10] << 8) | rawReply[11];
|
||||
gyro.ownReply.cfg.decRateReg = decRateReadBack;
|
||||
gyro.ownReply.cfg.prodId = prodId;
|
||||
gyro.ownReply.data.sensitivity = adis1650x::rangMdlToSensitivity(gyro.ownReply.cfg.rangMdl);
|
||||
gyro.performStartup = false;
|
||||
|
@ -37,6 +37,7 @@ class AcsBoardPolling : public SystemObject,
|
||||
|
||||
struct GyroAdis : public DevBase {
|
||||
adis1650x::Type type;
|
||||
uint16_t decRate;
|
||||
Countdown countdown;
|
||||
acs::Adis1650XReply ownReply;
|
||||
acs::Adis1650XReply readerReply;
|
||||
@ -84,6 +85,8 @@ class AcsBoardPolling : public SystemObject,
|
||||
void gyroAdisHandler(GyroAdis& gyro);
|
||||
void mgmLis3Handler(MgmLis3& mgm);
|
||||
void mgmRm3100Handler(MgmRm3100& mgm);
|
||||
// This fumction configures the register as specified on p.21 of the datasheet.
|
||||
ReturnValue_t writeAdisReg(SpiCookie& cookie);
|
||||
// Special readout: 16us stall time between small 2 byte transfers.
|
||||
ReturnValue_t readAdisCfg(SpiCookie& spiCookie, size_t transferLen);
|
||||
};
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <fsfw/filesystem/HasFileSystemIF.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
#include <mission/acs/str/strHelpers.h>
|
||||
@ -23,6 +24,8 @@ extern "C" {
|
||||
|
||||
using namespace returnvalue;
|
||||
|
||||
static constexpr bool PACKET_WIRETAPPING = false;
|
||||
|
||||
StrComHandler::StrComHandler(object_id_t objectId) : SystemObject(objectId) {
|
||||
lock = MutexFactory::instance()->createMutex();
|
||||
semaphore.acquire();
|
||||
@ -52,7 +55,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
||||
case InternalState::POLL_ONE_REPLY: {
|
||||
// Stopwatch watch;
|
||||
replyTimeout.setTimeout(200);
|
||||
replyResult = readOneReply(static_cast<uint32_t>(state));
|
||||
readOneReply(static_cast<uint32_t>(state));
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
replyWasReceived = true;
|
||||
@ -680,6 +683,10 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa
|
||||
const uint8_t* txFrame;
|
||||
size_t frameLen;
|
||||
datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen);
|
||||
if (PACKET_WIRETAPPING) {
|
||||
sif::debug << "Sending STR frame" << std::endl;
|
||||
arrayprinter::print(txFrame, frameLen);
|
||||
}
|
||||
ssize_t bytesWritten = write(serialPort, txFrame, frameLen);
|
||||
if (bytesWritten != static_cast<ssize_t>(frameLen)) {
|
||||
sif::warning << "StrComHandler: Sending packet failed" << std::endl;
|
||||
@ -709,13 +716,11 @@ ReturnValue_t StrComHandler::requestReceiveMessage(CookieIF* cookie, size_t requ
|
||||
}
|
||||
|
||||
ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
||||
// Consider it a configuration error if the task is not done with a command -> reply cycle
|
||||
// in time.
|
||||
bool replyWasReceived = false;
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
if (state != InternalState::SLEEPING) {
|
||||
return BUSY;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
replyWasReceived = this->replyWasReceived;
|
||||
}
|
||||
@ -728,7 +733,7 @@ ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buf
|
||||
*size = replyLen;
|
||||
}
|
||||
replyLen = 0;
|
||||
return replyResult;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t StrComHandler::unlockAndEraseRegions(uint32_t from, uint32_t to) {
|
||||
@ -782,8 +787,10 @@ ReturnValue_t StrComHandler::handleSerialReception() {
|
||||
<< std::endl;
|
||||
return FAILED;
|
||||
} else if (bytesRead > 0) {
|
||||
// sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;
|
||||
// arrayprinter::print(recBuf.data(), bytesRead);
|
||||
if (PACKET_WIRETAPPING) {
|
||||
sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;
|
||||
arrayprinter::print(recBuf.data(), bytesRead);
|
||||
}
|
||||
datalinkLayer.feedData(recBuf.data(), bytesRead);
|
||||
}
|
||||
return OK;
|
||||
@ -797,6 +804,10 @@ ReturnValue_t StrComHandler::readOneReply(uint32_t failParameter) {
|
||||
handleSerialReception();
|
||||
result = datalinkLayer.checkRingBufForFrame(&replyPtr, replyLen);
|
||||
if (result == returnvalue::OK) {
|
||||
if (PACKET_WIRETAPPING) {
|
||||
sif::debug << "Received STR reply frame" << std::endl;
|
||||
arrayprinter::print(replyPtr, replyLen);
|
||||
}
|
||||
return returnvalue::OK;
|
||||
} else if (result != ArcsecDatalinkLayer::DEC_IN_PROGRESS) {
|
||||
triggerEvent(STR_HELPER_DEC_ERROR, result, failParameter);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 295 translations.
|
||||
* @brief Auto-generated event translation file. Contains 301 translations.
|
||||
* @details
|
||||
* Generated on: 2023-05-17 17:15:34
|
||||
* Generated on: 2023-07-21 11:04:23
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -139,6 +139,7 @@ const char *ERROR_STATE_STRING = "ERROR_STATE";
|
||||
const char *RESET_OCCURED_STRING = "RESET_OCCURED";
|
||||
const char *BOOTING_FIRMWARE_FAILED_EVENT_STRING = "BOOTING_FIRMWARE_FAILED_EVENT";
|
||||
const char *BOOTING_BOOTLOADER_FAILED_EVENT_STRING = "BOOTING_BOOTLOADER_FAILED_EVENT";
|
||||
const char *COM_ERROR_REPLY_RECEIVED_STRING = "COM_ERROR_REPLY_RECEIVED";
|
||||
const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_FAILURE";
|
||||
const char *SUPV_UNKNOWN_TM_STRING = "SUPV_UNKNOWN_TM";
|
||||
const char *SUPV_UNINIMPLEMENTED_TM_STRING = "SUPV_UNINIMPLEMENTED_TM";
|
||||
@ -277,6 +278,8 @@ const char *INDIVIDUAL_BOOT_COUNTS_STRING = "INDIVIDUAL_BOOT_COUNTS";
|
||||
const char *TRYING_I2C_RECOVERY_STRING = "TRYING_I2C_RECOVERY";
|
||||
const char *I2C_REBOOT_STRING = "I2C_REBOOT";
|
||||
const char *PDEC_REBOOT_STRING = "PDEC_REBOOT";
|
||||
const char *FIRMWARE_INFO_STRING = "FIRMWARE_INFO";
|
||||
const char *ACTIVE_SD_INFO_STRING = "ACTIVE_SD_INFO";
|
||||
const char *NO_VALID_SENSOR_TEMPERATURE_STRING = "NO_VALID_SENSOR_TEMPERATURE";
|
||||
const char *NO_HEALTHY_HEATER_AVAILABLE_STRING = "NO_HEALTHY_HEATER_AVAILABLE";
|
||||
const char *SYRLINKS_OVERHEATING_STRING = "SYRLINKS_OVERHEATING";
|
||||
@ -285,6 +288,9 @@ const char *CAMERA_OVERHEATING_STRING = "CAMERA_OVERHEATING";
|
||||
const char *PCDU_SYSTEM_OVERHEATING_STRING = "PCDU_SYSTEM_OVERHEATING";
|
||||
const char *HEATER_NOT_OFF_FOR_OFF_MODE_STRING = "HEATER_NOT_OFF_FOR_OFF_MODE";
|
||||
const char *MGT_OVERHEATING_STRING = "MGT_OVERHEATING";
|
||||
const char *TCS_SWITCHING_HEATER_ON_STRING = "TCS_SWITCHING_HEATER_ON";
|
||||
const char *TCS_SWITCHING_HEATER_OFF_STRING = "TCS_SWITCHING_HEATER_OFF";
|
||||
const char *TCS_HEATER_MAX_BURN_TIME_REACHED_STRING = "TCS_HEATER_MAX_BURN_TIME_REACHED";
|
||||
const char *TX_TIMER_EXPIRED_STRING = "TX_TIMER_EXPIRED";
|
||||
const char *BIT_LOCK_TX_ON_STRING = "BIT_LOCK_TX_ON";
|
||||
const char *POSSIBLE_FILE_CORRUPTION_STRING = "POSSIBLE_FILE_CORRUPTION";
|
||||
@ -571,6 +577,8 @@ const char *translateEvents(Event event) {
|
||||
return BOOTING_FIRMWARE_FAILED_EVENT_STRING;
|
||||
case (11902):
|
||||
return BOOTING_BOOTLOADER_FAILED_EVENT_STRING;
|
||||
case (11903):
|
||||
return COM_ERROR_REPLY_RECEIVED_STRING;
|
||||
case (12001):
|
||||
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||
case (12002):
|
||||
@ -847,6 +855,10 @@ const char *translateEvents(Event event) {
|
||||
return I2C_REBOOT_STRING;
|
||||
case (14012):
|
||||
return PDEC_REBOOT_STRING;
|
||||
case (14013):
|
||||
return FIRMWARE_INFO_STRING;
|
||||
case (14014):
|
||||
return ACTIVE_SD_INFO_STRING;
|
||||
case (14100):
|
||||
return NO_VALID_SENSOR_TEMPERATURE_STRING;
|
||||
case (14101):
|
||||
@ -863,6 +875,12 @@ const char *translateEvents(Event event) {
|
||||
return HEATER_NOT_OFF_FOR_OFF_MODE_STRING;
|
||||
case (14108):
|
||||
return MGT_OVERHEATING_STRING;
|
||||
case (14109):
|
||||
return TCS_SWITCHING_HEATER_ON_STRING;
|
||||
case (14110):
|
||||
return TCS_SWITCHING_HEATER_OFF_STRING;
|
||||
case (14111):
|
||||
return TCS_HEATER_MAX_BURN_TIME_REACHED_STRING;
|
||||
case (14201):
|
||||
return TX_TIMER_EXPIRED_STRING;
|
||||
case (14202):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 175 translations.
|
||||
* Generated on: 2023-05-17 17:15:34
|
||||
* Generated on: 2023-07-21 11:04:23
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -16,9 +16,9 @@ AxiPtmeConfig::AxiPtmeConfig(object_id_t objectId, std::string axiUio, int mapNu
|
||||
AxiPtmeConfig::~AxiPtmeConfig() {}
|
||||
|
||||
ReturnValue_t AxiPtmeConfig::initialize() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
UioMapper uioMapper(axiUio, mapNum);
|
||||
result = uioMapper.getMappedAdress(&baseAddress, UioMapper::Permissions::READ_WRITE);
|
||||
ReturnValue_t result =
|
||||
uioMapper.getMappedAdress(&baseAddress, UioMapper::Permissions::READ_WRITE);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -26,8 +26,7 @@ ReturnValue_t AxiPtmeConfig::initialize() {
|
||||
}
|
||||
|
||||
ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
||||
ReturnValue_t result = mutex->lockMutex(timeoutType, mutexTimeout);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
@ -41,6 +40,11 @@ ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint8_t AxiPtmeConfig::readCaduRateReg() {
|
||||
MutexGuard mg(mutex);
|
||||
return static_cast<uint8_t>(*(baseAddress + CADU_BITRATE_REG));
|
||||
}
|
||||
|
||||
void AxiPtmeConfig::enableTxclockManipulator() {
|
||||
writeBit(COMMON_CONFIG_REG, true, BitPos::EN_TX_CLK_MANIPULATOR);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class AxiPtmeConfig : public SystemObject {
|
||||
* frequency of the clock connected to the bit clock input of PTME.
|
||||
*/
|
||||
ReturnValue_t writeCaduRateReg(uint8_t rateVal);
|
||||
uint8_t readCaduRateReg();
|
||||
|
||||
/**
|
||||
* @brief Next to functions control the tx clock manipulator component
|
||||
|
@ -33,10 +33,21 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
||||
} else {
|
||||
return DirectTmSinkIF::IS_BUSY;
|
||||
}
|
||||
if (not pollReadyForOctet(MAX_BUSY_POLLS)) {
|
||||
abortPacketTransfer();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
for (size_t idx = 0; idx < size; idx++) {
|
||||
// if (pollInterfaceReadiness(2, false) == returnvalue::OK) {
|
||||
if (not pollReadyForOctet(MAX_BUSY_POLLS)) {
|
||||
abortPacketTransfer();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(data[idx]);
|
||||
}
|
||||
if (not pollReadyForOctet(MAX_BUSY_POLLS)) {
|
||||
abortPacketTransfer();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
completePacketTransfer();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -51,7 +62,6 @@ bool PapbVcInterface::pollReadyForPacket() const {
|
||||
// Check if PAPB interface is ready to receive data. Use the configuration register for this.
|
||||
// Bit 5, see PTME ptme_001_01-0-7-r2 Table 31.
|
||||
uint32_t reg = *vcBaseReg;
|
||||
// bool busy = (reg >> 5) & 0b1;
|
||||
return (reg >> 6) & 0b1;
|
||||
}
|
||||
|
||||
@ -77,6 +87,20 @@ bool PapbVcInterface::isBusy() const { return not pollReadyForPacket(); }
|
||||
|
||||
void PapbVcInterface::cancelTransfer() { abortPacketTransfer(); }
|
||||
|
||||
inline bool PapbVcInterface::pollReadyForOctet(uint32_t maxCycles) const {
|
||||
uint32_t reg;
|
||||
uint32_t idx = 0;
|
||||
while (idx < maxCycles) {
|
||||
reg = *vcBaseReg;
|
||||
// Busy bit.
|
||||
if (not((reg >> 5) & 0b1)) {
|
||||
return true;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ReturnValue_t PapbVcInterface::sendTestFrame() {
|
||||
/** Size of one complete transfer frame data field amounts to 1105 bytes */
|
||||
uint8_t testPacket[1105];
|
||||
|
@ -80,6 +80,7 @@ class PapbVcInterface : public VirtualChannelIF {
|
||||
|
||||
static constexpr long int FIRST_DELAY_PAPB_POLLING_NS = 10;
|
||||
static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40;
|
||||
static constexpr uint32_t MAX_BUSY_POLLS = 1000;
|
||||
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
/** High when external buffer memory of virtual channel is empty */
|
||||
@ -118,6 +119,8 @@ class PapbVcInterface : public VirtualChannelIF {
|
||||
*/
|
||||
inline bool pollReadyForPacket() const;
|
||||
|
||||
inline bool pollReadyForOctet(uint32_t maxCycles) const;
|
||||
|
||||
/**
|
||||
* @brief This function can be used for debugging to check whether there are packets in
|
||||
* the packet buffer of the virtual channel or not.
|
||||
|
@ -26,6 +26,11 @@ ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
|
||||
return axiPtmeConfig->writeCaduRateReg(static_cast<uint8_t>(rateVal));
|
||||
}
|
||||
|
||||
uint32_t PtmeConfig::getRate() {
|
||||
uint8_t rateReg = axiPtmeConfig->readCaduRateReg();
|
||||
return (BIT_CLK_FREQ / (rateReg + 1));
|
||||
}
|
||||
|
||||
void PtmeConfig::invertTxClock(bool invert) {
|
||||
if (invert) {
|
||||
axiPtmeConfig->enableTxclockInversion();
|
||||
|
@ -32,6 +32,7 @@ class PtmeConfig : public SystemObject {
|
||||
* of the CADU clock due to the convolutional code added by the s-Band transceiver.
|
||||
*/
|
||||
ReturnValue_t setRate(uint32_t bitRate);
|
||||
uint32_t getRate();
|
||||
|
||||
/**
|
||||
* @brief Will change the time the tx data signal is updated with respect to the tx clock
|
||||
|
@ -57,7 +57,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -119,7 +120,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -187,7 +189,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -255,7 +258,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -418,7 +422,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="build-Debug-RPi/_deps/etl-src/uml|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/temp|build-Debug-RPi/_deps/etl-src/support|build-Debug-RPi/_deps/etl-src/subprojects|build-Debug-RPi/_deps/etl-src/scripts|build-Debug-RPi/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/examples|build-Debug-RPi/_deps/etl-src/cmake|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s|cmake-build-debug|cmake-build-debug-q7s-em|cmake-build-release-q7s-em|bsp_hosted|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|build-Debug-RPi/_deps/etl-src/uml|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/temp|build-Debug-RPi/_deps/etl-src/support|build-Debug-RPi/_deps/etl-src/subprojects|build-Debug-RPi/_deps/etl-src/scripts|build-Debug-RPi/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/examples|build-Debug-RPi/_deps/etl-src/cmake|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s|cmake-build-debug|cmake-build-debug-q7s-em|cmake-build-release-q7s-em|bsp_hosted|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -580,7 +585,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="build-Debug-RPi/_deps/etl-src/uml|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/temp|build-Debug-RPi/_deps/etl-src/support|build-Debug-RPi/_deps/etl-src/subprojects|build-Debug-RPi/_deps/etl-src/scripts|build-Debug-RPi/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/examples|build-Debug-RPi/_deps/etl-src/cmake|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s|cmake-build-debug|cmake-build-debug-q7s-em|cmake-build-release-q7s-em|bsp_hosted|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|build-Debug-RPi/_deps/etl-src/uml|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/temp|build-Debug-RPi/_deps/etl-src/support|build-Debug-RPi/_deps/etl-src/subprojects|build-Debug-RPi/_deps/etl-src/scripts|build-Debug-RPi/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/examples|build-Debug-RPi/_deps/etl-src/cmake|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s|cmake-build-debug|cmake-build-debug-q7s-em|cmake-build-release-q7s-em|bsp_hosted|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -750,7 +756,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|cmake-build-debug-q7s-em|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|cmake-build-debug-q7s-em|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -917,7 +924,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug-q7s|cmake-build-release-q7s-em|cmake-build-release-q7s/_deps/etl-src/uml|cmake-build-release-q7s/_deps/etl-src/test|cmake-build-release-q7s/_deps/etl-src/temp|cmake-build-release-q7s/_deps/etl-src/support|cmake-build-release-q7s/_deps/etl-src/subprojects|cmake-build-release-q7s/_deps/etl-src/scripts|cmake-build-release-q7s/_deps/etl-src/images|cmake-build-release-q7s/_deps/etl-src/examples|cmake-build-release-q7s/_deps/etl-src/cmake|cmake-build-release-q7s/_deps/etl-src/arduino|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|cmake-build-debug-q7s-em|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s|cmake-build-release-q7s-em|cmake-build-release-q7s/_deps/etl-src/uml|cmake-build-release-q7s/_deps/etl-src/test|cmake-build-release-q7s/_deps/etl-src/temp|cmake-build-release-q7s/_deps/etl-src/support|cmake-build-release-q7s/_deps/etl-src/subprojects|cmake-build-release-q7s/_deps/etl-src/scripts|cmake-build-release-q7s/_deps/etl-src/images|cmake-build-release-q7s/_deps/etl-src/examples|cmake-build-release-q7s/_deps/etl-src/cmake|cmake-build-release-q7s/_deps/etl-src/arduino|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|cmake-build-debug-q7s-em|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -1084,7 +1092,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em/_deps/etl-src|cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -1149,7 +1158,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em/_deps/etl-src|cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -1172,7 +1182,7 @@
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1171630561" name="eive-q7s-debug-em" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1171630561" name="eive-q7s-debug-em" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.dockerdpath=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=unix:///var/run/docker.sock,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1171630561." name="/" resourcePath="">
|
||||
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1640701365" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.564607779" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||
@ -1317,7 +1327,9 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug-q7s|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em/_deps/etl-src|cmake-build-debug-q7s|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug-q7s-em/_deps/etl-src/include"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -1386,7 +1398,8 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="unittest/rebootLogic|thirdparty/json|cmake-build-debug-q7s-em/_deps/etl-src|cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="thirdparty/json/include"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
@ -15,7 +15,7 @@ GyrAdis1650XHandler::GyrAdis1650XHandler(object_id_t objectId, object_id_t devic
|
||||
}
|
||||
|
||||
void GyrAdis1650XHandler::doStartUp() {
|
||||
if (internalState != InternalState::STARTUP) {
|
||||
if (internalState == InternalState::NONE) {
|
||||
internalState = InternalState::STARTUP;
|
||||
commandExecuted = false;
|
||||
}
|
||||
@ -24,13 +24,14 @@ void GyrAdis1650XHandler::doStartUp() {
|
||||
if (not commandExecuted) {
|
||||
warningSwitch = true;
|
||||
breakCountdown.setTimeout(adis1650x::START_UP_TIME);
|
||||
updatePeriodicReply(true, adis1650x::REPLY);
|
||||
commandExecuted = true;
|
||||
}
|
||||
if (breakCountdown.hasTimedOut()) {
|
||||
updatePeriodicReply(true, adis1650x::REPLY);
|
||||
setMode(MODE_ON);
|
||||
internalState = InternalState::NONE;
|
||||
}
|
||||
if (internalState == InternalState::STARTUP_DONE) {
|
||||
setMode(MODE_ON);
|
||||
commandExecuted = false;
|
||||
internalState = InternalState::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +62,7 @@ ReturnValue_t GyrAdis1650XHandler::buildTransitionDeviceCommand(DeviceCommandId_
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
*id = adis1650x::REQUEST;
|
||||
adisRequest.cfg.decRateReg = adis1650x::DEC_RATE;
|
||||
return preparePeriodicRequest(acs::SimpleSensorMode::NORMAL);
|
||||
}
|
||||
case (InternalState::SHUTDOWN): {
|
||||
@ -91,6 +93,9 @@ ReturnValue_t GyrAdis1650XHandler::scanForReply(const uint8_t *start, size_t rem
|
||||
getMode() == _MODE_POWER_DOWN) {
|
||||
return IGNORE_FULL_PACKET;
|
||||
}
|
||||
if (internalState == InternalState::STARTUP) {
|
||||
internalState = InternalState::STARTUP_DONE;
|
||||
}
|
||||
*foundLen = remainingSize;
|
||||
if (remainingSize != sizeof(acs::Adis1650XReply)) {
|
||||
return returnvalue::FAILED;
|
||||
|
@ -48,7 +48,7 @@ class GyrAdis1650XHandler : public DeviceHandlerBase {
|
||||
|
||||
bool warningSwitch = true;
|
||||
|
||||
enum class InternalState { NONE, STARTUP, SHUTDOWN };
|
||||
enum class InternalState { NONE, STARTUP, STARTUP_DONE, SHUTDOWN };
|
||||
|
||||
InternalState internalState = InternalState::STARTUP;
|
||||
bool commandExecuted = false;
|
||||
|
@ -30,6 +30,7 @@ void SusHandler::doStartUp() {
|
||||
void SusHandler::doShutDown() {
|
||||
if (internalState != InternalState::SHUTDOWN) {
|
||||
PoolReadGuard pg(&dataset);
|
||||
dataset.tempC = thermal::INVALID_TEMPERATURE;
|
||||
dataset.setValidity(false, true);
|
||||
internalState = InternalState::SHUTDOWN;
|
||||
commandExecuted = false;
|
||||
|
@ -8,11 +8,6 @@
|
||||
|
||||
namespace acs {
|
||||
|
||||
struct Adis1650XRequest {
|
||||
SimpleSensorMode mode;
|
||||
adis1650x::Type type;
|
||||
};
|
||||
|
||||
struct Adis1650XConfig {
|
||||
uint16_t diagStat;
|
||||
uint16_t filterSetting;
|
||||
@ -22,6 +17,12 @@ struct Adis1650XConfig {
|
||||
uint16_t prodId;
|
||||
};
|
||||
|
||||
struct Adis1650XRequest {
|
||||
SimpleSensorMode mode;
|
||||
adis1650x::Type type;
|
||||
Adis1650XConfig cfg;
|
||||
};
|
||||
|
||||
struct Adis1650XData {
|
||||
double sensitivity = 0.0;
|
||||
// Angular velocities in all axes (X, Y and Z)
|
||||
|
@ -52,3 +52,14 @@ double adis1650x::rangMdlToSensitivity(uint16_t rangMdl) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void adis1650x::prepareWriteRegCommand(uint8_t regStart, uint16_t val, uint8_t* outBuf,
|
||||
size_t maxLen) {
|
||||
if (maxLen < 4) {
|
||||
return;
|
||||
}
|
||||
outBuf[0] = regStart | adis1650x::WRITE_MASK;
|
||||
outBuf[1] = val & 0xff;
|
||||
outBuf[2] = (regStart + 1) | adis1650x::WRITE_MASK;
|
||||
outBuf[3] = (val >> 8) & 0xff;
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ enum class BurstModes {
|
||||
};
|
||||
|
||||
size_t prepareReadCommand(const uint8_t* regList, size_t len, uint8_t* outBuf, size_t maxLen);
|
||||
void prepareWriteRegCommand(uint8_t regStart, uint16_t val, uint8_t* outBuf, size_t maxLen);
|
||||
|
||||
BurstModes burstModeFromMscCtrl(uint16_t mscCtrl);
|
||||
double rangMdlToSensitivity(uint16_t rangMdl);
|
||||
|
||||
@ -92,6 +94,9 @@ static constexpr size_t SENSOR_READOUT_SIZE = 20 + 2;
|
||||
static constexpr uint32_t ADIS_DATASET_ID = READ_SENSOR_DATA;
|
||||
static constexpr uint32_t ADIS_CFG_DATASET_ID = READ_OUT_CONFIG;
|
||||
|
||||
static constexpr uint16_t FILT_CTRL = 0x0000;
|
||||
static constexpr uint16_t DEC_RATE = 0x00C7;
|
||||
|
||||
enum GlobCmds : uint8_t {
|
||||
FACTORY_CALIBRATION = 0b0000'0010,
|
||||
SENSOR_SELF_TEST = 0b0000'0100,
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
#include <mission/acs/str/StarTrackerHandler.h>
|
||||
@ -18,6 +19,7 @@ extern "C" {
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "eive/definitions.h"
|
||||
#include "fsfw/thermal/tcsDefinitions.h"
|
||||
|
||||
std::atomic_bool JCFG_DONE(false);
|
||||
|
||||
@ -87,7 +89,6 @@ void StarTrackerHandler::doStartUp() {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
solutionSet.setReportingEnabled(true);
|
||||
startupState = StartupState::DONE;
|
||||
internalState = InternalState::IDLE;
|
||||
setMode(_MODE_TO_ON);
|
||||
@ -100,6 +101,22 @@ void StarTrackerHandler::doShutDown() {
|
||||
startupState = StartupState::IDLE;
|
||||
bootState = FwBootState::NONE;
|
||||
solutionSet.setReportingEnabled(false);
|
||||
{
|
||||
PoolReadGuard pg(&solutionSet);
|
||||
solutionSet.caliQw.value = 0.0;
|
||||
solutionSet.caliQx.value = 0.0;
|
||||
solutionSet.caliQy.value = 0.0;
|
||||
solutionSet.caliQz.value = 0.0;
|
||||
solutionSet.isTrustWorthy.value = 0;
|
||||
solutionSet.setValidity(false, true);
|
||||
}
|
||||
{
|
||||
PoolReadGuard pg(&temperatureSet);
|
||||
temperatureSet.fpgaTemperature = thermal::INVALID_TEMPERATURE;
|
||||
temperatureSet.cmosTemperature = thermal::INVALID_TEMPERATURE;
|
||||
temperatureSet.mcuTemperature = thermal::INVALID_TEMPERATURE;
|
||||
temperatureSet.setValidity(false, true);
|
||||
}
|
||||
reinitNextSetParam = false;
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
}
|
||||
@ -308,7 +325,7 @@ ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id
|
||||
ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||
switch (internalState) {
|
||||
case InternalState::BOOT_FIRMWARE: {
|
||||
if (bootState == FwBootState::WAIT_FOR_EXECUTION or bootState == FwBootState::VERIFY_BOOT) {
|
||||
if (bootState == FwBootState::VERIFY_BOOT or isAwaitingReply()) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
if (bootState == FwBootState::NONE) {
|
||||
@ -332,74 +349,69 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t
|
||||
*id = startracker::REQ_VERSION;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
case (FwBootState::SET_TIME): {
|
||||
*id = startracker::SET_TIME_FROM_SYS_TIME;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
case (FwBootState::LOGLEVEL): {
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::LOGLEVEL;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
}
|
||||
case (FwBootState::LIMITS): {
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::LIMITS;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
}
|
||||
case (FwBootState::TRACKING): {
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::TRACKING;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
}
|
||||
case FwBootState::MOUNTING:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::MOUNTING;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::IMAGE_PROCESSOR:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::IMAGE_PROCESSOR;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::CAMERA:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::CAMERA;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::CENTROIDING:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::CENTROIDING;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::LISA:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::LISA;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::MATCHING:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::MATCHING;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::VALIDATION:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::VALIDATION;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::ALGO:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::ALGO;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::LOG_SUBSCRIPTION:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::LOGSUBSCRIPTION;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::DEBUG_CAMERA:
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::DEBUG_CAMERA;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
case FwBootState::AUTO_THRESHOLD:
|
||||
*id = startracker::AUTO_THRESHOLD;
|
||||
return buildCommandFromCommand(
|
||||
*id, reinterpret_cast<const uint8_t*>(paramJsonFile.c_str()), paramJsonFile.size());
|
||||
default: {
|
||||
sif::error << "STR: Unexpected boot state" << (int)bootState << std::endl;
|
||||
return NOTHING_TO_SEND;
|
||||
@ -442,6 +454,20 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
|
||||
preparePingRequest();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case (startracker::SET_TIME_FROM_SYS_TIME): {
|
||||
SetTimeActionRequest setTimeRequest{};
|
||||
timeval tv;
|
||||
Clock::getClock(&tv);
|
||||
setTimeRequest.unixTime =
|
||||
(static_cast<uint64_t>(tv.tv_sec) * 1000 * 1000) + (static_cast<uint64_t>(tv.tv_usec));
|
||||
arc_pack_settime_action_req(&setTimeRequest, commandBuffer, &rawPacketLen);
|
||||
size_t serLen = 0;
|
||||
// Time in milliseconds. Manual serialization because arcsec API ignores endianness.
|
||||
SerializeAdapter::serialize(&setTimeRequest.unixTime, commandBuffer + 2, &serLen,
|
||||
sizeof(commandBuffer) - 2, SerializeIF::Endianness::LITTLE);
|
||||
rawPacket = commandBuffer;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case (startracker::REQ_TIME): {
|
||||
prepareTimeRequest();
|
||||
return returnvalue::OK;
|
||||
@ -534,6 +560,11 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
|
||||
result = prepareParamCommand(commandData, commandDataLen, jcfgs.logLevel, reinitNextSetParam);
|
||||
return result;
|
||||
}
|
||||
case (startracker::AUTO_THRESHOLD): {
|
||||
result =
|
||||
prepareParamCommand(commandData, commandDataLen, jcfgs.autoThreshold, reinitNextSetParam);
|
||||
return result;
|
||||
}
|
||||
case (startracker::LOGSUBSCRIPTION): {
|
||||
result = prepareParamCommand(commandData, commandDataLen, jcfgs.logSubscription,
|
||||
reinitNextSetParam);
|
||||
@ -638,19 +669,23 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::LOGLEVEL, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::SET_TIME_FROM_SYS_TIME, 2, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::LOGSUBSCRIPTION, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::DEBUG_CAMERA, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::LIMITS, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::AUTO_THRESHOLD, 2, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::MOUNTING, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::IMAGE_PROCESSOR, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::CAMERA, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::CENTROIDING, 3, nullptr,
|
||||
this->insertInCommandAndReplyMap(startracker::CENTROIDING, 2, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::LISA, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
@ -797,6 +832,7 @@ void StarTrackerHandler::bootFirmware(Mode_t toMode) {
|
||||
setMode(toMode, startracker::SUBMODE_FIRMWARE);
|
||||
}
|
||||
sif::info << "STR: Firmware boot success" << std::endl;
|
||||
solutionSet.setReportingEnabled(true);
|
||||
internalState = InternalState::IDLE;
|
||||
startupState = StartupState::IDLE;
|
||||
break;
|
||||
@ -820,6 +856,7 @@ void StarTrackerHandler::setUpJsonCfgs(JsonConfigs& cfgs, const char* paramJsonF
|
||||
cfgs.mounting.init(paramJsonFile);
|
||||
cfgs.limits.init(paramJsonFile);
|
||||
cfgs.subscription.init(paramJsonFile);
|
||||
cfgs.autoThreshold.init(paramJsonFile);
|
||||
JCFG_DONE = true;
|
||||
}
|
||||
|
||||
@ -843,13 +880,20 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
||||
*foundLen = remainingSize;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (remainingSize < 3) {
|
||||
sif::error << "StarTrackerHandler: Reply packet with length less than 3 is invalid"
|
||||
if (remainingSize < 2) {
|
||||
sif::error << "StarTrackerHandler: Reply packet with length " << remainingSize
|
||||
<< " less than "
|
||||
"2 is invalid"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
switch (startracker::getReplyFrameType(start)) {
|
||||
case TMTC_COMM_ERROR: {
|
||||
*foundLen = remainingSize;
|
||||
triggerEvent(COM_ERROR_REPLY_RECEIVED, start[1]);
|
||||
break;
|
||||
}
|
||||
case TMTC_ACTIONREPLY: {
|
||||
*foundLen = remainingSize;
|
||||
return scanForActionReply(startracker::getId(start), foundId);
|
||||
@ -884,6 +928,10 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
switch (id) {
|
||||
case (startracker::SET_TIME_FROM_SYS_TIME): {
|
||||
result = handleActionReply(packet);
|
||||
break;
|
||||
}
|
||||
case (startracker::REQ_TIME): {
|
||||
result = handleTm(packet, timeSet, startracker::TimeSet::SIZE, "REQ_TIME");
|
||||
break;
|
||||
@ -943,7 +991,8 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
case (startracker::TRACKING):
|
||||
case (startracker::VALIDATION):
|
||||
case (startracker::IMAGE_PROCESSOR):
|
||||
case (startracker::ALGO): {
|
||||
case (startracker::ALGO):
|
||||
case (startracker::AUTO_THRESHOLD): {
|
||||
result = handleSetParamReply(packet);
|
||||
break;
|
||||
}
|
||||
@ -1350,6 +1399,10 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(uint8_t replyId, DeviceComm
|
||||
*foundId = startracker::UPLOAD_IMAGE;
|
||||
break;
|
||||
}
|
||||
case (ARC_ACTION_REQ_SETTIME_ID): {
|
||||
*foundId = startracker::SET_TIME_FROM_SYS_TIME;
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::CHECKSUM): {
|
||||
*foundId = startracker::CHECKSUM;
|
||||
break;
|
||||
@ -1417,6 +1470,10 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(uint8_t replyId,
|
||||
*foundId = startracker::DEBUG_CAMERA;
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::AUTO_THRESHOLD): {
|
||||
*foundId = startracker::AUTO_THRESHOLD;
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::LOG_SUBSCRIPTION): {
|
||||
*foundId = startracker::LOGSUBSCRIPTION;
|
||||
break;
|
||||
@ -1844,7 +1901,7 @@ ReturnValue_t StarTrackerHandler::handleSetParamReply(const uint8_t* rawFrame) {
|
||||
uint8_t status = startracker::getStatusField(rawFrame);
|
||||
if (status != startracker::STATUS_OK) {
|
||||
sif::warning << "StarTrackerHandler::handleSetParamReply: Failed to execute parameter set "
|
||||
" command with parameter ID"
|
||||
"command with parameter ID "
|
||||
<< static_cast<unsigned int>(*(rawFrame + PARAMETER_ID_OFFSET)) << std::endl;
|
||||
if (internalState != InternalState::IDLE) {
|
||||
internalState = InternalState::IDLE;
|
||||
@ -1852,21 +1909,25 @@ ReturnValue_t StarTrackerHandler::handleSetParamReply(const uint8_t* rawFrame) {
|
||||
return SET_PARAM_FAILED;
|
||||
}
|
||||
if (internalState != InternalState::IDLE) {
|
||||
handleStartup(*(rawFrame + PARAMETER_ID_OFFSET));
|
||||
handleStartup(*rawFrame, *(rawFrame + PARAMETER_ID_OFFSET));
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t StarTrackerHandler::handleActionReply(const uint8_t* rawFrame) {
|
||||
uint8_t status = startracker::getStatusField(rawFrame);
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
if (status != startracker::STATUS_OK) {
|
||||
sif::warning << "StarTrackerHandler::handleActionReply: Failed to execute action "
|
||||
<< "command with action ID "
|
||||
<< static_cast<unsigned int>(*(rawFrame + ACTION_ID_OFFSET)) << " and status "
|
||||
<< static_cast<unsigned int>(status) << std::endl;
|
||||
return ACTION_FAILED;
|
||||
result = ACTION_FAILED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
if (internalState != InternalState::IDLE) {
|
||||
handleStartup(*rawFrame, *(rawFrame + PARAMETER_ID_OFFSET));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t StarTrackerHandler::handleChecksumReply(const uint8_t* rawFrame) {
|
||||
@ -1962,7 +2023,7 @@ ReturnValue_t StarTrackerHandler::checkProgram() {
|
||||
startupState = StartupState::BOOT_BOOTLOADER;
|
||||
}
|
||||
if (bootState == FwBootState::VERIFY_BOOT) {
|
||||
bootState = FwBootState::LOGLEVEL;
|
||||
bootState = FwBootState::SET_TIME;
|
||||
} else if (internalState == InternalState::BOOTLOADER_CHECK) {
|
||||
triggerEvent(BOOTING_BOOTLOADER_FAILED_EVENT);
|
||||
internalState = InternalState::FAILED_BOOTLOADER_BOOT;
|
||||
@ -2039,7 +2100,18 @@ ReturnValue_t StarTrackerHandler::handleActionReplySet(const uint8_t* rawFrame,
|
||||
return result;
|
||||
}
|
||||
|
||||
void StarTrackerHandler::handleStartup(uint8_t parameterId) {
|
||||
void StarTrackerHandler::handleStartup(uint8_t tmType, uint8_t parameterId) {
|
||||
switch (tmType) {
|
||||
case (TMTC_ACTIONREPLY): {
|
||||
case (ARC_ACTION_REQ_SETTIME_ID): {
|
||||
bootState = FwBootState::LOGLEVEL;
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (parameterId) {
|
||||
case (startracker::ID::LOG_LEVEL): {
|
||||
bootState = FwBootState::LIMITS;
|
||||
@ -2049,7 +2121,7 @@ void StarTrackerHandler::handleStartup(uint8_t parameterId) {
|
||||
bootState = FwBootState::TRACKING;
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::TRACKING): {
|
||||
case (ARC_PARAM_TRACKING_ID): {
|
||||
bootState = FwBootState::MOUNTING;
|
||||
break;
|
||||
}
|
||||
@ -2090,6 +2162,10 @@ void StarTrackerHandler::handleStartup(uint8_t parameterId) {
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::DEBUG_CAMERA): {
|
||||
bootState = FwBootState::AUTO_THRESHOLD;
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::AUTO_THRESHOLD): {
|
||||
bootState = FwBootState::NONE;
|
||||
internalState = InternalState::DONE;
|
||||
break;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <mission/acs/str/ArcsecJsonParamBase.h>
|
||||
#include <mission/acs/str/strHelpers.h>
|
||||
#include <mission/acs/str/strJsonCommands.h>
|
||||
#include <thirdparty/sagittactl/wire/common/genericstructs.h>
|
||||
|
||||
#include <thread>
|
||||
|
||||
@ -16,7 +17,7 @@
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
|
||||
extern "C" {
|
||||
#include <wire/common/SLIP.h>
|
||||
#include <wire/common/genericstructs.h>
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,6 +144,8 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
||||
static const Event BOOTING_FIRMWARE_FAILED_EVENT = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to boot star tracker into bootloader mode
|
||||
static const Event BOOTING_BOOTLOADER_FAILED_EVENT = MAKE_EVENT(2, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Received COM error. P1: Communication Error ID (datasheet p32)
|
||||
static constexpr Event COM_ERROR_REPLY_RECEIVED = MAKE_EVENT(3, severity::LOW);
|
||||
|
||||
static const uint8_t STATUS_OFFSET = 2;
|
||||
static const uint8_t PARAMS_OFFSET = 2;
|
||||
@ -226,6 +229,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
||||
Mounting mounting;
|
||||
Limits limits;
|
||||
Subscription subscription;
|
||||
AutoThreshold autoThreshold;
|
||||
};
|
||||
JsonConfigs jcfgs;
|
||||
Countdown jcfgCountdown = Countdown(250);
|
||||
@ -264,6 +268,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
||||
BOOT_DELAY,
|
||||
REQ_VERSION,
|
||||
VERIFY_BOOT,
|
||||
SET_TIME,
|
||||
LOGLEVEL,
|
||||
LIMITS,
|
||||
TRACKING,
|
||||
@ -278,7 +283,9 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
||||
ALGO,
|
||||
LOG_SUBSCRIPTION,
|
||||
DEBUG_CAMERA,
|
||||
AUTO_THRESHOLD,
|
||||
WAIT_FOR_EXECUTION,
|
||||
RETRY_CFG_CMD
|
||||
};
|
||||
FwBootState bootState = FwBootState::NONE;
|
||||
|
||||
@ -468,7 +475,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
||||
/**
|
||||
* @brief Handles the startup state machine
|
||||
*/
|
||||
void handleStartup(uint8_t parameterId);
|
||||
void handleStartup(uint8_t tmType, uint8_t parameterId);
|
||||
|
||||
/**
|
||||
* @brief Handles telemtry replies and fills the appropriate dataset
|
||||
|
@ -176,6 +176,13 @@ static const char DEBUG_CAMERA[] = "DebugCamera";
|
||||
static const char TIMING[] = "timing";
|
||||
static const char TEST[] = "test";
|
||||
|
||||
static constexpr char AUTO_THRESHOLD[] = "AutoThreshold";
|
||||
static constexpr char AT_MODE[] = "mode";
|
||||
static constexpr char AT_DESIRED_BLOB_COUNTS[] = "desiredBlobsCount";
|
||||
static constexpr char AT_MIN_THRESHOLD[] = "minThreshold";
|
||||
static constexpr char AT_MAX_THRESHOLD[] = "maxThreshold";
|
||||
static constexpr char AT_THRESHOLD_KP[] = "thresholdKp";
|
||||
|
||||
} // namespace arcseckeys
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_ */
|
||||
|
@ -326,6 +326,8 @@ static const DeviceCommandId_t DEBUG_CAMERA = 83;
|
||||
static const DeviceCommandId_t FIRMWARE_UPDATE = 84;
|
||||
static const DeviceCommandId_t DISABLE_TIMESTAMP_GENERATION = 85;
|
||||
static const DeviceCommandId_t ENABLE_TIMESTAMP_GENERATION = 86;
|
||||
static constexpr DeviceCommandId_t SET_TIME_FROM_SYS_TIME = 87;
|
||||
static constexpr DeviceCommandId_t AUTO_THRESHOLD = 88;
|
||||
static const DeviceCommandId_t NONE = 0xFFFFFFFF;
|
||||
|
||||
static const uint32_t VERSION_SET_ID = REQ_VERSION;
|
||||
@ -396,7 +398,6 @@ static const uint8_t ALGO = 16;
|
||||
static const uint8_t REBOOT = 7;
|
||||
static const uint8_t UPLOAD_IMAGE = 10;
|
||||
static const uint8_t POWER = 11;
|
||||
static const uint8_t SET_TIME = 14;
|
||||
static const uint8_t SUBSCRIPTION = 18;
|
||||
static const uint8_t SOLUTION = 24;
|
||||
static const uint8_t TEMPERATURE = 27;
|
||||
@ -410,6 +411,7 @@ static const uint8_t TAKE_IMAGE = 15;
|
||||
static const uint8_t LOG_LEVEL = 3;
|
||||
static const uint8_t LOG_SUBSCRIPTION = 19;
|
||||
static const uint8_t DEBUG_CAMERA = 20;
|
||||
static const uint8_t AUTO_THRESHOLD = 23;
|
||||
} // namespace ID
|
||||
|
||||
namespace Program {
|
||||
@ -441,6 +443,21 @@ static const uint32_t secret[16]{
|
||||
REGION_12_SECRET, REGION_13_SECRET, REGION_14_SECRET, REGION_15_SECRET};
|
||||
} // namespace region_secrets
|
||||
|
||||
namespace comError {
|
||||
enum Id {
|
||||
BAD_CRC = 1,
|
||||
UNKNOWN_TM_ID = 2,
|
||||
UNKNOWN_PARAM_ID = 3,
|
||||
UNKNOWN_ACTION_REQ = 4,
|
||||
INVALID_TM_SIZE = 5,
|
||||
INVALID_PARAM_SIZE = 6,
|
||||
INVALID_ACTION_REQ_SIZE = 7,
|
||||
FRAME_TOO_SHORT = 8,
|
||||
INVALID_FRAME_TYPE = 9,
|
||||
UNKNOWN_ERROR = 10
|
||||
};
|
||||
}
|
||||
|
||||
enum class FlashSections : uint8_t {
|
||||
BOOTLOADER_SECTION = 0,
|
||||
MAIN_FIRMWARE_SECTION = 1,
|
||||
@ -650,7 +667,7 @@ class SolutionSet : public StaticLocalDataSet<SOLUTION_SET_ENTRIES> {
|
||||
// Ticks timestamp
|
||||
lp_var_t<uint32_t> ticks = lp_var_t<uint32_t>(sid.objectId, PoolIds::TICKS_SOLUTION_SET, this);
|
||||
/// Unix time stamp
|
||||
lp_var_t<uint64_t> time = lp_var_t<uint64_t>(sid.objectId, PoolIds::TIME_SOLUTION_SET, this);
|
||||
lp_var_t<uint64_t> timeUs = lp_var_t<uint64_t>(sid.objectId, PoolIds::TIME_SOLUTION_SET, this);
|
||||
// Calibrated quaternion (takes into account the mounting quaternion), typically same as
|
||||
// track q values
|
||||
lp_var_t<float> caliQw = lp_var_t<float>(sid.objectId, PoolIds::CALI_QW, this);
|
||||
@ -695,7 +712,7 @@ class SolutionSet : public StaticLocalDataSet<SOLUTION_SET_ENTRIES> {
|
||||
void printSet() {
|
||||
PoolReadGuard rg(this);
|
||||
sif::info << "SolutionSet::printSet: Ticks: " << this->ticks << std::endl;
|
||||
sif::info << "SolutionSet::printSet: Time: " << this->time << std::endl;
|
||||
sif::info << "SolutionSet::printSet: Time: " << this->timeUs << std::endl;
|
||||
sif::info << "SolutionSet::printSet: Calibrated quaternion Qw: " << this->caliQw << std::endl;
|
||||
sif::info << "SolutionSet::printSet: Calibrated quaternion Qx: " << this->caliQx << std::endl;
|
||||
sif::info << "SolutionSet::printSet: Calibrated quaternion Qy: " << this->caliQy << std::endl;
|
||||
|
@ -916,3 +916,45 @@ ReturnValue_t DebugCamera::createCommand(uint8_t* buffer) {
|
||||
adduint32(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
AutoThreshold::AutoThreshold() : ArcsecJsonParamBase(arcseckeys::AUTO_THRESHOLD) {}
|
||||
|
||||
size_t AutoThreshold::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t AutoThreshold::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::AUTO_THRESHOLD);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::AT_MODE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += 1;
|
||||
result = getParam(arcseckeys::AT_DESIRED_BLOB_COUNTS, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += 1;
|
||||
result = getParam(arcseckeys::AT_MIN_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint16(param, buffer + offset);
|
||||
offset += 2;
|
||||
result = getParam(arcseckeys::AT_MAX_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint16(param, buffer + offset);
|
||||
offset += 2;
|
||||
result = getParam(arcseckeys::AT_THRESHOLD_KP, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -222,6 +222,22 @@ class LogSubscription : public ArcsecJsonParamBase {
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to set log subscription parameters.
|
||||
*
|
||||
*/
|
||||
class AutoThreshold : public ArcsecJsonParamBase {
|
||||
public:
|
||||
AutoThreshold();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 12;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to set debug camera parameters
|
||||
*
|
||||
|
@ -93,6 +93,8 @@ ReturnValue_t CfdpHandler::handleCfdpPacket(TmTcMessage& msg) {
|
||||
return INVALID_PDU_FORMAT;
|
||||
}
|
||||
if (not FileDirectiveReader::checkFileDirective(pduDataField[0])) {
|
||||
sif::error << "CfdpHandler: Invalid PDU directive field " << static_cast<int>(pduDataField[0])
|
||||
<< std::endl;
|
||||
return INVALID_DIRECTIVE_FIELD;
|
||||
}
|
||||
auto directive = static_cast<FileDirective>(pduDataField[0]);
|
||||
|
@ -246,7 +246,13 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod
|
||||
void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
|
||||
triggerEvent(CHANGING_MODE, mode, submode);
|
||||
if (mode == HasModesIF::MODE_ON) {
|
||||
if (this->submode != submode) {
|
||||
uint32_t currentRate = ptmeConfig.getRate();
|
||||
// Check whether the rate actually changes.
|
||||
if ((this->submode != submode) and
|
||||
(((submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW) and
|
||||
(currentRate != RATE_100KBPS))) or
|
||||
((submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH) and
|
||||
(currentRate != RATE_500KBPS))))) {
|
||||
initPtmeUpdateAfterXCycles();
|
||||
updateContext.enableTransmitAfterPtmeUpdate = true;
|
||||
updateContext.updateClockRate = true;
|
||||
|
@ -19,13 +19,8 @@ LiveTmTask::LiveTmTask(object_id_t objectId, PusTmFunnel& pusFunnel, CfdpTmFunne
|
||||
ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
|
||||
readCommandQueue();
|
||||
while (true) {
|
||||
bool performWriteOp = true;
|
||||
if (mode == MODE_OFF or ptmeLocked) {
|
||||
performWriteOp = false;
|
||||
}
|
||||
|
||||
// The funnel tasks are scheduled here directly as well.
|
||||
ReturnValue_t result = channel.handleNextTm(performWriteOp);
|
||||
ReturnValue_t result = channel.handleNextTm(!ptmeLocked);
|
||||
if (result == DirectTmSinkIF::IS_BUSY) {
|
||||
sif::error << "Lost live TM, PAPB busy" << std::endl;
|
||||
}
|
||||
|
@ -773,11 +773,13 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
auto txStandbyHandler = [&]() {
|
||||
txDataset.setReportingEnabled(false);
|
||||
poolManager.changeCollectionInterval(temperatureSet.getSid(), 60.0);
|
||||
poolManager.changeCollectionInterval(rxDataset.getSid(), 60.0);
|
||||
transState = TransitionState::SET_TX_STANDBY;
|
||||
internalState = InternalState::TX_TRANSITION;
|
||||
};
|
||||
auto txOnHandler = [&](TransitionState tgtTransitionState) {
|
||||
txDataset.setReportingEnabled(true);
|
||||
poolManager.changeCollectionInterval(rxDataset.getSid(), 5.0);
|
||||
poolManager.changeCollectionInterval(txDataset.getSid(), 10.0);
|
||||
poolManager.changeCollectionInterval(temperatureSet.getSid(), 5.0);
|
||||
transState = tgtTransitionState;
|
||||
|
@ -45,13 +45,19 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
|
||||
} else {
|
||||
Command_t execCmd;
|
||||
// Handle TC requests, for example deletion or retrieval requests.
|
||||
// TODO: Not really clean here.. would be better if the executed command is returns as an
|
||||
// enumeration.
|
||||
result = store.handleCommandQueue(ipcStore, execCmd);
|
||||
if (result == returnvalue::OK) {
|
||||
if (execCmd == TmStoreMessage::DOWNLINK_STORE_CONTENT_TIME) {
|
||||
if (result == PersistentTmStore::DUMP_DONE) {
|
||||
dumpDoneHandler(store, dumpContext);
|
||||
} else if (result == returnvalue::OK) {
|
||||
cancelDumpCd.resetTimer();
|
||||
tmSinkBusyCd.resetTimer();
|
||||
dumpContext.reset();
|
||||
}
|
||||
}
|
||||
if (execCmd != CommandMessageIF::CMD_NONE) {
|
||||
tcRequestReceived = true;
|
||||
}
|
||||
}
|
||||
@ -119,21 +125,13 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store,
|
||||
DumpContext& dumpContext, bool& dumpPerformed) {
|
||||
size_t dumpedLen = 0;
|
||||
|
||||
auto dumpDoneHandler = [&]() {
|
||||
uint32_t startTime;
|
||||
uint32_t endTime;
|
||||
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
|
||||
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets,
|
||||
dumpContext.dumpedBytes);
|
||||
dumpContext.reset();
|
||||
};
|
||||
// Dump the next packet into the PTME.
|
||||
dumpContext.ptmeBusyCounter = 0;
|
||||
tmSinkBusyCd.resetTimer();
|
||||
ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped);
|
||||
if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
|
||||
// This can happen if a file is corrupted and the next file swap completes the dump.
|
||||
dumpDoneHandler();
|
||||
dumpDoneHandler(store, dumpContext);
|
||||
return returnvalue::OK;
|
||||
} else if (result != returnvalue::OK) {
|
||||
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
|
||||
@ -157,7 +155,7 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store,
|
||||
}
|
||||
}
|
||||
if (result == PersistentTmStore::DUMP_DONE) {
|
||||
dumpDoneHandler();
|
||||
dumpDoneHandler(store, dumpContext);
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -198,6 +196,14 @@ ReturnValue_t TmStoreTaskBase::connectModeTreeParent(HasModeTreeChildrenIF& pare
|
||||
return modetree::connectModeTreeParent(parent, *this, nullptr, modeHelper);
|
||||
}
|
||||
|
||||
void TmStoreTaskBase::dumpDoneHandler(PersistentTmStore& store, DumpContext& dumpContext) {
|
||||
uint32_t startTime;
|
||||
uint32_t endTime;
|
||||
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
|
||||
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets, dumpContext.dumpedBytes);
|
||||
dumpContext.reset();
|
||||
}
|
||||
|
||||
ModeTreeChildIF& TmStoreTaskBase::getModeTreeChildIF() { return *this; }
|
||||
|
||||
void TmStoreTaskBase::readCommandQueue(void) {
|
||||
|
@ -96,6 +96,8 @@ class TmStoreTaskBase : public SystemObject,
|
||||
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
void dumpDoneHandler(PersistentTmStore& store, DumpContext& dumpContext);
|
||||
|
||||
void announceMode(bool recursive) override;
|
||||
object_id_t getObjectId() const override;
|
||||
const HasHealthIF* getOptHealthIF() const override;
|
||||
|
@ -169,7 +169,7 @@ void AcsController::performSafe() {
|
||||
guidance.getTargetParamsSafe(sunTargetDir);
|
||||
|
||||
double magMomMtq[3] = {0, 0, 0}, errAng = 0.0;
|
||||
uint8_t safeCtrlStrat = safeCtrl.safeCtrlStrategy(
|
||||
acs::SafeModeStrategy safeCtrlStrat = safeCtrl.safeCtrlStrategy(
|
||||
mgmDataProcessed.mgmVecTot.isValid(), not mekfInvalidFlag,
|
||||
gyrDataProcessed.gyrVecTot.isValid(), susDataProcessed.susVecTot.isValid(),
|
||||
acsParameters.safeModeControllerParameters.useMekf,
|
||||
@ -205,11 +205,13 @@ void AcsController::performSafe() {
|
||||
case (acs::SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL):
|
||||
safeCtrlFailure(0, 1);
|
||||
break;
|
||||
default:
|
||||
sif::error << "AcsController: Invalid safe mode strategy for performSafe" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
actuatorCmd.cmdDipolMtq(magMomMtq, cmdDipolMtqs,
|
||||
*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||
acsParameters.magnetorquerParameter.dipolMax);
|
||||
actuatorCmd.cmdDipoleMtq(*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||
acsParameters.magnetorquerParameter.dipoleMax, magMomMtq, cmdDipoleMtqs);
|
||||
|
||||
// detumble check and switch
|
||||
if (mekfData.satRotRateMekf.isValid() && acsParameters.safeModeControllerParameters.useMekf &&
|
||||
@ -231,8 +233,8 @@ void AcsController::performSafe() {
|
||||
}
|
||||
|
||||
updateCtrlValData(errAng, safeCtrlStrat);
|
||||
updateActuatorCmdData(cmdDipolMtqs);
|
||||
commandActuators(cmdDipolMtqs[0], cmdDipolMtqs[1], cmdDipolMtqs[2],
|
||||
updateActuatorCmdData(cmdDipoleMtqs);
|
||||
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
|
||||
acsParameters.magnetorquerParameter.torqueDuration);
|
||||
}
|
||||
|
||||
@ -259,7 +261,7 @@ void AcsController::performDetumble() {
|
||||
triggerEvent(acs::MEKF_RECOVERY);
|
||||
mekfInvalidFlag = false;
|
||||
}
|
||||
uint8_t safeCtrlStrat = detumble.detumbleStrategy(
|
||||
acs::SafeModeStrategy safeCtrlStrat = detumble.detumbleStrategy(
|
||||
mgmDataProcessed.mgmVecTot.isValid(), gyrDataProcessed.gyrVecTot.isValid(),
|
||||
mgmDataProcessed.mgmVecTotDerivative.isValid(),
|
||||
acsParameters.detumbleParameter.useFullDetumbleLaw);
|
||||
@ -279,11 +281,13 @@ void AcsController::performDetumble() {
|
||||
case (acs::SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL):
|
||||
safeCtrlFailure(0, 1);
|
||||
break;
|
||||
default:
|
||||
sif::error << "AcsController: Invalid safe mode strategy for performDetumble" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
actuatorCmd.cmdDipolMtq(magMomMtq, cmdDipolMtqs,
|
||||
*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||
acsParameters.magnetorquerParameter.dipolMax);
|
||||
actuatorCmd.cmdDipoleMtq(*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||
acsParameters.magnetorquerParameter.dipoleMax, magMomMtq, cmdDipoleMtqs);
|
||||
|
||||
if (mekfData.satRotRateMekf.isValid() &&
|
||||
VectorOperations<double>::norm(mekfData.satRotRateMekf.value, 3) <
|
||||
@ -304,8 +308,8 @@ void AcsController::performDetumble() {
|
||||
}
|
||||
|
||||
disableCtrlValData();
|
||||
updateActuatorCmdData(cmdDipolMtqs);
|
||||
commandActuators(cmdDipolMtqs[0], cmdDipolMtqs[1], cmdDipolMtqs[2],
|
||||
updateActuatorCmdData(cmdDipoleMtqs);
|
||||
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
|
||||
acsParameters.magnetorquerParameter.torqueDuration);
|
||||
}
|
||||
|
||||
@ -366,24 +370,26 @@ void AcsController::performPointingCtrl() {
|
||||
// Variables required for setting actuators
|
||||
double torquePtgRws[4] = {0, 0, 0, 0}, rwTrqNs[4] = {0, 0, 0, 0}, torqueRws[4] = {0, 0, 0, 0},
|
||||
mgtDpDes[3] = {0, 0, 0};
|
||||
|
||||
switch (mode) {
|
||||
case acs::PTG_IDLE:
|
||||
guidance.targetQuatPtgSun(susDataProcessed.sunIjkModel.value, targetQuat, targetSatRotRate);
|
||||
guidance.targetQuatPtgSun(now, susDataProcessed.sunIjkModel.value, targetQuat,
|
||||
targetSatRotRate);
|
||||
guidance.comparePtg(mekfData.quatMekf.value, mekfData.satRotRateMekf.value, targetQuat,
|
||||
targetSatRotRate, errorQuat, errorSatRotRate, errorAngle);
|
||||
ptgCtrl.ptgLaw(&acsParameters.idleModeControllerParameters, errorQuat, errorSatRotRate,
|
||||
*rwPseudoInv, torquePtgRws);
|
||||
ptgCtrl.ptgNullspace(
|
||||
&acsParameters.idleModeControllerParameters, &(sensorValues.rw1Set.currSpeed.value),
|
||||
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
||||
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
||||
ptgCtrl.ptgNullspace(&acsParameters.idleModeControllerParameters,
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value,
|
||||
rwTrqNs);
|
||||
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
||||
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
||||
ptgCtrl.ptgDesaturation(
|
||||
&acsParameters.idleModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
||||
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
||||
&(sensorValues.rw1Set.currSpeed.value), &(sensorValues.rw2Set.currSpeed.value),
|
||||
&(sensorValues.rw3Set.currSpeed.value), &(sensorValues.rw4Set.currSpeed.value), mgtDpDes);
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes);
|
||||
enableAntiStiction = acsParameters.idleModeControllerParameters.enableAntiStiction;
|
||||
break;
|
||||
|
||||
@ -397,17 +403,17 @@ void AcsController::performPointingCtrl() {
|
||||
errorSatRotRate, errorAngle);
|
||||
ptgCtrl.ptgLaw(&acsParameters.targetModeControllerParameters, errorQuat, errorSatRotRate,
|
||||
*rwPseudoInv, torquePtgRws);
|
||||
ptgCtrl.ptgNullspace(
|
||||
&acsParameters.targetModeControllerParameters, &(sensorValues.rw1Set.currSpeed.value),
|
||||
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
||||
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
||||
ptgCtrl.ptgNullspace(&acsParameters.targetModeControllerParameters,
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value,
|
||||
rwTrqNs);
|
||||
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
||||
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
||||
ptgCtrl.ptgDesaturation(
|
||||
&acsParameters.targetModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
||||
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
||||
&(sensorValues.rw1Set.currSpeed.value), &(sensorValues.rw2Set.currSpeed.value),
|
||||
&(sensorValues.rw3Set.currSpeed.value), &(sensorValues.rw4Set.currSpeed.value), mgtDpDes);
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes);
|
||||
enableAntiStiction = acsParameters.targetModeControllerParameters.enableAntiStiction;
|
||||
break;
|
||||
|
||||
@ -418,17 +424,17 @@ void AcsController::performPointingCtrl() {
|
||||
targetSatRotRate, errorQuat, errorSatRotRate, errorAngle);
|
||||
ptgCtrl.ptgLaw(&acsParameters.gsTargetModeControllerParameters, errorQuat, errorSatRotRate,
|
||||
*rwPseudoInv, torquePtgRws);
|
||||
ptgCtrl.ptgNullspace(
|
||||
&acsParameters.gsTargetModeControllerParameters, &(sensorValues.rw1Set.currSpeed.value),
|
||||
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
||||
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
||||
ptgCtrl.ptgNullspace(&acsParameters.gsTargetModeControllerParameters,
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value,
|
||||
rwTrqNs);
|
||||
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
||||
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
||||
ptgCtrl.ptgDesaturation(
|
||||
&acsParameters.gsTargetModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
||||
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
||||
&(sensorValues.rw1Set.currSpeed.value), &(sensorValues.rw2Set.currSpeed.value),
|
||||
&(sensorValues.rw3Set.currSpeed.value), &(sensorValues.rw4Set.currSpeed.value), mgtDpDes);
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes);
|
||||
enableAntiStiction = acsParameters.gsTargetModeControllerParameters.enableAntiStiction;
|
||||
break;
|
||||
|
||||
@ -442,63 +448,61 @@ void AcsController::performPointingCtrl() {
|
||||
errorSatRotRate, errorAngle);
|
||||
ptgCtrl.ptgLaw(&acsParameters.nadirModeControllerParameters, errorQuat, errorSatRotRate,
|
||||
*rwPseudoInv, torquePtgRws);
|
||||
ptgCtrl.ptgNullspace(
|
||||
&acsParameters.nadirModeControllerParameters, &(sensorValues.rw1Set.currSpeed.value),
|
||||
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
||||
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
||||
ptgCtrl.ptgNullspace(&acsParameters.nadirModeControllerParameters,
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value,
|
||||
rwTrqNs);
|
||||
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
||||
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
||||
ptgCtrl.ptgDesaturation(
|
||||
&acsParameters.nadirModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
||||
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
||||
&(sensorValues.rw1Set.currSpeed.value), &(sensorValues.rw2Set.currSpeed.value),
|
||||
&(sensorValues.rw3Set.currSpeed.value), &(sensorValues.rw4Set.currSpeed.value), mgtDpDes);
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes);
|
||||
enableAntiStiction = acsParameters.nadirModeControllerParameters.enableAntiStiction;
|
||||
break;
|
||||
|
||||
case acs::PTG_INERTIAL:
|
||||
std::memcpy(targetQuat, acsParameters.inertialModeControllerParameters.tgtQuat,
|
||||
4 * sizeof(double));
|
||||
sizeof(targetQuat));
|
||||
guidance.comparePtg(mekfData.quatMekf.value, mekfData.satRotRateMekf.value, targetQuat,
|
||||
targetSatRotRate, acsParameters.inertialModeControllerParameters.quatRef,
|
||||
acsParameters.inertialModeControllerParameters.refRotRate, errorQuat,
|
||||
errorSatRotRate, errorAngle);
|
||||
ptgCtrl.ptgLaw(&acsParameters.inertialModeControllerParameters, errorQuat, errorSatRotRate,
|
||||
*rwPseudoInv, torquePtgRws);
|
||||
ptgCtrl.ptgNullspace(
|
||||
&acsParameters.inertialModeControllerParameters, &(sensorValues.rw1Set.currSpeed.value),
|
||||
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
||||
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
||||
ptgCtrl.ptgNullspace(&acsParameters.inertialModeControllerParameters,
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value,
|
||||
rwTrqNs);
|
||||
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
||||
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
||||
ptgCtrl.ptgDesaturation(
|
||||
&acsParameters.inertialModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
||||
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
||||
&(sensorValues.rw1Set.currSpeed.value), &(sensorValues.rw2Set.currSpeed.value),
|
||||
&(sensorValues.rw3Set.currSpeed.value), &(sensorValues.rw4Set.currSpeed.value), mgtDpDes);
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes);
|
||||
enableAntiStiction = acsParameters.inertialModeControllerParameters.enableAntiStiction;
|
||||
break;
|
||||
default:
|
||||
sif::error << "AcsController: Invalid mode for performPointingCtrl";
|
||||
sif::error << "AcsController: Invalid mode for performPointingCtrl" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
actuatorCmd.cmdSpeedToRws(
|
||||
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, torqueRws,
|
||||
cmdSpeedRws, acsParameters.onBoardParams.sampleTime,
|
||||
acsParameters.rwHandlingParameters.maxRwSpeed,
|
||||
acsParameters.rwHandlingParameters.inertiaWheel);
|
||||
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value,
|
||||
acsParameters.onBoardParams.sampleTime, acsParameters.rwHandlingParameters.inertiaWheel,
|
||||
acsParameters.rwHandlingParameters.maxRwSpeed, torqueRws, cmdSpeedRws);
|
||||
if (enableAntiStiction) {
|
||||
ptgCtrl.rwAntistiction(&sensorValues, cmdSpeedRws);
|
||||
}
|
||||
actuatorCmd.cmdDipolMtq(mgtDpDes, cmdDipolMtqs,
|
||||
*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||
acsParameters.magnetorquerParameter.dipolMax);
|
||||
actuatorCmd.cmdDipoleMtq(*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||
acsParameters.magnetorquerParameter.dipoleMax, mgtDpDes, cmdDipoleMtqs);
|
||||
|
||||
updateCtrlValData(targetQuat, errorQuat, errorAngle, targetSatRotRate);
|
||||
updateActuatorCmdData(torqueRws, cmdSpeedRws, cmdDipolMtqs);
|
||||
commandActuators(cmdDipolMtqs[0], cmdDipolMtqs[1], cmdDipolMtqs[2],
|
||||
updateActuatorCmdData(torqueRws, cmdSpeedRws, cmdDipoleMtqs);
|
||||
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
|
||||
acsParameters.magnetorquerParameter.torqueDuration, cmdSpeedRws[0],
|
||||
cmdSpeedRws[1], cmdSpeedRws[2], cmdSpeedRws[3],
|
||||
acsParameters.rwHandlingParameters.rampTime);
|
||||
|
@ -69,7 +69,7 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
||||
bool mekfLost = false;
|
||||
|
||||
int32_t cmdSpeedRws[4] = {0, 0, 0, 0};
|
||||
int16_t cmdDipolMtqs[3] = {0, 0, 0};
|
||||
int16_t cmdDipoleMtqs[3] = {0, 0, 0};
|
||||
|
||||
#if OBSW_THREAD_TRACING == 1
|
||||
uint32_t opCounter = 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
#ifndef MISSION_CONTROLLER_THERMALCONTROLLER_H_
|
||||
#define MISSION_CONTROLLER_THERMALCONTROLLER_H_
|
||||
|
||||
#include <bsp_q7s/core/CoreDefinitions.h>
|
||||
#include <bsp_q7s/core/defs.h>
|
||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerThermalSet.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
@ -24,74 +24,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
|
||||
/**
|
||||
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
|
||||
* is exceeded.
|
||||
* OP Limit: Soft limit. Device should be switched off or TCS controller should take action if the
|
||||
* limit is exceeded to avoid reaching NOP limit
|
||||
*/
|
||||
struct TempLimits {
|
||||
TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit,
|
||||
float nopUpperLimit)
|
||||
: opLowerLimit(opLowerLimit),
|
||||
opUpperLimit(opUpperLimit),
|
||||
cutOffLimit(cutOffLimit),
|
||||
nopLowerLimit(nopLowerLimit),
|
||||
nopUpperLimit(nopUpperLimit) {}
|
||||
float opLowerLimit;
|
||||
float opUpperLimit;
|
||||
float cutOffLimit;
|
||||
float nopLowerLimit;
|
||||
float nopUpperLimit;
|
||||
};
|
||||
|
||||
struct ThermalState {
|
||||
uint8_t errorCounter;
|
||||
// Is heating on for that thermal module?
|
||||
bool heating = false;
|
||||
heater::Switch heaterSwitch = heater::Switch::NUMBER_OF_SWITCHES;
|
||||
// Heater start time and end times as UNIX seconds. Please note that these times will be updated
|
||||
// when a switch command is sent, with no guarantess that the heater actually went on.
|
||||
uint32_t heaterStartTime = 0;
|
||||
uint32_t heaterEndTime = 0;
|
||||
};
|
||||
|
||||
struct HeaterState {
|
||||
bool switchTransition;
|
||||
HeaterHandler::SwitchState target;
|
||||
uint8_t heaterSwitchControlCycles;
|
||||
};
|
||||
|
||||
using HeaterSwitchStates = std::array<HeaterHandler::SwitchState, heater::NUMBER_OF_SWITCHES>;
|
||||
|
||||
enum ThermalComponents : uint8_t {
|
||||
NONE = 0,
|
||||
ACS_BOARD = 1,
|
||||
MGT = 2,
|
||||
RW = 3,
|
||||
STR = 4,
|
||||
IF_BOARD = 5,
|
||||
TCS_BOARD = 6,
|
||||
OBC = 7,
|
||||
OBCIF_BOARD = 8,
|
||||
SBAND_TRANSCEIVER = 9,
|
||||
PCDUP60_BOARD = 10,
|
||||
PCDUACU = 11,
|
||||
PCDUPDU = 12,
|
||||
PLPCDU_BOARD = 13,
|
||||
PLOCMISSION_BOARD = 14,
|
||||
PLOCPROCESSING_BOARD = 15,
|
||||
DAC = 16,
|
||||
CAMERA = 17,
|
||||
DRO = 18,
|
||||
X8 = 19,
|
||||
HPA = 20,
|
||||
TX = 21,
|
||||
MPA = 22,
|
||||
SCEX_BOARD = 23,
|
||||
NUM_ENTRIES
|
||||
};
|
||||
#include <optional>
|
||||
|
||||
class ThermalController : public ExtendedControllerBase {
|
||||
public:
|
||||
@ -102,8 +35,28 @@ class ThermalController : public ExtendedControllerBase {
|
||||
static constexpr int16_t SANITY_LIMIT_LOWER_TEMP = -80;
|
||||
static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160;
|
||||
|
||||
// 1 hour
|
||||
static constexpr uint32_t DEFAULT_MAX_HEATER_ON_DURATION_MS = 60 * 60 * 1000;
|
||||
static constexpr uint32_t MAX_HEATER_ON_DURATIONS_MS[8] = {// PLOC PROC board
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// PCDU PDU
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// ACS Board
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// OBC Board
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// Camera
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// STR
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// DRO
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS,
|
||||
// S-Band
|
||||
DEFAULT_MAX_HEATER_ON_DURATION_MS};
|
||||
|
||||
ThermalController(object_id_t objectId, HeaterHandler& heater,
|
||||
const std::atomic_bool& tcsBoardShortUnavailable);
|
||||
const std::atomic_bool& tcsBoardShortUnavailable, bool pollPcdu1Tmp);
|
||||
virtual ~ThermalController();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
@ -111,16 +64,16 @@ class ThermalController : public ExtendedControllerBase {
|
||||
struct HeaterContext {
|
||||
public:
|
||||
HeaterContext(heater::Switch switchNr, heater::Switch redundantSwitchNr,
|
||||
const TempLimits& tempLimit)
|
||||
const tcsCtrl::TempLimits& tempLimit)
|
||||
: switchNr(switchNr), redSwitchNr(redundantSwitchNr), tempLimit(tempLimit) {}
|
||||
bool doHeaterHandling = true;
|
||||
heater::Switch switchNr;
|
||||
HeaterHandler::SwitchState switchState = HeaterHandler::SwitchState::OFF;
|
||||
heater::SwitchState switchState = heater::SwitchState::OFF;
|
||||
heater::Switch redSwitchNr;
|
||||
const TempLimits& tempLimit;
|
||||
const tcsCtrl::TempLimits& tempLimit;
|
||||
};
|
||||
|
||||
void performThermalModuleCtrl(const HeaterSwitchStates& heaterSwitchStates);
|
||||
void performThermalModuleCtrl(const tcsCtrl::HeaterSwitchStates& heaterSwitchStates);
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
void performControlOperation() override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
@ -142,12 +95,12 @@ class ThermalController : public ExtendedControllerBase {
|
||||
|
||||
HeaterHandler& heaterHandler;
|
||||
|
||||
bool pollPcdu1Tmp;
|
||||
tcsCtrl::SensorTemperatures sensorTemperatures;
|
||||
tcsCtrl::SusTemperatures susTemperatures;
|
||||
tcsCtrl::DeviceTemperatures deviceTemperatures;
|
||||
tcsCtrl::HeaterInfo heaterInfo;
|
||||
lp_vec_t<int16_t, 9> currentVecPdu2 =
|
||||
lp_vec_t<int16_t, 9>(gp_id_t(objects::PDU2_HANDLER, PDU::pool::PDU_CURRENTS));
|
||||
tcsCtrl::TcsCtrlInfo tcsCtrlInfo;
|
||||
|
||||
DeviceHandlerThermalSet imtqThermalSet;
|
||||
|
||||
@ -173,7 +126,7 @@ class ThermalController : public ExtendedControllerBase {
|
||||
TMP1075::Tmp1075Dataset tmp1075SetTcs1;
|
||||
TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0;
|
||||
// damaged
|
||||
// TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1;
|
||||
TMP1075::Tmp1075Dataset* tmp1075SetPlPcdu1;
|
||||
TMP1075::Tmp1075Dataset tmp1075SetIfBoard;
|
||||
|
||||
// SUS
|
||||
@ -227,39 +180,48 @@ class ThermalController : public ExtendedControllerBase {
|
||||
lp_var_t<float> tempMgm2 =
|
||||
lp_var_t<float>(objects::MGM_2_LIS3_HANDLER, mgmLis3::TEMPERATURE_CELCIUS);
|
||||
lp_var_t<float> tempAdcPayloadPcdu = lp_var_t<float>(objects::PLPCDU_HANDLER, plpcdu::TEMP);
|
||||
lp_vec_t<int16_t, 9> currentVecPdu2 =
|
||||
lp_vec_t<int16_t, 9>(gp_id_t(objects::PDU2_HANDLER, PDU::pool::PDU_CURRENTS));
|
||||
|
||||
// TempLimits
|
||||
TempLimits acsBoardLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||
TempLimits mgtLimits = TempLimits(-40.0, -40.0, 65.0, 70.0, 70.0);
|
||||
TempLimits rwLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||
TempLimits strLimits = TempLimits(-30.0, -20.0, 65.0, 70.0, 80.0);
|
||||
TempLimits ifBoardLimits = TempLimits(-65.0, -40.0, 80.0, 85.0, 150.0);
|
||||
TempLimits tcsBoardLimits = TempLimits(-60.0, -40.0, 80.0, 85.0, 130.0);
|
||||
TempLimits obcLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||
TempLimits obcIfBoardLimits = TempLimits(-65.0, -40.0, 80.0, 85.0, 125.0);
|
||||
TempLimits sBandTransceiverLimits = TempLimits(-40.0, -25.0, 35.0, 40.0, 65.0);
|
||||
TempLimits pcduP60BoardLimits = TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0);
|
||||
TempLimits pcduAcuLimits = TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0);
|
||||
TempLimits pcduPduLimits = TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0);
|
||||
TempLimits plPcduBoardLimits = TempLimits(-55.0, -40.0, 80.0, 85.0, 125.0);
|
||||
TempLimits plocMissionBoardLimits = TempLimits(-30.0, -10.0, 40.0, 45.0, 60);
|
||||
TempLimits plocProcessingBoardLimits = TempLimits(-30.0, -10.0, 40.0, 45.0, 60.0);
|
||||
TempLimits dacLimits = TempLimits(-65.0, -40.0, 113.0, 118.0, 150.0);
|
||||
TempLimits cameraLimits = TempLimits(-40.0, -30.0, 60.0, 65.0, 85.0);
|
||||
TempLimits droLimits = TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
TempLimits x8Limits = TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
TempLimits hpaLimits = TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
TempLimits txLimits = TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
TempLimits mpaLimits = TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
TempLimits scexBoardLimits = TempLimits(-60.0, -40.0, 80.0, 85.0, 150.0);
|
||||
tcsCtrl::TempLimits acsBoardLimits = tcsCtrl::TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||
tcsCtrl::TempLimits mgtLimits = tcsCtrl::TempLimits(-40.0, -40.0, 65.0, 70.0, 70.0);
|
||||
tcsCtrl::TempLimits rwLimits = tcsCtrl::TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||
tcsCtrl::TempLimits strLimits = tcsCtrl::TempLimits(-30.0, -20.0, 65.0, 70.0, 80.0);
|
||||
tcsCtrl::TempLimits ifBoardLimits = tcsCtrl::TempLimits(-65.0, -40.0, 80.0, 85.0, 150.0);
|
||||
tcsCtrl::TempLimits tcsBoardLimits = tcsCtrl::TempLimits(-60.0, -40.0, 80.0, 85.0, 130.0);
|
||||
tcsCtrl::TempLimits obcLimits = tcsCtrl::TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||
tcsCtrl::TempLimits obcIfBoardLimits = tcsCtrl::TempLimits(-65.0, -40.0, 80.0, 85.0, 125.0);
|
||||
tcsCtrl::TempLimits sBandTransceiverLimits = tcsCtrl::TempLimits(-40.0, -25.0, 35.0, 40.0, 65.0);
|
||||
tcsCtrl::TempLimits pcduP60BoardLimits = tcsCtrl::TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0);
|
||||
tcsCtrl::TempLimits pcduAcuLimits = tcsCtrl::TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0);
|
||||
tcsCtrl::TempLimits pcduPduLimits = tcsCtrl::TempLimits(-35.0, -35.0, 80.0, 85.0, 85.0);
|
||||
tcsCtrl::TempLimits plPcduBoardLimits = tcsCtrl::TempLimits(-55.0, -40.0, 80.0, 85.0, 125.0);
|
||||
tcsCtrl::TempLimits plocMissionBoardLimits = tcsCtrl::TempLimits(-30.0, -10.0, 40.0, 45.0, 60);
|
||||
tcsCtrl::TempLimits plocProcessingBoardLimits =
|
||||
tcsCtrl::TempLimits(-30.0, -10.0, 40.0, 45.0, 60.0);
|
||||
tcsCtrl::TempLimits dacLimits = tcsCtrl::TempLimits(-65.0, -40.0, 113.0, 118.0, 150.0);
|
||||
tcsCtrl::TempLimits cameraLimits = tcsCtrl::TempLimits(-40.0, -30.0, 60.0, 65.0, 85.0);
|
||||
tcsCtrl::TempLimits droLimits = tcsCtrl::TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
tcsCtrl::TempLimits x8Limits = tcsCtrl::TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
tcsCtrl::TempLimits hpaLimits = tcsCtrl::TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
tcsCtrl::TempLimits txLimits = tcsCtrl::TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
tcsCtrl::TempLimits mpaLimits = tcsCtrl::TempLimits(-40.0, -30.0, 75.0, 80.0, 90.0);
|
||||
tcsCtrl::TempLimits scexBoardLimits = tcsCtrl::TempLimits(-60.0, -40.0, 80.0, 85.0, 150.0);
|
||||
|
||||
struct CtrlContext {
|
||||
double sensorTemp = INVALID_TEMPERATURE;
|
||||
ThermalComponents thermalComponent = NONE;
|
||||
uint8_t currentSensorIndex = 0;
|
||||
tcsCtrl::ThermalComponents thermalComponent = tcsCtrl::NONE;
|
||||
bool redSwitchNrInUse = false;
|
||||
MessageQueueId_t camId = MessageQueueIF::NO_QUEUE;
|
||||
bool componentAboveCutOffLimit = false;
|
||||
bool componentAboveUpperLimit = false;
|
||||
Event overHeatEventToTrigger;
|
||||
} ctrlCtx;
|
||||
|
||||
MessageQueueId_t camId = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
struct TooHotFlags {
|
||||
bool eBandTooHotFlag = false;
|
||||
bool camTooHotOneShotFlag = false;
|
||||
bool scexTooHotFlag = false;
|
||||
@ -270,14 +232,15 @@ class ThermalController : public ExtendedControllerBase {
|
||||
bool mgtTooHotFlag = false;
|
||||
bool strTooHotFlag = false;
|
||||
bool rwTooHotFlag = false;
|
||||
} tooHotFlags;
|
||||
|
||||
bool transitionWhenHeatersOff = false;
|
||||
uint32_t transitionWhenHeatersOffCycles = 0;
|
||||
Mode_t targetMode = MODE_OFF;
|
||||
Submode_t targetSubmode = SUBMODE_NONE;
|
||||
uint32_t cycles = 0;
|
||||
std::array<ThermalState, ThermalComponents::NUM_ENTRIES> thermalStates{};
|
||||
std::array<HeaterState, heater::NUMBER_OF_SWITCHES> heaterStates{};
|
||||
std::array<tcsCtrl::ThermalState, tcsCtrl::NUM_THERMAL_COMPONENTS> thermalStates{};
|
||||
std::array<tcsCtrl::HeaterState, heater::NUMBER_OF_SWITCHES> heaterStates{};
|
||||
|
||||
// Initial delay to make sure all pool variables have been initialized their owners.
|
||||
// Also, wait for system initialization to complete.
|
||||
@ -298,6 +261,12 @@ class ThermalController : public ExtendedControllerBase {
|
||||
PoolEntry<uint8_t> heaterSwitchStates = PoolEntry<uint8_t>(heater::NUMBER_OF_SWITCHES);
|
||||
PoolEntry<int16_t> heaterCurrent = PoolEntry<int16_t>();
|
||||
|
||||
PoolEntry<uint8_t> tcsCtrlHeaterOn = PoolEntry<uint8_t>(tcsCtrl::NUM_THERMAL_COMPONENTS);
|
||||
PoolEntry<uint8_t> tcsCtrlSensorIdx = PoolEntry<uint8_t>(tcsCtrl::NUM_THERMAL_COMPONENTS);
|
||||
PoolEntry<uint8_t> tcsCtrlHeaterIdx = PoolEntry<uint8_t>(tcsCtrl::NUM_THERMAL_COMPONENTS);
|
||||
PoolEntry<uint32_t> tcsCtrlStartTimes = PoolEntry<uint32_t>(tcsCtrl::NUM_THERMAL_COMPONENTS);
|
||||
PoolEntry<uint32_t> tcsCtrlEndTimes = PoolEntry<uint32_t>(tcsCtrl::NUM_THERMAL_COMPONENTS);
|
||||
|
||||
static constexpr dur_millis_t MUTEX_TIMEOUT = 50;
|
||||
|
||||
void startTransition(Mode_t mode, Submode_t submode) override;
|
||||
@ -319,8 +288,8 @@ class ThermalController : public ExtendedControllerBase {
|
||||
bool selectAndReadSensorTemp(HeaterContext& htrCtx);
|
||||
|
||||
void heaterSwitchHelperAllOff();
|
||||
void heaterSwitchHelper(heater::Switch switchNr, HeaterHandler::SwitchState state,
|
||||
unsigned componentIdx);
|
||||
void heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState state,
|
||||
std::optional<unsigned> componentIdx);
|
||||
|
||||
void ctrlAcsBoard();
|
||||
void ctrlMgt();
|
||||
@ -329,7 +298,6 @@ class ThermalController : public ExtendedControllerBase {
|
||||
void ctrlIfBoard();
|
||||
void ctrlTcsBoard();
|
||||
void ctrlObc();
|
||||
void ctrlObcIfBoard();
|
||||
void ctrlSBandTransceiver();
|
||||
void ctrlPcduP60Board();
|
||||
void ctrlPcduAcu();
|
||||
@ -345,7 +313,22 @@ class ThermalController : public ExtendedControllerBase {
|
||||
void ctrlTx();
|
||||
void ctrlMpa();
|
||||
void ctrlScexBoard();
|
||||
void heaterTransitionControl(const HeaterSwitchStates& currentHeaterStates);
|
||||
|
||||
/**
|
||||
* The transition of heaters might take some time. As long as a transition is
|
||||
* going on, the TCS controller works in a reduced form. This function takes care
|
||||
* of tracking transition and capturing their completion.
|
||||
* @param currentHeaterStates
|
||||
*/
|
||||
void heaterTransitionControl(const tcsCtrl::HeaterSwitchStates& currentHeaterStates);
|
||||
/**
|
||||
* Control tasks to prevent heaters being on for prolonged periods. Ideally, this
|
||||
* should never happen, but this task prevents bugs from causing heaters to stay on
|
||||
* for a long time, which draws a lot of power.
|
||||
* @param currentHeaterStates
|
||||
*/
|
||||
void heaterMaxDurationControl(const tcsCtrl::HeaterSwitchStates& currentHeaterStates);
|
||||
void crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(heater::Switch switchIdx);
|
||||
void setMode(Mode_t mode, Submode_t submode);
|
||||
uint32_t tempFloatToU32() const;
|
||||
bool tooHotHandler(object_id_t object, bool& oneShotFlag);
|
||||
|
@ -221,6 +221,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
case 0x23:
|
||||
parameterWrapper->setMatrix(susHandlingParameters.sus11coeffBeta);
|
||||
break;
|
||||
case 0x24:
|
||||
parameterWrapper->set(susHandlingParameters.susBrightnessThreshold);
|
||||
break;
|
||||
default:
|
||||
return INVALID_IDENTIFIER_ID;
|
||||
}
|
||||
@ -318,7 +321,7 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->setMatrix(rwMatrices.without4);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->setVector(rwMatrices.nullspace);
|
||||
parameterWrapper->setVector(rwMatrices.nullspaceVector);
|
||||
break;
|
||||
default:
|
||||
return INVALID_IDENTIFIER_ID;
|
||||
@ -378,15 +381,18 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->set(idleModeControllerParameters.gainNullspace);
|
||||
break;
|
||||
case 0x5:
|
||||
parameterWrapper->setVector(idleModeControllerParameters.desatMomentumRef);
|
||||
parameterWrapper->set(idleModeControllerParameters.nullspaceSpeed);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->set(idleModeControllerParameters.deSatGainFactor);
|
||||
parameterWrapper->setVector(idleModeControllerParameters.desatMomentumRef);
|
||||
break;
|
||||
case 0x7:
|
||||
parameterWrapper->set(idleModeControllerParameters.desatOn);
|
||||
parameterWrapper->set(idleModeControllerParameters.deSatGainFactor);
|
||||
break;
|
||||
case 0x8:
|
||||
parameterWrapper->set(idleModeControllerParameters.desatOn);
|
||||
break;
|
||||
case 0x9:
|
||||
parameterWrapper->set(idleModeControllerParameters.enableAntiStiction);
|
||||
break;
|
||||
default:
|
||||
@ -411,48 +417,51 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->set(targetModeControllerParameters.gainNullspace);
|
||||
break;
|
||||
case 0x5:
|
||||
parameterWrapper->setVector(targetModeControllerParameters.desatMomentumRef);
|
||||
parameterWrapper->set(targetModeControllerParameters.nullspaceSpeed);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->set(targetModeControllerParameters.deSatGainFactor);
|
||||
parameterWrapper->setVector(targetModeControllerParameters.desatMomentumRef);
|
||||
break;
|
||||
case 0x7:
|
||||
parameterWrapper->set(targetModeControllerParameters.desatOn);
|
||||
parameterWrapper->set(targetModeControllerParameters.deSatGainFactor);
|
||||
break;
|
||||
case 0x8:
|
||||
parameterWrapper->set(targetModeControllerParameters.enableAntiStiction);
|
||||
parameterWrapper->set(targetModeControllerParameters.desatOn);
|
||||
break;
|
||||
case 0x9:
|
||||
parameterWrapper->setVector(targetModeControllerParameters.refDirection);
|
||||
parameterWrapper->set(targetModeControllerParameters.enableAntiStiction);
|
||||
break;
|
||||
case 0xA:
|
||||
parameterWrapper->setVector(targetModeControllerParameters.refRotRate);
|
||||
parameterWrapper->setVector(targetModeControllerParameters.refDirection);
|
||||
break;
|
||||
case 0xB:
|
||||
parameterWrapper->setVector(targetModeControllerParameters.quatRef);
|
||||
parameterWrapper->setVector(targetModeControllerParameters.refRotRate);
|
||||
break;
|
||||
case 0xC:
|
||||
parameterWrapper->set(targetModeControllerParameters.timeElapsedMax);
|
||||
parameterWrapper->setVector(targetModeControllerParameters.quatRef);
|
||||
break;
|
||||
case 0xD:
|
||||
parameterWrapper->set(targetModeControllerParameters.latitudeTgt);
|
||||
parameterWrapper->set(targetModeControllerParameters.timeElapsedMax);
|
||||
break;
|
||||
case 0xE:
|
||||
parameterWrapper->set(targetModeControllerParameters.longitudeTgt);
|
||||
parameterWrapper->set(targetModeControllerParameters.latitudeTgt);
|
||||
break;
|
||||
case 0xF:
|
||||
parameterWrapper->set(targetModeControllerParameters.altitudeTgt);
|
||||
parameterWrapper->set(targetModeControllerParameters.longitudeTgt);
|
||||
break;
|
||||
case 0x10:
|
||||
parameterWrapper->set(targetModeControllerParameters.avoidBlindStr);
|
||||
parameterWrapper->set(targetModeControllerParameters.altitudeTgt);
|
||||
break;
|
||||
case 0x11:
|
||||
parameterWrapper->set(targetModeControllerParameters.blindAvoidStart);
|
||||
parameterWrapper->set(targetModeControllerParameters.avoidBlindStr);
|
||||
break;
|
||||
case 0x12:
|
||||
parameterWrapper->set(targetModeControllerParameters.blindAvoidStop);
|
||||
parameterWrapper->set(targetModeControllerParameters.blindAvoidStart);
|
||||
break;
|
||||
case 0x13:
|
||||
parameterWrapper->set(targetModeControllerParameters.blindAvoidStop);
|
||||
break;
|
||||
case 0x14:
|
||||
parameterWrapper->set(targetModeControllerParameters.blindRotRate);
|
||||
break;
|
||||
default:
|
||||
@ -477,30 +486,33 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.gainNullspace);
|
||||
break;
|
||||
case 0x5:
|
||||
parameterWrapper->setVector(gsTargetModeControllerParameters.desatMomentumRef);
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.nullspaceSpeed);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.deSatGainFactor);
|
||||
parameterWrapper->setVector(gsTargetModeControllerParameters.desatMomentumRef);
|
||||
break;
|
||||
case 0x7:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.desatOn);
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.deSatGainFactor);
|
||||
break;
|
||||
case 0x8:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.enableAntiStiction);
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.desatOn);
|
||||
break;
|
||||
case 0x9:
|
||||
parameterWrapper->setVector(gsTargetModeControllerParameters.refDirection);
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.enableAntiStiction);
|
||||
break;
|
||||
case 0xA:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.timeElapsedMax);
|
||||
parameterWrapper->setVector(gsTargetModeControllerParameters.refDirection);
|
||||
break;
|
||||
case 0xB:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.latitudeTgt);
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.timeElapsedMax);
|
||||
break;
|
||||
case 0xC:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.longitudeTgt);
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.latitudeTgt);
|
||||
break;
|
||||
case 0xD:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.longitudeTgt);
|
||||
break;
|
||||
case 0xE:
|
||||
parameterWrapper->set(gsTargetModeControllerParameters.altitudeTgt);
|
||||
break;
|
||||
default:
|
||||
@ -525,27 +537,30 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->set(nadirModeControllerParameters.gainNullspace);
|
||||
break;
|
||||
case 0x5:
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.desatMomentumRef);
|
||||
parameterWrapper->set(nadirModeControllerParameters.nullspaceSpeed);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->set(nadirModeControllerParameters.deSatGainFactor);
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.desatMomentumRef);
|
||||
break;
|
||||
case 0x7:
|
||||
parameterWrapper->set(nadirModeControllerParameters.desatOn);
|
||||
parameterWrapper->set(nadirModeControllerParameters.deSatGainFactor);
|
||||
break;
|
||||
case 0x8:
|
||||
parameterWrapper->set(nadirModeControllerParameters.enableAntiStiction);
|
||||
parameterWrapper->set(nadirModeControllerParameters.desatOn);
|
||||
break;
|
||||
case 0x9:
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.refDirection);
|
||||
parameterWrapper->set(nadirModeControllerParameters.enableAntiStiction);
|
||||
break;
|
||||
case 0xA:
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.quatRef);
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.refDirection);
|
||||
break;
|
||||
case 0xB:
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.refRotRate);
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.quatRef);
|
||||
break;
|
||||
case 0xC:
|
||||
parameterWrapper->setVector(nadirModeControllerParameters.refRotRate);
|
||||
break;
|
||||
case 0xD:
|
||||
parameterWrapper->set(nadirModeControllerParameters.timeElapsedMax);
|
||||
break;
|
||||
default:
|
||||
@ -570,21 +585,24 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->set(inertialModeControllerParameters.gainNullspace);
|
||||
break;
|
||||
case 0x5:
|
||||
parameterWrapper->setVector(inertialModeControllerParameters.desatMomentumRef);
|
||||
parameterWrapper->set(inertialModeControllerParameters.nullspaceSpeed);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->set(inertialModeControllerParameters.deSatGainFactor);
|
||||
parameterWrapper->setVector(inertialModeControllerParameters.desatMomentumRef);
|
||||
break;
|
||||
case 0x7:
|
||||
parameterWrapper->set(inertialModeControllerParameters.desatOn);
|
||||
parameterWrapper->set(inertialModeControllerParameters.deSatGainFactor);
|
||||
break;
|
||||
case 0x8:
|
||||
parameterWrapper->set(inertialModeControllerParameters.enableAntiStiction);
|
||||
parameterWrapper->set(inertialModeControllerParameters.desatOn);
|
||||
break;
|
||||
case 0x9:
|
||||
parameterWrapper->setVector(inertialModeControllerParameters.tgtQuat);
|
||||
parameterWrapper->set(inertialModeControllerParameters.enableAntiStiction);
|
||||
break;
|
||||
case 0xA:
|
||||
parameterWrapper->setVector(inertialModeControllerParameters.tgtQuat);
|
||||
break;
|
||||
case 0xB:
|
||||
parameterWrapper->setVector(inertialModeControllerParameters.refRotRate);
|
||||
break;
|
||||
case 0xC:
|
||||
@ -696,7 +714,7 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
parameterWrapper->setMatrix(magnetorquerParameter.inverseAlignment);
|
||||
break;
|
||||
case 0x5:
|
||||
parameterWrapper->set(magnetorquerParameter.dipolMax);
|
||||
parameterWrapper->set(magnetorquerParameter.dipoleMax);
|
||||
break;
|
||||
case 0x6:
|
||||
parameterWrapper->set(magnetorquerParameter.torqueDuration);
|
||||
|
@ -766,6 +766,7 @@ class AcsParameters : public HasParametersIF {
|
||||
{116.975421945286, -5.53022680362263, -5.61081660666997, 0.109754904982136,
|
||||
0.167666815691513, 0.163137400730063, -0.000609874123906977, -0.00205336098697513,
|
||||
-0.000889232196185857, -0.00168429567131815}};
|
||||
float susBrightnessThreshold = 0.7;
|
||||
} susHandlingParameters;
|
||||
|
||||
struct GyrHandlingParameters {
|
||||
@ -781,9 +782,9 @@ class AcsParameters : public HasParametersIF {
|
||||
|
||||
/* var = sigma^2, sigma = RND*sqrt(freq), following values are RND^2 and not var as freq is
|
||||
* assumed to be equal for the same class of sensors */
|
||||
float gyr02variance[3] = {pow(3.0e-3, 2), // RND_x = 3.0e-3 deg/s/sqrt(Hz) rms
|
||||
pow(3.0e-3, 2), // RND_y = 3.0e-3 deg/s/sqrt(Hz) rms
|
||||
pow(4.3e-3, 2)}; // RND_z = 4.3e-3 deg/s/sqrt(Hz) rms
|
||||
float gyr02variance[3] = {pow(4.6e-3, 2), // RND_x = 3.0e-3 deg/s/sqrt(Hz) rms
|
||||
pow(4.6e-3, 2), // RND_y = 3.0e-3 deg/s/sqrt(Hz) rms
|
||||
pow(6.1e-3, 2)}; // RND_z = 4.3e-3 deg/s/sqrt(Hz) rms
|
||||
float gyr13variance[3] = {pow(11e-3, 2), pow(11e-3, 2), pow(11e-3, 2)};
|
||||
uint8_t preferAdis = false;
|
||||
float gyrFilterWeight = 0.6;
|
||||
@ -816,7 +817,7 @@ class AcsParameters : public HasParametersIF {
|
||||
{1.0864, 0, 0}, {-0.5432, -0.5432, 1.2797}, {0, 0, 0}, {-0.5432, 0.5432, 1.2797}};
|
||||
double without4[4][3] = {
|
||||
{0.5432, 0.5432, 1.2797}, {0, -1.0864, 0}, {-0.5432, 0.5432, 1.2797}, {0, 0, 0}};
|
||||
double nullspace[4] = {-0.5000, 0.5000, -0.5000, 0.5000};
|
||||
double nullspaceVector[4] = {-1, 1, -1, 1};
|
||||
} rwMatrices;
|
||||
|
||||
struct SafeModeControllerParameters {
|
||||
@ -840,7 +841,9 @@ class AcsParameters : public HasParametersIF {
|
||||
double om = 0.3;
|
||||
double omMax = 1 * M_PI / 180;
|
||||
double qiMin = 0.1;
|
||||
|
||||
double gainNullspace = 0.01;
|
||||
double nullspaceSpeed = 32500; // 0.1 RPM
|
||||
|
||||
double desatMomentumRef[3] = {0, 0, 0};
|
||||
double deSatGainFactor = 1000;
|
||||
@ -933,7 +936,7 @@ class AcsParameters : public HasParametersIF {
|
||||
double mtq2orientationMatrix[3][3] = {{0, 0, 1}, {0, 1, 0}, {-1, 0, 0}};
|
||||
double alignmentMatrixMtq[3][3] = {{0, 0, -1}, {-1, 0, 0}, {0, 1, 0}};
|
||||
double inverseAlignment[3][3] = {{0, -1, 0}, {0, 0, 1}, {-1, 0, 0}};
|
||||
double dipolMax = 0.2; // [Am^2]
|
||||
double dipoleMax = 0.2; // [Am^2]
|
||||
|
||||
uint16_t torqueDuration = 300; // [ms]
|
||||
} magnetorquerParameter;
|
||||
|
@ -5,11 +5,6 @@
|
||||
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "util/CholeskyDecomposition.h"
|
||||
#include "util/MathOperations.h"
|
||||
|
||||
ActuatorCmd::ActuatorCmd() {}
|
||||
|
||||
ActuatorCmd::~ActuatorCmd() {}
|
||||
@ -25,24 +20,30 @@ void ActuatorCmd::scalingTorqueRws(double *rwTrq, double maxTorque) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActuatorCmd::cmdSpeedToRws(int32_t speedRw0, int32_t speedRw1, int32_t speedRw2,
|
||||
int32_t speedRw3, const double *rwTorque, int32_t *rwCmdSpeed,
|
||||
double sampleTime, int32_t maxRwSpeed, double inertiaWheel) {
|
||||
using namespace Math;
|
||||
|
||||
// Calculating the commanded speed in RPM for every reaction wheel
|
||||
void ActuatorCmd::cmdSpeedToRws(const int32_t speedRw0, const int32_t speedRw1,
|
||||
const int32_t speedRw2, const int32_t speedRw3,
|
||||
const double sampleTime, const double inertiaWheel,
|
||||
const int32_t maxRwSpeed, const double *rwTorque,
|
||||
int32_t *rwCmdSpeed) {
|
||||
// group RW speed values (in 0.1 [RPM]) in vector
|
||||
int32_t speedRws[4] = {speedRw0, speedRw1, speedRw2, speedRw3};
|
||||
|
||||
// calculate required RW speed as sum of current RW speed and RW speed delta
|
||||
// delta w_rw = delta t / I_RW * torque_RW [rad/s]
|
||||
double deltaSpeed[4] = {0, 0, 0, 0};
|
||||
double radToRpm = 60 / (2 * PI); // factor for conversion to RPM
|
||||
// W_RW = Torque_RW / I_RW * delta t [rad/s]
|
||||
double factor = sampleTime / inertiaWheel * radToRpm;
|
||||
int32_t deltaSpeedInt[4] = {0, 0, 0, 0};
|
||||
const double factor = sampleTime / inertiaWheel * RAD_PER_SEC_TO_RPM * 10;
|
||||
VectorOperations<double>::mulScalar(rwTorque, factor, deltaSpeed, 4);
|
||||
|
||||
// convert double to int32
|
||||
int32_t deltaSpeedInt[4] = {0, 0, 0, 0};
|
||||
for (int i = 0; i < 4; i++) {
|
||||
deltaSpeedInt[i] = std::round(deltaSpeed[i]);
|
||||
}
|
||||
|
||||
// sum of current RW speed and RW speed delta
|
||||
VectorOperations<int32_t>::add(speedRws, deltaSpeedInt, rwCmdSpeed, 4);
|
||||
VectorOperations<int32_t>::mulScalar(rwCmdSpeed, 10, rwCmdSpeed, 4);
|
||||
|
||||
// crop values which would exceed the maximum possible RPM
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
if (rwCmdSpeed[i] > maxRwSpeed) {
|
||||
rwCmdSpeed[i] = maxRwSpeed;
|
||||
@ -52,24 +53,25 @@ void ActuatorCmd::cmdSpeedToRws(int32_t speedRw0, int32_t speedRw1, int32_t spee
|
||||
}
|
||||
}
|
||||
|
||||
void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentActuator,
|
||||
const double *inverseAlignment, double maxDipol) {
|
||||
// Convert to actuator frame
|
||||
double dipolMomentActuatorDouble[3] = {0, 0, 0};
|
||||
MatrixOperations<double>::multiply(inverseAlignment, dipolMoment, dipolMomentActuatorDouble, 3, 3,
|
||||
1);
|
||||
// Scaling along largest element if dipol exceeds maximum
|
||||
void ActuatorCmd::cmdDipoleMtq(const double *inverseAlignment, const double maxDipole,
|
||||
const double *dipoleMoment, int16_t *dipoleMomentActuator) {
|
||||
// convert to actuator frame
|
||||
double dipoleMomentActuatorDouble[3] = {0, 0, 0};
|
||||
MatrixOperations<double>::multiply(inverseAlignment, dipoleMoment, dipoleMomentActuatorDouble, 3,
|
||||
3, 1);
|
||||
// scaling along largest element if dipole exceeds maximum
|
||||
uint8_t maxIdx = 0;
|
||||
VectorOperations<double>::maxAbsValue(dipolMomentActuatorDouble, 3, &maxIdx);
|
||||
double maxAbsValue = std::abs(dipolMomentActuatorDouble[maxIdx]);
|
||||
if (maxAbsValue > maxDipol) {
|
||||
double scalingFactor = maxDipol / maxAbsValue;
|
||||
VectorOperations<double>::mulScalar(dipolMomentActuatorDouble, scalingFactor,
|
||||
dipolMomentActuatorDouble, 3);
|
||||
VectorOperations<double>::maxAbsValue(dipoleMomentActuatorDouble, 3, &maxIdx);
|
||||
double maxAbsValue = std::abs(dipoleMomentActuatorDouble[maxIdx]);
|
||||
if (maxAbsValue > maxDipole) {
|
||||
double scalingFactor = maxDipole / maxAbsValue;
|
||||
VectorOperations<double>::mulScalar(dipoleMomentActuatorDouble, scalingFactor,
|
||||
dipoleMomentActuatorDouble, 3);
|
||||
}
|
||||
// scale dipole from 1 Am^2 to 1e^-4 Am^2
|
||||
VectorOperations<double>::mulScalar(dipolMomentActuatorDouble, 1e4, dipolMomentActuatorDouble, 3);
|
||||
VectorOperations<double>::mulScalar(dipoleMomentActuatorDouble, 1e4, dipoleMomentActuatorDouble,
|
||||
3);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
dipolMomentActuator[i] = std::round(dipolMomentActuatorDouble[i]);
|
||||
dipoleMomentActuator[i] = std::round(dipoleMomentActuatorDouble[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
#ifndef ACTUATORCMD_H_
|
||||
#define ACTUATORCMD_H_
|
||||
|
||||
#include "MultiplicativeKalmanFilter.h"
|
||||
#include "SensorProcessing.h"
|
||||
#include "SensorValues.h"
|
||||
#include <cmath>
|
||||
|
||||
class ActuatorCmd {
|
||||
public:
|
||||
@ -19,29 +17,30 @@ class ActuatorCmd {
|
||||
void scalingTorqueRws(double *rwTrq, double maxTorque);
|
||||
|
||||
/*
|
||||
* @brief: cmdSpeedToRws() will set the maximum possible torque for the reaction
|
||||
* wheels, also will calculate the needed revolutions per minute for the RWs, which will be given
|
||||
* as Input to the RWs
|
||||
* @param: rwTrqIn given torque from pointing controller
|
||||
* rwTrqNS Nullspace torque
|
||||
* @brief: cmdSpeedToRws() Calculates the RPM for the reaction wheel configuration,
|
||||
* given the required torque calculated by the controller. Will also scale down the RPM of the
|
||||
* wheels if they exceed the maximum possible RPM
|
||||
* @param: rwTrq given torque from pointing controller
|
||||
* rwCmdSpeed output revolutions per minute for every
|
||||
* reaction wheel
|
||||
*/
|
||||
void cmdSpeedToRws(int32_t speedRw0, int32_t speedRw1, int32_t speedRw2, int32_t speedRw3,
|
||||
const double *rwTorque, int32_t *rwCmdSpeed, double sampleTime,
|
||||
int32_t maxRwSpeed, double inertiaWheel);
|
||||
void cmdSpeedToRws(const int32_t speedRw0, const int32_t speedRw1, const int32_t speedRw2,
|
||||
const int32_t speedRw3, const double sampleTime, const double inertiaWheel,
|
||||
const int32_t maxRwSpeed, const double *rwTorque, int32_t *rwCmdSpeed);
|
||||
|
||||
/*
|
||||
* @brief: cmdDipolMtq() gives the commanded dipol moment for the magnetorques
|
||||
* @brief: cmdDipoleMtq() gives the commanded dipole moment for the
|
||||
* magnetorquer
|
||||
*
|
||||
* @param: dipolMoment given dipol moment in spacecraft frame
|
||||
* dipolMomentActuator resulting dipol moment in actuator reference frame
|
||||
* @param: dipoleMoment given dipole moment in spacecraft frame
|
||||
* dipoleMomentActuator resulting dipole moment in actuator reference frame
|
||||
*/
|
||||
void cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentActuator,
|
||||
const double *inverseAlignment, double maxDipol);
|
||||
void cmdDipoleMtq(const double *inverseAlignment, const double maxDipole,
|
||||
const double *dipoleMoment, int16_t *dipoleMomentActuator);
|
||||
|
||||
protected:
|
||||
private:
|
||||
static constexpr double RAD_PER_SEC_TO_RPM = 60 / (2 * M_PI);
|
||||
};
|
||||
|
||||
#endif /* ACTUATORCMD_H_ */
|
||||
|
@ -266,7 +266,8 @@ void Guidance::targetQuatPtgGs(timeval now, double posSatE[3], double sunDirI[3]
|
||||
targetRotationRate(timeElapsedMax, now, targetQuat, targetSatRotRate);
|
||||
}
|
||||
|
||||
void Guidance::targetQuatPtgSun(double sunDirI[3], double targetQuat[4], double refSatRate[3]) {
|
||||
void Guidance::targetQuatPtgSun(timeval now, double sunDirI[3], double targetQuat[4],
|
||||
double targetSatRotRate[3]) {
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Calculation of target quaternion to sun
|
||||
//-------------------------------------------------------------------------------------
|
||||
@ -296,9 +297,8 @@ void Guidance::targetQuatPtgSun(double sunDirI[3], double targetQuat[4], double
|
||||
//----------------------------------------------------------------------------
|
||||
// Calculation of reference rotation rate
|
||||
//----------------------------------------------------------------------------
|
||||
refSatRate[0] = 0;
|
||||
refSatRate[1] = 0;
|
||||
refSatRate[2] = 0;
|
||||
int8_t timeElapsedMax = acsParameters->gsTargetModeControllerParameters.timeElapsedMax;
|
||||
targetRotationRate(timeElapsedMax, now, targetQuat, targetSatRotRate);
|
||||
}
|
||||
|
||||
void Guidance::targetQuatPtgNadirSingleAxis(timeval now, double posSatE[3], double quatBI[4],
|
||||
@ -412,7 +412,7 @@ void Guidance::targetQuatPtgNadirThreeAxes(timeval now, double posSatE[3], doubl
|
||||
|
||||
void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
||||
double targetSatRotRate[3], double refQuat[4], double refSatRotRate[3],
|
||||
double errorQuat[4], double errorSatRotRate[3], double errorAngle) {
|
||||
double errorQuat[4], double errorSatRotRate[3], double &errorAngle) {
|
||||
// First calculate error quaternion between current and target orientation
|
||||
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuat);
|
||||
// Last calculate add rotation from reference quaternion
|
||||
@ -424,26 +424,17 @@ void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], do
|
||||
// Calculate error angle
|
||||
errorAngle = QuaternionOperations::getAngle(errorQuat, true);
|
||||
|
||||
// Only give back error satellite rotational rate if orientation has already been aquired
|
||||
if (errorAngle < 2. / 180. * M_PI) {
|
||||
// Calculate error satellite rotational rate
|
||||
// First combine the target and reference satellite rotational rates
|
||||
double combinedRefSatRotRate[3] = {0, 0, 0};
|
||||
VectorOperations<double>::add(targetSatRotRate, refSatRotRate, combinedRefSatRotRate, 3);
|
||||
// Then substract the combined required satellite rotational rates from the actual rate
|
||||
VectorOperations<double>::subtract(currentSatRotRate, combinedRefSatRotRate, errorSatRotRate,
|
||||
3);
|
||||
} else {
|
||||
// If orientation has not been aquired yet set satellite rotational rate to zero
|
||||
errorSatRotRate = 0;
|
||||
}
|
||||
|
||||
// target flag in matlab, importance, does look like it only gives feedback if pointing control is
|
||||
// under 150 arcsec ??
|
||||
// Then subtract the combined required satellite rotational rates from the actual rate
|
||||
VectorOperations<double>::subtract(currentSatRotRate, combinedRefSatRotRate, errorSatRotRate, 3);
|
||||
}
|
||||
|
||||
void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
||||
double targetSatRotRate[3], double errorQuat[4],
|
||||
double errorSatRotRate[3], double errorAngle) {
|
||||
double errorSatRotRate[3], double &errorAngle) {
|
||||
// First calculate error quaternion between current and target orientation
|
||||
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuat);
|
||||
// Keep scalar part of quaternion positive
|
||||
@ -453,17 +444,8 @@ void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], do
|
||||
// Calculate error angle
|
||||
errorAngle = QuaternionOperations::getAngle(errorQuat, true);
|
||||
|
||||
// Only give back error satellite rotational rate if orientation has already been aquired
|
||||
if (errorAngle < 2. / 180. * M_PI) {
|
||||
// Then substract the combined required satellite rotational rates from the actual rate
|
||||
// Calculate error satellite rotational rate
|
||||
VectorOperations<double>::subtract(currentSatRotRate, targetSatRotRate, errorSatRotRate, 3);
|
||||
} else {
|
||||
// If orientation has not been aquired yet set satellite rotational rate to zero
|
||||
errorSatRotRate = 0;
|
||||
}
|
||||
|
||||
// target flag in matlab, importance, does look like it only gives feedback if pointing control is
|
||||
// under 150 arcsec ??
|
||||
}
|
||||
|
||||
void Guidance::targetRotationRate(int8_t timeElapsedMax, timeval now, double quatInertialTarget[4],
|
||||
@ -471,20 +453,25 @@ void Guidance::targetRotationRate(int8_t timeElapsedMax, timeval now, double qua
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Calculation of target rotation rate
|
||||
//-------------------------------------------------------------------------------------
|
||||
double timeElapsed = now.tv_sec + now.tv_usec * pow(10, -6) -
|
||||
(timeSavedQuaternion.tv_sec +
|
||||
timeSavedQuaternion.tv_usec * pow((double)timeSavedQuaternion.tv_usec, -6));
|
||||
double timeElapsed = now.tv_sec + now.tv_usec * 1e-6 -
|
||||
(timeSavedQuaternion.tv_sec + timeSavedQuaternion.tv_usec * 1e-6);
|
||||
if (VectorOperations<double>::norm(savedQuaternion, 4) == 0) {
|
||||
std::memcpy(savedQuaternion, quatInertialTarget, sizeof(savedQuaternion));
|
||||
}
|
||||
if (timeElapsed < timeElapsedMax) {
|
||||
double q[4] = {0, 0, 0, 0}, qS[4] = {0, 0, 0, 0};
|
||||
QuaternionOperations::inverse(quatInertialTarget, q);
|
||||
QuaternionOperations::inverse(savedQuaternion, qS);
|
||||
double qDiff[4] = {0, 0, 0, 0};
|
||||
VectorOperations<double>::subtract(quatInertialTarget, savedQuaternion, qDiff, 4);
|
||||
VectorOperations<double>::subtract(q, qS, qDiff, 4);
|
||||
VectorOperations<double>::mulScalar(qDiff, 1 / timeElapsed, qDiff, 4);
|
||||
|
||||
double tgtQuatVec[3] = {quatInertialTarget[0], quatInertialTarget[1], quatInertialTarget[2]},
|
||||
qDiffVec[3] = {qDiff[0], qDiff[1], qDiff[2]};
|
||||
double tgtQuatVec[3] = {q[0], q[1], q[2]};
|
||||
double qDiffVec[3] = {qDiff[0], qDiff[1], qDiff[2]};
|
||||
double sum1[3] = {0, 0, 0}, sum2[3] = {0, 0, 0}, sum3[3] = {0, 0, 0}, sum[3] = {0, 0, 0};
|
||||
VectorOperations<double>::cross(quatInertialTarget, qDiff, sum1);
|
||||
VectorOperations<double>::cross(tgtQuatVec, qDiffVec, sum1);
|
||||
VectorOperations<double>::mulScalar(tgtQuatVec, qDiff[3], sum2, 3);
|
||||
VectorOperations<double>::mulScalar(qDiffVec, quatInertialTarget[3], sum3, 3);
|
||||
VectorOperations<double>::mulScalar(qDiffVec, q[3], sum3, 3);
|
||||
VectorOperations<double>::add(sum1, sum2, sum, 3);
|
||||
VectorOperations<double>::subtract(sum, sum3, sum, 3);
|
||||
double omegaRefNew[3] = {0, 0, 0};
|
||||
@ -531,10 +518,6 @@ ReturnValue_t Guidance::getDistributionMatrixRw(ACS::SensorValues *sensorValues,
|
||||
std::memcpy(rwPseudoInv, acsParameters->rwMatrices.without4, 12 * sizeof(double));
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
// @note: This one takes the normal pseudoInverse of all four raction wheels valid.
|
||||
// Does not make sense, but is implemented that way in MATLAB ?!
|
||||
// Thought: It does not really play a role, because in case there are more then one
|
||||
// reaction wheel invalid the pointing control is destined to fail.
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class Guidance {
|
||||
void getTargetParamsSafe(double sunTargetSafe[3]);
|
||||
ReturnValue_t solarArrayDeploymentComplete();
|
||||
|
||||
// Function to get the target quaternion and refence rotation rate from gps position and
|
||||
// Function to get the target quaternion and reference rotation rate from gps position and
|
||||
// position of the ground station
|
||||
void targetQuatPtgSingleAxis(timeval now, double posSatE[3], double velSatE[3], double sunDirI[3],
|
||||
double refDirB[3], double quatBI[4], double targetQuat[4],
|
||||
@ -25,9 +25,10 @@ class Guidance {
|
||||
void targetQuatPtgGs(timeval now, double posSatE[3], double sunDirI[3], double quatIX[4],
|
||||
double targetSatRotRate[3]);
|
||||
|
||||
// Function to get the target quaternion and refence rotation rate for sun pointing after ground
|
||||
// Function to get the target quaternion and reference rotation rate for sun pointing after ground
|
||||
// station
|
||||
void targetQuatPtgSun(double sunDirI[3], double targetQuat[4], double refSatRate[3]);
|
||||
void targetQuatPtgSun(timeval now, double sunDirI[3], double targetQuat[4],
|
||||
double targetSatRotRate[3]);
|
||||
|
||||
// Function to get the target quaternion and refence rotation rate from gps position for Nadir
|
||||
// pointing
|
||||
@ -42,10 +43,10 @@ class Guidance {
|
||||
// rate. Lastly gives back the error angle of the error quaternion.
|
||||
void comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
||||
double targetSatRotRate[3], double refQuat[4], double refSatRotRate[3],
|
||||
double errorQuat[4], double errorSatRotRate[3], double errorAngle);
|
||||
double errorQuat[4], double errorSatRotRate[3], double &errorAngle);
|
||||
void comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
||||
double targetSatRotRate[3], double errorQuat[4], double errorSatRotRate[3],
|
||||
double errorAngle);
|
||||
double &errorAngle);
|
||||
|
||||
void targetRotationRate(int8_t timeElapsedMax, timeval now, double quatInertialTarget[4],
|
||||
double *targetSatRotRate);
|
||||
|
@ -30,10 +30,7 @@ void SensorProcessing::processMgm(const float *mgm0Value, bool mgm0valid, const
|
||||
// ------------------------------------------------
|
||||
double magIgrfModel[3] = {0.0, 0.0, 0.0};
|
||||
if (gpsValid) {
|
||||
// Should be existing class object which will be called and modified here.
|
||||
Igrf13Model igrf13;
|
||||
// So the line above should not be done here. Update: Can be done here as long updated coffs
|
||||
// stored in acsParameters ?
|
||||
igrf13.schmidtNormalization();
|
||||
igrf13.updateCoeffGH(timeOfMgmMeasurement);
|
||||
// maybe put a condition here, to only update after a full day, this
|
||||
@ -45,14 +42,13 @@ void SensorProcessing::processMgm(const float *mgm0Value, bool mgm0valid, const
|
||||
{
|
||||
PoolReadGuard pg(mgmDataProcessed);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
float zeroVec[3] = {0.0, 0.0, 0.0};
|
||||
std::memcpy(mgmDataProcessed->mgm0vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm1vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm2vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm3vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm4vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgmVecTot.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgmVecTotDerivative.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm0vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm1vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm2vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm3vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgm4vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(mgmDataProcessed->mgmVecTot.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
std::memcpy(mgmDataProcessed->mgmVecTotDerivative.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
mgmDataProcessed->setValidity(false, true);
|
||||
std::memcpy(mgmDataProcessed->magIgrfModel.value, magIgrfModel, 3 * sizeof(double));
|
||||
mgmDataProcessed->magIgrfModel.setValid(gpsValid);
|
||||
@ -210,63 +206,68 @@ void SensorProcessing::processSus(
|
||||
sunIjkModel[0] = cos(eclipticLongitude);
|
||||
sunIjkModel[1] = sin(eclipticLongitude) * cos(epsilon);
|
||||
sunIjkModel[2] = sin(eclipticLongitude) * sin(epsilon);
|
||||
|
||||
uint64_t susBrightness[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
if (sus0valid) {
|
||||
sus0valid = susConverter.checkSunSensorData(sus0Value);
|
||||
susBrightness[0] = susConverter.checkSunSensorData(sus0Value);
|
||||
}
|
||||
if (sus1valid) {
|
||||
sus1valid = susConverter.checkSunSensorData(sus1Value);
|
||||
susBrightness[1] = susConverter.checkSunSensorData(sus1Value);
|
||||
}
|
||||
if (sus2valid) {
|
||||
sus2valid = susConverter.checkSunSensorData(sus2Value);
|
||||
susBrightness[2] = susConverter.checkSunSensorData(sus2Value);
|
||||
}
|
||||
if (sus3valid) {
|
||||
sus3valid = susConverter.checkSunSensorData(sus3Value);
|
||||
susBrightness[3] = susConverter.checkSunSensorData(sus3Value);
|
||||
}
|
||||
if (sus4valid) {
|
||||
sus4valid = susConverter.checkSunSensorData(sus4Value);
|
||||
susBrightness[4] = susConverter.checkSunSensorData(sus4Value);
|
||||
}
|
||||
if (sus5valid) {
|
||||
sus5valid = susConverter.checkSunSensorData(sus5Value);
|
||||
susBrightness[5] = susConverter.checkSunSensorData(sus5Value);
|
||||
}
|
||||
if (sus6valid) {
|
||||
sus6valid = susConverter.checkSunSensorData(sus6Value);
|
||||
susBrightness[6] = susConverter.checkSunSensorData(sus6Value);
|
||||
}
|
||||
if (sus7valid) {
|
||||
sus7valid = susConverter.checkSunSensorData(sus7Value);
|
||||
susBrightness[7] = susConverter.checkSunSensorData(sus7Value);
|
||||
}
|
||||
if (sus8valid) {
|
||||
sus8valid = susConverter.checkSunSensorData(sus8Value);
|
||||
susBrightness[8] = susConverter.checkSunSensorData(sus8Value);
|
||||
}
|
||||
if (sus9valid) {
|
||||
sus9valid = susConverter.checkSunSensorData(sus9Value);
|
||||
susBrightness[9] = susConverter.checkSunSensorData(sus9Value);
|
||||
}
|
||||
if (sus10valid) {
|
||||
sus10valid = susConverter.checkSunSensorData(sus10Value);
|
||||
susBrightness[10] = susConverter.checkSunSensorData(sus10Value);
|
||||
}
|
||||
if (sus11valid) {
|
||||
sus11valid = susConverter.checkSunSensorData(sus11Value);
|
||||
susBrightness[11] = susConverter.checkSunSensorData(sus11Value);
|
||||
}
|
||||
|
||||
if (!sus0valid && !sus1valid && !sus2valid && !sus3valid && !sus4valid && !sus5valid &&
|
||||
!sus6valid && !sus7valid && !sus8valid && !sus9valid && !sus10valid && !sus11valid) {
|
||||
bool susValid[12] = {sus0valid, sus1valid, sus2valid, sus3valid, sus4valid, sus5valid,
|
||||
sus6valid, sus7valid, sus8valid, sus9valid, sus10valid, sus11valid};
|
||||
bool allInvalid =
|
||||
susConverter.checkValidity(susValid, susBrightness, susParameters->susBrightnessThreshold);
|
||||
|
||||
if (allInvalid) {
|
||||
{
|
||||
PoolReadGuard pg(susDataProcessed);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
float zeroVec[3] = {0.0, 0.0, 0.0};
|
||||
std::memcpy(susDataProcessed->sus0vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus1vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus2vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus3vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus4vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus5vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus6vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus7vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus8vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus9vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus10vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus11vec.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->susVecTot.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->susVecTotDerivative.value, zeroVec, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus0vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus1vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus2vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus3vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus4vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus5vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus6vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus7vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus8vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus9vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus10vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus11vec.value, ZERO_VEC_F, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->susVecTot.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
std::memcpy(susDataProcessed->susVecTotDerivative.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
susDataProcessed->setValidity(false, true);
|
||||
std::memcpy(susDataProcessed->sunIjkModel.value, sunIjkModel, 3 * sizeof(double));
|
||||
susDataProcessed->sunIjkModel.setValid(true);
|
||||
@ -274,118 +275,78 @@ void SensorProcessing::processSus(
|
||||
}
|
||||
return;
|
||||
}
|
||||
// WARNING: NOT TRANSFORMED IN BODY FRAME YET
|
||||
// Transformation into Geomtry Frame
|
||||
float sus0VecBody[3] = {0, 0, 0}, sus1VecBody[3] = {0, 0, 0}, sus2VecBody[3] = {0, 0, 0},
|
||||
sus3VecBody[3] = {0, 0, 0}, sus4VecBody[3] = {0, 0, 0}, sus5VecBody[3] = {0, 0, 0},
|
||||
sus6VecBody[3] = {0, 0, 0}, sus7VecBody[3] = {0, 0, 0}, sus8VecBody[3] = {0, 0, 0},
|
||||
sus9VecBody[3] = {0, 0, 0}, sus10VecBody[3] = {0, 0, 0}, sus11VecBody[3] = {0, 0, 0};
|
||||
|
||||
if (sus0valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus0orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus0Value, susParameters->sus0coeffAlpha,
|
||||
susParameters->sus0coeffBeta),
|
||||
sus0VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus1valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus1orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus1Value, susParameters->sus1coeffAlpha,
|
||||
susParameters->sus1coeffBeta),
|
||||
sus1VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus2valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus2orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus2Value, susParameters->sus2coeffAlpha,
|
||||
susParameters->sus2coeffBeta),
|
||||
sus2VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus3valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus3orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus3Value, susParameters->sus3coeffAlpha,
|
||||
susParameters->sus3coeffBeta),
|
||||
sus3VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus4valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus4orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus4Value, susParameters->sus4coeffAlpha,
|
||||
susParameters->sus4coeffBeta),
|
||||
sus4VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus5valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus5orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus5Value, susParameters->sus5coeffAlpha,
|
||||
susParameters->sus5coeffBeta),
|
||||
sus5VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus6valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus6orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus6Value, susParameters->sus6coeffAlpha,
|
||||
susParameters->sus6coeffBeta),
|
||||
sus6VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus7valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus7orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus7Value, susParameters->sus7coeffAlpha,
|
||||
susParameters->sus7coeffBeta),
|
||||
sus7VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus8valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus8orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus8Value, susParameters->sus8coeffAlpha,
|
||||
susParameters->sus8coeffBeta),
|
||||
sus8VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus9valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus9orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus9Value, susParameters->sus9coeffAlpha,
|
||||
susParameters->sus9coeffBeta),
|
||||
sus9VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus10valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus10orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus10Value, susParameters->sus10coeffAlpha,
|
||||
susParameters->sus10coeffBeta),
|
||||
sus10VecBody, 3, 3, 1);
|
||||
}
|
||||
if (sus11valid) {
|
||||
MatrixOperations<float>::multiply(
|
||||
susParameters->sus11orientationMatrix[0],
|
||||
susConverter.getSunVectorSensorFrame(sus11Value, susParameters->sus11coeffAlpha,
|
||||
susParameters->sus11coeffBeta),
|
||||
sus11VecBody, 3, 3, 1);
|
||||
}
|
||||
float susVecSensor[12][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
|
||||
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
||||
float susVecBody[12][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
|
||||
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
||||
|
||||
/* ------ Mean Value: susDirEst ------ */
|
||||
bool validIds[12] = {sus0valid, sus1valid, sus2valid, sus3valid, sus4valid, sus5valid,
|
||||
sus6valid, sus7valid, sus8valid, sus9valid, sus10valid, sus11valid};
|
||||
float susVecBody[3][12] = {{sus0VecBody[0], sus1VecBody[0], sus2VecBody[0], sus3VecBody[0],
|
||||
sus4VecBody[0], sus5VecBody[0], sus6VecBody[0], sus7VecBody[0],
|
||||
sus8VecBody[0], sus9VecBody[0], sus10VecBody[0], sus11VecBody[0]},
|
||||
{sus0VecBody[1], sus1VecBody[1], sus2VecBody[1], sus3VecBody[1],
|
||||
sus4VecBody[1], sus5VecBody[1], sus6VecBody[1], sus7VecBody[1],
|
||||
sus8VecBody[1], sus9VecBody[1], sus10VecBody[1], sus11VecBody[1]},
|
||||
{sus0VecBody[2], sus1VecBody[2], sus2VecBody[2], sus3VecBody[2],
|
||||
sus4VecBody[2], sus5VecBody[2], sus6VecBody[2], sus7VecBody[2],
|
||||
sus8VecBody[2], sus9VecBody[2], sus10VecBody[2], sus11VecBody[2]}};
|
||||
if (susValid[0]) {
|
||||
susConverter.calculateSunVector(susVecSensor[0], sus0Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus0orientationMatrix[0], susVecSensor[0],
|
||||
susVecBody[0], 3, 3, 1);
|
||||
}
|
||||
if (susValid[1]) {
|
||||
susConverter.calculateSunVector(susVecSensor[1], sus1Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus1orientationMatrix[0], susVecSensor[1],
|
||||
susVecBody[1], 3, 3, 1);
|
||||
}
|
||||
if (susValid[2]) {
|
||||
susConverter.calculateSunVector(susVecSensor[2], sus2Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus2orientationMatrix[0], susVecSensor[2],
|
||||
susVecBody[2], 3, 3, 1);
|
||||
}
|
||||
if (susValid[3]) {
|
||||
susConverter.calculateSunVector(susVecSensor[3], sus3Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus3orientationMatrix[0], susVecSensor[3],
|
||||
susVecBody[3], 3, 3, 1);
|
||||
}
|
||||
if (susValid[4]) {
|
||||
susConverter.calculateSunVector(susVecSensor[4], sus4Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus4orientationMatrix[0], susVecSensor[4],
|
||||
susVecBody[4], 3, 3, 1);
|
||||
}
|
||||
if (susValid[5]) {
|
||||
susConverter.calculateSunVector(susVecSensor[5], sus5Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus5orientationMatrix[0], susVecSensor[5],
|
||||
susVecBody[5], 3, 3, 1);
|
||||
}
|
||||
if (susValid[6]) {
|
||||
susConverter.calculateSunVector(susVecSensor[6], sus6Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus6orientationMatrix[0], susVecSensor[6],
|
||||
susVecBody[6], 3, 3, 1);
|
||||
}
|
||||
if (susValid[7]) {
|
||||
susConverter.calculateSunVector(susVecSensor[7], sus7Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus7orientationMatrix[0], susVecSensor[7],
|
||||
susVecBody[7], 3, 3, 1);
|
||||
}
|
||||
if (susValid[8]) {
|
||||
susConverter.calculateSunVector(susVecSensor[8], sus8Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus8orientationMatrix[0], susVecSensor[8],
|
||||
susVecBody[8], 3, 3, 1);
|
||||
}
|
||||
if (susValid[9]) {
|
||||
susConverter.calculateSunVector(susVecSensor[9], sus9Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus9orientationMatrix[0], susVecSensor[9],
|
||||
susVecBody[9], 3, 3, 1);
|
||||
}
|
||||
if (susValid[10]) {
|
||||
susConverter.calculateSunVector(susVecSensor[10], sus10Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus10orientationMatrix[0], susVecSensor[10],
|
||||
susVecBody[10], 3, 3, 1);
|
||||
}
|
||||
if (susValid[11]) {
|
||||
susConverter.calculateSunVector(susVecSensor[11], sus11Value);
|
||||
MatrixOperations<float>::multiply(susParameters->sus11orientationMatrix[0], susVecSensor[11],
|
||||
susVecBody[11], 3, 3, 1);
|
||||
}
|
||||
|
||||
double susMeanValue[3] = {0, 0, 0};
|
||||
for (uint8_t i = 0; i < 12; i++) {
|
||||
if (validIds[i]) {
|
||||
susMeanValue[0] += susVecBody[0][i];
|
||||
susMeanValue[1] += susVecBody[1][i];
|
||||
susMeanValue[2] += susVecBody[2][i];
|
||||
}
|
||||
susMeanValue[0] += susVecBody[i][0];
|
||||
susMeanValue[1] += susVecBody[i][1];
|
||||
susMeanValue[2] += susVecBody[i][2];
|
||||
}
|
||||
double susVecTot[3] = {0.0, 0.0, 0.0};
|
||||
VectorOperations<double>::normalize(susMeanValue, susVecTot, 3);
|
||||
@ -406,29 +367,29 @@ void SensorProcessing::processSus(
|
||||
{
|
||||
PoolReadGuard pg(susDataProcessed);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
std::memcpy(susDataProcessed->sus0vec.value, sus0VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus0vec.value, susVecBody[0], 3 * sizeof(float));
|
||||
susDataProcessed->sus0vec.setValid(sus0valid);
|
||||
std::memcpy(susDataProcessed->sus1vec.value, sus1VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus1vec.value, susVecBody[1], 3 * sizeof(float));
|
||||
susDataProcessed->sus1vec.setValid(sus1valid);
|
||||
std::memcpy(susDataProcessed->sus2vec.value, sus2VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus2vec.value, susVecBody[2], 3 * sizeof(float));
|
||||
susDataProcessed->sus2vec.setValid(sus2valid);
|
||||
std::memcpy(susDataProcessed->sus3vec.value, sus3VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus3vec.value, susVecBody[3], 3 * sizeof(float));
|
||||
susDataProcessed->sus3vec.setValid(sus3valid);
|
||||
std::memcpy(susDataProcessed->sus4vec.value, sus4VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus4vec.value, susVecBody[4], 3 * sizeof(float));
|
||||
susDataProcessed->sus4vec.setValid(sus4valid);
|
||||
std::memcpy(susDataProcessed->sus5vec.value, sus5VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus5vec.value, susVecBody[5], 3 * sizeof(float));
|
||||
susDataProcessed->sus5vec.setValid(sus5valid);
|
||||
std::memcpy(susDataProcessed->sus6vec.value, sus6VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus6vec.value, susVecBody[6], 3 * sizeof(float));
|
||||
susDataProcessed->sus6vec.setValid(sus6valid);
|
||||
std::memcpy(susDataProcessed->sus7vec.value, sus7VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus7vec.value, susVecBody[7], 3 * sizeof(float));
|
||||
susDataProcessed->sus7vec.setValid(sus7valid);
|
||||
std::memcpy(susDataProcessed->sus8vec.value, sus8VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus8vec.value, susVecBody[8], 3 * sizeof(float));
|
||||
susDataProcessed->sus8vec.setValid(sus8valid);
|
||||
std::memcpy(susDataProcessed->sus9vec.value, sus9VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus9vec.value, susVecBody[9], 3 * sizeof(float));
|
||||
susDataProcessed->sus9vec.setValid(sus9valid);
|
||||
std::memcpy(susDataProcessed->sus10vec.value, sus10VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus10vec.value, susVecBody[10], 3 * sizeof(float));
|
||||
susDataProcessed->sus10vec.setValid(sus10valid);
|
||||
std::memcpy(susDataProcessed->sus11vec.value, sus11VecBody, 3 * sizeof(float));
|
||||
std::memcpy(susDataProcessed->sus11vec.value, susVecBody[11], 3 * sizeof(float));
|
||||
susDataProcessed->sus11vec.setValid(sus11valid);
|
||||
std::memcpy(susDataProcessed->susVecTot.value, susVecTot, 3 * sizeof(double));
|
||||
susDataProcessed->susVecTot.setValid(true);
|
||||
@ -459,12 +420,11 @@ void SensorProcessing::processGyr(
|
||||
{
|
||||
PoolReadGuard pg(gyrDataProcessed);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
double zeroVector[3] = {0.0, 0.0, 0.0};
|
||||
std::memcpy(gyrDataProcessed->gyr0vec.value, zeroVector, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr1vec.value, zeroVector, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr2vec.value, zeroVector, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr3vec.value, zeroVector, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyrVecTot.value, zeroVector, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr0vec.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr1vec.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr2vec.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyr3vec.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
std::memcpy(gyrDataProcessed->gyrVecTot.value, ZERO_VEC_D, 3 * sizeof(double));
|
||||
gyrDataProcessed->setValidity(false, true);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ class SensorProcessing {
|
||||
acsctrl::GpsDataProcessed *gpsDataProcessed,
|
||||
const AcsParameters *acsParameters); // Will call protected functions
|
||||
private:
|
||||
static constexpr float ZERO_VEC_F[3] = {0, 0, 0};
|
||||
static constexpr double ZERO_VEC_D[3] = {0, 0, 0};
|
||||
|
||||
protected:
|
||||
// short description needed for every function
|
||||
void processMgm(const float *mgm0Value, bool mgm0valid, const float *mgm1Value, bool mgm1valid,
|
||||
|
@ -1,121 +1,64 @@
|
||||
#include "SusConverter.h"
|
||||
|
||||
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
||||
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool SusConverter::checkSunSensorData(const uint16_t susChannel[6]) {
|
||||
if (susChannel[0] <= susChannelValueCheckLow || susChannel[0] > susChannelValueCheckHigh ||
|
||||
uint64_t SusConverter::checkSunSensorData(const uint16_t susChannel[6]) {
|
||||
if (susChannel[0] <= SUS_CHANNEL_VALUE_LOW || susChannel[0] > SUS_CHANNEL_VALUE_HIGH ||
|
||||
susChannel[0] > susChannel[GNDREF]) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
if (susChannel[1] <= susChannelValueCheckLow || susChannel[1] > susChannelValueCheckHigh ||
|
||||
if (susChannel[1] <= SUS_CHANNEL_VALUE_LOW || susChannel[1] > SUS_CHANNEL_VALUE_HIGH ||
|
||||
susChannel[1] > susChannel[GNDREF]) {
|
||||
return false;
|
||||
return 0;
|
||||
};
|
||||
if (susChannel[2] <= susChannelValueCheckLow || susChannel[2] > susChannelValueCheckHigh ||
|
||||
if (susChannel[2] <= SUS_CHANNEL_VALUE_LOW || susChannel[2] > SUS_CHANNEL_VALUE_HIGH ||
|
||||
susChannel[2] > susChannel[GNDREF]) {
|
||||
return false;
|
||||
return 0;
|
||||
};
|
||||
if (susChannel[3] <= susChannelValueCheckLow || susChannel[3] > susChannelValueCheckHigh ||
|
||||
if (susChannel[3] <= SUS_CHANNEL_VALUE_LOW || susChannel[3] > SUS_CHANNEL_VALUE_HIGH ||
|
||||
susChannel[3] > susChannel[GNDREF]) {
|
||||
return false;
|
||||
return 0;
|
||||
};
|
||||
|
||||
susChannelValueSum =
|
||||
uint64_t susChannelValueSum =
|
||||
4 * susChannel[GNDREF] - (susChannel[0] + susChannel[1] + susChannel[2] + susChannel[3]);
|
||||
if ((susChannelValueSum < susChannelValueSumHigh) &&
|
||||
(susChannelValueSum > susChannelValueSumLow)) {
|
||||
return false;
|
||||
if (susChannelValueSum < SUS_ALBEDO_CHECK) {
|
||||
return 0;
|
||||
};
|
||||
return true;
|
||||
return susChannelValueSum;
|
||||
}
|
||||
|
||||
void SusConverter::calcAngle(const uint16_t susChannel[6]) {
|
||||
float xout, yout;
|
||||
float s = 0.03; // s=[mm] gap between diodes
|
||||
uint8_t d = 5; // d=[mm] edge length of the quadratic aperture
|
||||
uint8_t h = 1; // h=[mm] distance between diodes and aperture
|
||||
int ch0, ch1, ch2, ch3;
|
||||
bool SusConverter::checkValidity(bool* susValid, const uint64_t brightness[12],
|
||||
const float threshold) {
|
||||
uint8_t maxBrightness = 0;
|
||||
VectorOperations<uint64_t>::maxValue(brightness, 12, &maxBrightness);
|
||||
if (brightness[maxBrightness] == 0) {
|
||||
return true;
|
||||
}
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
if ((idx != maxBrightness) and (brightness[idx] < threshold * brightness[maxBrightness])) {
|
||||
susValid[idx] = false;
|
||||
continue;
|
||||
}
|
||||
susValid[idx] = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SusConverter::calculateSunVector(float* sunVectorSensorFrame, const uint16_t susChannel[6]) {
|
||||
// Substract measurement values from GNDREF zero current threshold
|
||||
ch0 = susChannel[GNDREF] - susChannel[0];
|
||||
ch1 = susChannel[GNDREF] - susChannel[1];
|
||||
ch2 = susChannel[GNDREF] - susChannel[2];
|
||||
ch3 = susChannel[GNDREF] - susChannel[3];
|
||||
float ch0 = susChannel[GNDREF] - susChannel[0];
|
||||
float ch1 = susChannel[GNDREF] - susChannel[1];
|
||||
float ch2 = susChannel[GNDREF] - susChannel[2];
|
||||
float ch3 = susChannel[GNDREF] - susChannel[3];
|
||||
|
||||
// Calculation of x and y
|
||||
xout = ((d - s) / 2) * (ch2 - ch3 - ch0 + ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
||||
yout = ((d - s) / 2) * (ch2 + ch3 - ch0 - ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
||||
float xout = ((D - S) / 2) * (ch2 - ch3 - ch0 + ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
||||
float yout = ((D - S) / 2) * (ch2 + ch3 - ch0 - ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
||||
|
||||
// Calculation of the angles
|
||||
alphaBetaRaw[0] = atan2(xout, h) * (180 / M_PI); //[°]
|
||||
alphaBetaRaw[1] = atan2(yout, h) * (180 / M_PI); //[°]
|
||||
}
|
||||
|
||||
void SusConverter::calibration(const float coeffAlpha[9][10], const float coeffBeta[9][10]) {
|
||||
uint8_t index, k, l;
|
||||
|
||||
// while loop iterates above all calibration cells to use the different calibration functions in
|
||||
// each cell
|
||||
k = 0;
|
||||
while (k < 3) {
|
||||
k++;
|
||||
l = 0;
|
||||
while (l < 3) {
|
||||
l++;
|
||||
// if-condition to check in which cell the data point has to be
|
||||
if ((alphaBetaRaw[0] > ((completeCellWidth * ((k - 1) / 3.)) - halfCellWidth) &&
|
||||
alphaBetaRaw[0] < ((completeCellWidth * (k / 3.)) - halfCellWidth)) &&
|
||||
(alphaBetaRaw[1] > ((completeCellWidth * ((l - 1) / 3.)) - halfCellWidth) &&
|
||||
alphaBetaRaw[1] < ((completeCellWidth * (l / 3.)) - halfCellWidth))) {
|
||||
index = (3 * (k - 1) + l) - 1; // calculate the index of the datapoint for the right cell
|
||||
alphaBetaCalibrated[0] =
|
||||
coeffAlpha[index][0] + coeffAlpha[index][1] * alphaBetaRaw[0] +
|
||||
coeffAlpha[index][2] * alphaBetaRaw[1] +
|
||||
coeffAlpha[index][3] * alphaBetaRaw[0] * alphaBetaRaw[0] +
|
||||
coeffAlpha[index][4] * alphaBetaRaw[0] * alphaBetaRaw[1] +
|
||||
coeffAlpha[index][5] * alphaBetaRaw[1] * alphaBetaRaw[1] +
|
||||
coeffAlpha[index][6] * alphaBetaRaw[0] * alphaBetaRaw[0] * alphaBetaRaw[0] +
|
||||
coeffAlpha[index][7] * alphaBetaRaw[0] * alphaBetaRaw[0] * alphaBetaRaw[1] +
|
||||
coeffAlpha[index][8] * alphaBetaRaw[0] * alphaBetaRaw[1] * alphaBetaRaw[1] +
|
||||
coeffAlpha[index][9] * alphaBetaRaw[1] * alphaBetaRaw[1] * alphaBetaRaw[1]; //[°]
|
||||
alphaBetaCalibrated[1] =
|
||||
coeffBeta[index][0] + coeffBeta[index][1] * alphaBetaRaw[0] +
|
||||
coeffBeta[index][2] * alphaBetaRaw[1] +
|
||||
coeffBeta[index][3] * alphaBetaRaw[0] * alphaBetaRaw[0] +
|
||||
coeffBeta[index][4] * alphaBetaRaw[0] * alphaBetaRaw[1] +
|
||||
coeffBeta[index][5] * alphaBetaRaw[1] * alphaBetaRaw[1] +
|
||||
coeffBeta[index][6] * alphaBetaRaw[0] * alphaBetaRaw[0] * alphaBetaRaw[0] +
|
||||
coeffBeta[index][7] * alphaBetaRaw[0] * alphaBetaRaw[0] * alphaBetaRaw[1] +
|
||||
coeffBeta[index][8] * alphaBetaRaw[0] * alphaBetaRaw[1] * alphaBetaRaw[1] +
|
||||
coeffBeta[index][9] * alphaBetaRaw[1] * alphaBetaRaw[1] * alphaBetaRaw[1]; //[°]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float* SusConverter::calculateSunVector() {
|
||||
// Calculate the normalized Sun Vector
|
||||
sunVectorSensorFrame[0] = -(tan(alphaBetaCalibrated[0] * (M_PI / 180)) /
|
||||
(sqrt((powf(tan(alphaBetaCalibrated[0] * (M_PI / 180)), 2)) +
|
||||
powf(tan((alphaBetaCalibrated[1] * (M_PI / 180))), 2) + (1))));
|
||||
sunVectorSensorFrame[1] = -(tan(alphaBetaCalibrated[1] * (M_PI / 180)) /
|
||||
(sqrt(powf((tan(alphaBetaCalibrated[0] * (M_PI / 180))), 2) +
|
||||
powf(tan((alphaBetaCalibrated[1] * (M_PI / 180))), 2) + (1))));
|
||||
sunVectorSensorFrame[2] =
|
||||
-(-1 / (sqrt(powf((tan(alphaBetaCalibrated[0] * (M_PI / 180))), 2) +
|
||||
powf((tan(alphaBetaCalibrated[1] * (M_PI / 180))), 2) + (1))));
|
||||
|
||||
return sunVectorSensorFrame;
|
||||
}
|
||||
|
||||
float* SusConverter::getSunVectorSensorFrame(const uint16_t susChannel[6],
|
||||
const float coeffAlpha[9][10],
|
||||
const float coeffBeta[9][10]) {
|
||||
calcAngle(susChannel);
|
||||
calibration(coeffAlpha, coeffBeta);
|
||||
return calculateSunVector();
|
||||
sunVectorSensorFrame[0] = -xout;
|
||||
sunVectorSensorFrame[1] = -yout;
|
||||
sunVectorSensorFrame[2] = H;
|
||||
VectorOperations<float>::normalize(sunVectorSensorFrame, sunVectorSensorFrame, 3);
|
||||
}
|
||||
|
@ -1,8 +1,4 @@
|
||||
#ifndef MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
|
||||
#define MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
|
||||
|
||||
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||
#include <stdint.h>
|
||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||
|
||||
#include "AcsParameters.h"
|
||||
|
||||
@ -10,41 +6,26 @@ class SusConverter {
|
||||
public:
|
||||
SusConverter() {}
|
||||
|
||||
bool checkSunSensorData(const uint16_t susChannel[6]);
|
||||
|
||||
void calcAngle(const uint16_t susChannel[6]);
|
||||
void calibration(const float coeffAlpha[9][10], const float coeffBeta[9][10]);
|
||||
float* calculateSunVector();
|
||||
|
||||
float* getSunVectorSensorFrame(const uint16_t susChannel[6], const float coeffAlpha[9][10],
|
||||
const float coeffBeta[9][10]);
|
||||
uint64_t checkSunSensorData(const uint16_t susChannel[6]);
|
||||
bool checkValidity(bool* susValid, const uint64_t brightness[12], const float threshold);
|
||||
void calculateSunVector(float* sunVectorSensorFrame, const uint16_t susChannel[6]);
|
||||
|
||||
private:
|
||||
float alphaBetaRaw[2]; //[°]
|
||||
float alphaBetaCalibrated[2]; //[°]
|
||||
float sunVectorSensorFrame[3]; //[-]
|
||||
|
||||
bool validFlag[12] = {returnvalue::OK, returnvalue::OK, returnvalue::OK, returnvalue::OK,
|
||||
returnvalue::OK, returnvalue::OK, returnvalue::OK, returnvalue::OK,
|
||||
returnvalue::OK, returnvalue::OK, returnvalue::OK, returnvalue::OK};
|
||||
|
||||
static const uint8_t GNDREF = 4;
|
||||
uint16_t susChannelValueCheckHigh =
|
||||
4096; //=2^12[Bit]high borderline for the channel values of one sun sensor for validity Check
|
||||
uint8_t susChannelValueCheckLow =
|
||||
0; //[Bit]low borderline for the channel values of one sun sensor for validity Check
|
||||
uint16_t susChannelValueSumHigh =
|
||||
100; // 4096[Bit]high borderline for check if the sun sensor is illuminated by the sun or by
|
||||
// the reflection of sunlight from the moon/earth
|
||||
uint8_t susChannelValueSumLow =
|
||||
0; //[Bit]low borderline for check if the sun sensor is illuminated
|
||||
// by the sun or by the reflection of sunlight from the moon/earth
|
||||
uint8_t completeCellWidth = 140,
|
||||
halfCellWidth = 70; //[°] Width of the calibration cells --> necessary for checking in
|
||||
// which cell a data point should be
|
||||
uint16_t susChannelValueSum = 0;
|
||||
// =2^12[Bit]high borderline for the channel values of one sun sensor for validity Check
|
||||
static constexpr uint16_t SUS_CHANNEL_VALUE_HIGH = 4096;
|
||||
// [Bit]low borderline for the channel values of one sun sensor for validity Check
|
||||
static constexpr uint8_t SUS_CHANNEL_VALUE_LOW = 0;
|
||||
// 4096[Bit]high borderline for check if the sun sensor is illuminated by the sun or by the
|
||||
// reflection of sunlight from the moon/earth
|
||||
static constexpr uint16_t SUS_ALBEDO_CHECK = 1000;
|
||||
// [Bit]low borderline for check if the sun sensor is illuminated by the sun or by the reflection
|
||||
// of sunlight from the moon/earth
|
||||
static constexpr uint8_t SUS_CHANNEL_SUM_LOW = 0;
|
||||
|
||||
static constexpr float S = 0.03; // S=[mm] gap between diodes
|
||||
static constexpr float D = 5; // D=[mm] edge length of the quadratic aperture
|
||||
static constexpr float H = 2.5; // H=[mm] distance between diodes and aperture
|
||||
|
||||
AcsParameters acsParameters;
|
||||
};
|
||||
|
||||
#endif /* MISSION_CONTROLLER_ACS_SUSCONVERTER_H_ */
|
||||
|
@ -7,8 +7,10 @@ Detumble::Detumble() {}
|
||||
|
||||
Detumble::~Detumble() {}
|
||||
|
||||
uint8_t Detumble::detumbleStrategy(const bool magFieldValid, const bool satRotRateValid,
|
||||
const bool magFieldRateValid, const bool useFullDetumbleLaw) {
|
||||
acs::SafeModeStrategy Detumble::detumbleStrategy(const bool magFieldValid,
|
||||
const bool satRotRateValid,
|
||||
const bool magFieldRateValid,
|
||||
const bool useFullDetumbleLaw) {
|
||||
if (not magFieldValid) {
|
||||
return acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL;
|
||||
} else if (satRotRateValid and useFullDetumbleLaw) {
|
||||
|
@ -11,8 +11,9 @@ class Detumble {
|
||||
Detumble();
|
||||
virtual ~Detumble();
|
||||
|
||||
uint8_t detumbleStrategy(const bool magFieldValid, const bool satRotRateValid,
|
||||
const bool magFieldRateValid, const bool useFullDetumbleLaw);
|
||||
acs::SafeModeStrategy detumbleStrategy(const bool magFieldValid, const bool satRotRateValid,
|
||||
const bool magFieldRateValid,
|
||||
const bool useFullDetumbleLaw);
|
||||
|
||||
void bDotLawFull(const double *satRotRateB, const double *magFieldB, double *magMomB,
|
||||
double gain);
|
||||
|
@ -5,9 +5,6 @@
|
||||
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||
#include <fsfw/globalfunctions/sign.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../util/MathOperations.h"
|
||||
|
||||
PtgCtrl::PtgCtrl(AcsParameters *acsParameters_) { acsParameters = acsParameters_; }
|
||||
|
||||
@ -32,12 +29,13 @@ void PtgCtrl::ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters
|
||||
double qErrorLaw[3] = {0, 0, 0};
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (abs(qError[i]) < qErrorMin) {
|
||||
if (std::abs(qError[i]) < qErrorMin) {
|
||||
qErrorLaw[i] = qErrorMin;
|
||||
} else {
|
||||
qErrorLaw[i] = abs(qError[i]);
|
||||
qErrorLaw[i] = std::abs(qError[i]);
|
||||
}
|
||||
}
|
||||
|
||||
double qErrorLawNorm = VectorOperations<double>::norm(qErrorLaw, 3);
|
||||
|
||||
double gain1 = cInt * omMax / qErrorLawNorm;
|
||||
@ -73,7 +71,7 @@ void PtgCtrl::ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters
|
||||
double pErrorSign[3] = {0, 0, 0};
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (abs(pError[i]) > 1) {
|
||||
if (std::abs(pError[i]) > 1) {
|
||||
pErrorSign[i] = sign(pError[i]);
|
||||
} else {
|
||||
pErrorSign[i] = pError[i];
|
||||
@ -98,61 +96,92 @@ void PtgCtrl::ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters
|
||||
VectorOperations<double>::mulScalar(torqueRws, -1, torqueRws, 4);
|
||||
}
|
||||
|
||||
void PtgCtrl::ptgNullspace(AcsParameters::PointingLawParameters *pointingLawParameters,
|
||||
const int32_t speedRw0, const int32_t speedRw1, const int32_t speedRw2,
|
||||
const int32_t speedRw3, double *rwTrqNs) {
|
||||
// concentrate RW speeds as vector and convert to double
|
||||
double speedRws[4] = {static_cast<double>(speedRw0), static_cast<double>(speedRw1),
|
||||
static_cast<double>(speedRw2), static_cast<double>(speedRw3)};
|
||||
VectorOperations<double>::mulScalar(speedRws, 1e-1, speedRws, 4);
|
||||
VectorOperations<double>::mulScalar(speedRws, RPM_TO_RAD_PER_SEC, speedRws, 4);
|
||||
|
||||
// calculate RPM offset utilizing the nullspace
|
||||
double rpmOffset[4] = {0, 0, 0, 0};
|
||||
double rpmOffsetSpeed = pointingLawParameters->nullspaceSpeed / 10 * RPM_TO_RAD_PER_SEC;
|
||||
VectorOperations<double>::mulScalar(acsParameters->rwMatrices.nullspaceVector, rpmOffsetSpeed,
|
||||
rpmOffset, 4);
|
||||
|
||||
// calculate resulting angular momentum
|
||||
double rwAngMomentum[4] = {0, 0, 0, 0}, diffRwSpeed[4] = {0, 0, 0, 0};
|
||||
VectorOperations<double>::subtract(speedRws, rpmOffset, diffRwSpeed, 4);
|
||||
VectorOperations<double>::mulScalar(diffRwSpeed, acsParameters->rwHandlingParameters.inertiaWheel,
|
||||
rwAngMomentum, 4);
|
||||
|
||||
// calculate resulting torque
|
||||
double nullspaceMatrix[4][4] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
||||
MatrixOperations<double>::multiply(acsParameters->rwMatrices.nullspaceVector,
|
||||
acsParameters->rwMatrices.nullspaceVector, *nullspaceMatrix, 4,
|
||||
1, 4);
|
||||
MatrixOperations<double>::multiply(*nullspaceMatrix, rwAngMomentum, rwTrqNs, 4, 4, 1);
|
||||
VectorOperations<double>::mulScalar(rwTrqNs, -1 * pointingLawParameters->gainNullspace, rwTrqNs,
|
||||
4);
|
||||
}
|
||||
|
||||
void PtgCtrl::ptgDesaturation(AcsParameters::PointingLawParameters *pointingLawParameters,
|
||||
double *magFieldEst, bool magFieldEstValid, double *satRate,
|
||||
int32_t *speedRw0, int32_t *speedRw1, int32_t *speedRw2,
|
||||
int32_t *speedRw3, double *mgtDpDes) {
|
||||
if (!(magFieldEstValid) || !(pointingLawParameters->desatOn)) {
|
||||
mgtDpDes[0] = 0;
|
||||
mgtDpDes[1] = 0;
|
||||
mgtDpDes[2] = 0;
|
||||
const double *magFieldB, const bool magFieldBValid,
|
||||
const double *satRate, const int32_t speedRw0, const int32_t speedRw1,
|
||||
const int32_t speedRw2, const int32_t speedRw3, double *mgtDpDes) {
|
||||
if (not magFieldBValid or not pointingLawParameters->desatOn) {
|
||||
return;
|
||||
}
|
||||
|
||||
// calculating momentum of satellite and momentum of reaction wheels
|
||||
double speedRws[4] = {(double)*speedRw0, (double)*speedRw1, (double)*speedRw2, (double)*speedRw3};
|
||||
double momentumRwU[4] = {0, 0, 0, 0}, momentumRw[3] = {0, 0, 0};
|
||||
VectorOperations<double>::mulScalar(speedRws, acsParameters->rwHandlingParameters.inertiaWheel,
|
||||
momentumRwU, 4);
|
||||
MatrixOperations<double>::multiply(*(acsParameters->rwMatrices.alignmentMatrix), momentumRwU,
|
||||
momentumRw, 3, 4, 1);
|
||||
double momentumSat[3] = {0, 0, 0}, momentumTotal[3] = {0, 0, 0};
|
||||
MatrixOperations<double>::multiply(*(acsParameters->inertiaEIVE.inertiaMatrixDeployed), satRate,
|
||||
momentumSat, 3, 3, 1);
|
||||
VectorOperations<double>::add(momentumSat, momentumRw, momentumTotal, 3);
|
||||
// calculating momentum error
|
||||
double deltaMomentum[3] = {0, 0, 0};
|
||||
VectorOperations<double>::subtract(momentumTotal, pointingLawParameters->desatMomentumRef,
|
||||
deltaMomentum, 3);
|
||||
// resulting magnetic dipole command
|
||||
double crossMomentumMagField[3] = {0, 0, 0};
|
||||
VectorOperations<double>::cross(deltaMomentum, magFieldEst, crossMomentumMagField);
|
||||
double normMag = VectorOperations<double>::norm(magFieldEst, 3), factor = 0;
|
||||
factor = (pointingLawParameters->deSatGainFactor) / normMag;
|
||||
VectorOperations<double>::mulScalar(crossMomentumMagField, factor, mgtDpDes, 3);
|
||||
}
|
||||
// concentrate RW speeds as vector and convert to double
|
||||
double speedRws[4] = {static_cast<double>(speedRw0), static_cast<double>(speedRw1),
|
||||
static_cast<double>(speedRw2), static_cast<double>(speedRw3)};
|
||||
|
||||
void PtgCtrl::ptgNullspace(AcsParameters::PointingLawParameters *pointingLawParameters,
|
||||
const int32_t *speedRw0, const int32_t *speedRw1,
|
||||
const int32_t *speedRw2, const int32_t *speedRw3, double *rwTrqNs) {
|
||||
double speedRws[4] = {(double)*speedRw0, (double)*speedRw1, (double)*speedRw2, (double)*speedRw3};
|
||||
double wheelMomentum[4] = {0, 0, 0, 0};
|
||||
double rpmOffset[4] = {1, 1, 1, -1}, factor = 350 * 2 * Math::PI / 60;
|
||||
// conversion to [rad/s] for further calculations
|
||||
VectorOperations<double>::mulScalar(rpmOffset, factor, rpmOffset, 4);
|
||||
VectorOperations<double>::mulScalar(speedRws, 2 * Math::PI / 60, speedRws, 4);
|
||||
double diffRwSpeed[4] = {0, 0, 0, 0};
|
||||
VectorOperations<double>::subtract(speedRws, rpmOffset, diffRwSpeed, 4);
|
||||
VectorOperations<double>::mulScalar(diffRwSpeed, acsParameters->rwHandlingParameters.inertiaWheel,
|
||||
wheelMomentum, 4);
|
||||
double gainNs = pointingLawParameters->gainNullspace;
|
||||
double nullSpaceMatrix[4][4] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
||||
MathOperations<double>::vecTransposeVecMatrix(acsParameters->rwMatrices.nullspace,
|
||||
acsParameters->rwMatrices.nullspace,
|
||||
*nullSpaceMatrix, 4);
|
||||
MatrixOperations<double>::multiply(*nullSpaceMatrix, wheelMomentum, rwTrqNs, 4, 4, 1);
|
||||
VectorOperations<double>::mulScalar(rwTrqNs, gainNs, rwTrqNs, 4);
|
||||
VectorOperations<double>::mulScalar(rwTrqNs, -1, rwTrqNs, 4);
|
||||
// convert magFieldB from uT to T
|
||||
double magFieldBT[3] = {0, 0, 0};
|
||||
VectorOperations<double>::mulScalar(magFieldB, 1e-6, magFieldBT, 3);
|
||||
|
||||
// calculate angular momentum of the satellite
|
||||
double angMomentumSat[3] = {0, 0, 0};
|
||||
MatrixOperations<double>::multiply(*(acsParameters->inertiaEIVE.inertiaMatrixDeployed), satRate,
|
||||
angMomentumSat, 3, 3, 1);
|
||||
|
||||
// calculate angular momentum of the reaction wheels with respect to the nullspace RW speed
|
||||
// relocate RW speed zero to nullspace RW speed
|
||||
double refSpeedRws[4] = {0, 0, 0, 0};
|
||||
VectorOperations<double>::mulScalar(acsParameters->rwMatrices.nullspaceVector,
|
||||
pointingLawParameters->nullspaceSpeed, refSpeedRws, 4);
|
||||
VectorOperations<double>::subtract(speedRws, refSpeedRws, speedRws, 4);
|
||||
// convert speed from 10 RPM to 1 RPM
|
||||
VectorOperations<double>::mulScalar(speedRws, 1e-1, speedRws, 4);
|
||||
// convert to rad/s
|
||||
VectorOperations<double>::mulScalar(speedRws, RPM_TO_RAD_PER_SEC, speedRws, 4);
|
||||
// calculate angular momentum of each RW
|
||||
double angMomentumRwU[4] = {0, 0, 0, 0};
|
||||
VectorOperations<double>::mulScalar(speedRws, acsParameters->rwHandlingParameters.inertiaWheel,
|
||||
angMomentumRwU, 4);
|
||||
// convert RW angular momentum to body RF
|
||||
double angMomentumRw[3] = {0, 0, 0};
|
||||
MatrixOperations<double>::multiply(*(acsParameters->rwMatrices.alignmentMatrix), angMomentumRwU,
|
||||
angMomentumRw, 3, 4, 1);
|
||||
|
||||
// calculate total angular momentum
|
||||
double angMomentumTotal[3] = {0, 0, 0};
|
||||
VectorOperations<double>::add(angMomentumSat, angMomentumRw, angMomentumTotal, 3);
|
||||
|
||||
// calculating momentum error
|
||||
double deltaAngMomentum[3] = {0, 0, 0};
|
||||
VectorOperations<double>::subtract(angMomentumTotal, pointingLawParameters->desatMomentumRef,
|
||||
deltaAngMomentum, 3);
|
||||
|
||||
// resulting magnetic dipole command
|
||||
double crossAngMomentumMagField[3] = {0, 0, 0};
|
||||
VectorOperations<double>::cross(deltaAngMomentum, magFieldBT, crossAngMomentumMagField);
|
||||
double factor =
|
||||
pointingLawParameters->deSatGainFactor / VectorOperations<double>::norm(magFieldBT, 3);
|
||||
VectorOperations<double>::mulScalar(crossAngMomentumMagField, factor, mgtDpDes, 3);
|
||||
}
|
||||
|
||||
void PtgCtrl::rwAntistiction(ACS::SensorValues *sensorValues, int32_t *rwCmdSpeeds) {
|
||||
@ -169,15 +198,9 @@ void PtgCtrl::rwAntistiction(ACS::SensorValues *sensorValues, int32_t *rwCmdSpee
|
||||
if (rwCmdSpeeds[i] != 0) {
|
||||
if (rwCmdSpeeds[i] > -acsParameters->rwHandlingParameters.stictionSpeed &&
|
||||
rwCmdSpeeds[i] < acsParameters->rwHandlingParameters.stictionSpeed) {
|
||||
if (currRwSpeed[i] == 0) {
|
||||
if (rwCmdSpeeds[i] > 0) {
|
||||
if (rwCmdSpeeds[i] > currRwSpeed[i]) {
|
||||
rwCmdSpeeds[i] = acsParameters->rwHandlingParameters.stictionSpeed;
|
||||
} else if (rwCmdSpeeds[i] < 0) {
|
||||
rwCmdSpeeds[i] = -acsParameters->rwHandlingParameters.stictionSpeed;
|
||||
}
|
||||
} else if (currRwSpeed[i] < -acsParameters->rwHandlingParameters.stictionSpeed) {
|
||||
rwCmdSpeeds[i] = acsParameters->rwHandlingParameters.stictionSpeed;
|
||||
} else if (currRwSpeed[i] > acsParameters->rwHandlingParameters.stictionSpeed) {
|
||||
} else if (rwCmdSpeeds[i] < currRwSpeed[i]) {
|
||||
rwCmdSpeeds[i] = -acsParameters->rwHandlingParameters.stictionSpeed;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
#ifndef PTGCTRL_H_
|
||||
#define PTGCTRL_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <mission/controller/acs/AcsParameters.h>
|
||||
#include <mission/controller/acs/SensorValues.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "../AcsParameters.h"
|
||||
#include "../SensorValues.h"
|
||||
#include "eive/resultClassIds.h"
|
||||
|
||||
class PtgCtrl {
|
||||
/*
|
||||
@ -29,14 +26,14 @@ class PtgCtrl {
|
||||
void ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters, const double *qError,
|
||||
const double *deltaRate, const double *rwPseudoInv, double *torqueRws);
|
||||
|
||||
void ptgDesaturation(AcsParameters::PointingLawParameters *pointingLawParameters,
|
||||
double *magFieldEst, bool magFieldEstValid, double *satRate,
|
||||
int32_t *speedRw0, int32_t *speedRw1, int32_t *speedRw2, int32_t *speedRw3,
|
||||
double *mgtDpDes);
|
||||
|
||||
void ptgNullspace(AcsParameters::PointingLawParameters *pointingLawParameters,
|
||||
const int32_t *speedRw0, const int32_t *speedRw1, const int32_t *speedRw2,
|
||||
const int32_t *speedRw3, double *rwTrqNs);
|
||||
const int32_t speedRw0, const int32_t speedRw1, const int32_t speedRw2,
|
||||
const int32_t speedRw3, double *rwTrqNs);
|
||||
|
||||
void ptgDesaturation(AcsParameters::PointingLawParameters *pointingLawParameters,
|
||||
const double *magFieldB, const bool magFieldBValid, const double *satRate,
|
||||
const int32_t speedRw0, const int32_t speedRw1, const int32_t speedRw2,
|
||||
const int32_t speedRw3, double *mgtDpDes);
|
||||
|
||||
/* @brief: Commands the stiction torque in case wheel speed is to low
|
||||
* torqueCommand modified torque after antistiction
|
||||
@ -45,6 +42,7 @@ class PtgCtrl {
|
||||
|
||||
private:
|
||||
const AcsParameters *acsParameters;
|
||||
static constexpr double RPM_TO_RAD_PER_SEC = (2 * M_PI) / 60;
|
||||
};
|
||||
|
||||
#endif /* ACS_CONTROL_PTGCTRL_H_ */
|
||||
|
@ -9,9 +9,10 @@ SafeCtrl::SafeCtrl(AcsParameters *acsParameters_) { acsParameters = acsParameter
|
||||
|
||||
SafeCtrl::~SafeCtrl() {}
|
||||
|
||||
uint8_t SafeCtrl::safeCtrlStrategy(const bool magFieldValid, const bool mekfValid,
|
||||
acs::SafeModeStrategy SafeCtrl::safeCtrlStrategy(const bool magFieldValid, const bool mekfValid,
|
||||
const bool satRotRateValid, const bool sunDirValid,
|
||||
const uint8_t mekfEnabled, const uint8_t dampingEnabled) {
|
||||
const uint8_t mekfEnabled,
|
||||
const uint8_t dampingEnabled) {
|
||||
if (not magFieldValid) {
|
||||
return acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL;
|
||||
} else if (mekfEnabled and mekfValid) {
|
||||
|
@ -12,7 +12,7 @@ class SafeCtrl {
|
||||
SafeCtrl(AcsParameters *acsParameters_);
|
||||
virtual ~SafeCtrl();
|
||||
|
||||
uint8_t safeCtrlStrategy(const bool magFieldValid, const bool mekfValid,
|
||||
acs::SafeModeStrategy safeCtrlStrategy(const bool magFieldValid, const bool mekfValid,
|
||||
const bool satRotRateValid, const bool sunDirValid,
|
||||
const uint8_t mekfEnabled, const uint8_t dampingEnabled);
|
||||
|
||||
|
@ -9,6 +9,85 @@
|
||||
|
||||
namespace tcsCtrl {
|
||||
|
||||
/**
|
||||
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
|
||||
* is exceeded.
|
||||
* OP Limit: Soft limit. Device should be switched off or TCS controller should take action if the
|
||||
* limit is exceeded to avoid reaching NOP limit
|
||||
*/
|
||||
struct TempLimits {
|
||||
TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit,
|
||||
float nopUpperLimit)
|
||||
: opLowerLimit(opLowerLimit),
|
||||
opUpperLimit(opUpperLimit),
|
||||
cutOffLimit(cutOffLimit),
|
||||
nopLowerLimit(nopLowerLimit),
|
||||
nopUpperLimit(nopUpperLimit) {}
|
||||
float opLowerLimit;
|
||||
float opUpperLimit;
|
||||
float cutOffLimit;
|
||||
float nopLowerLimit;
|
||||
float nopUpperLimit;
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstraction for the state of a single thermal component
|
||||
*/
|
||||
struct ThermalState {
|
||||
uint8_t noSensorAvailableCounter;
|
||||
// Which sensor is used for this component?
|
||||
uint8_t sensorIndex = 0;
|
||||
// Is heating on for that thermal module?
|
||||
bool heating = false;
|
||||
// Which switch is being used for heating the component
|
||||
heater::Switch heaterSwitch = heater::Switch::HEATER_NONE;
|
||||
// Heater start time and end times as UNIX seconds. Please note that these times will be updated
|
||||
// when a switch command is sent, with no guarantess that the heater actually went on.
|
||||
uint32_t heaterStartTime = 0;
|
||||
uint32_t heaterEndTime = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstraction for the state of a single heater.
|
||||
*/
|
||||
struct HeaterState {
|
||||
bool switchTransition = false;
|
||||
heater::SwitchState target = heater::SwitchState::OFF;
|
||||
uint8_t heaterSwitchControlCycles = 0;
|
||||
bool trackHeaterMaxBurnTime = false;
|
||||
Countdown heaterOnMaxBurnTime;
|
||||
};
|
||||
|
||||
using HeaterSwitchStates = std::array<heater::SwitchState, heater::NUMBER_OF_SWITCHES>;
|
||||
|
||||
enum ThermalComponents : uint8_t {
|
||||
NONE = 0,
|
||||
ACS_BOARD = 1,
|
||||
MGT = 2,
|
||||
RW = 3,
|
||||
STR = 4,
|
||||
IF_BOARD = 5,
|
||||
TCS_BOARD = 6,
|
||||
OBC = 7,
|
||||
LEGACY_OBCIF_BOARD = 8,
|
||||
SBAND_TRANSCEIVER = 9,
|
||||
PCDUP60_BOARD = 10,
|
||||
PCDUACU = 11,
|
||||
PCDUPDU = 12,
|
||||
PLPCDU_BOARD = 13,
|
||||
PLOCMISSION_BOARD = 14,
|
||||
PLOCPROCESSING_BOARD = 15,
|
||||
DAC = 16,
|
||||
CAMERA = 17,
|
||||
DRO = 18,
|
||||
X8 = 19,
|
||||
HPA = 20,
|
||||
TX = 21,
|
||||
MPA = 22,
|
||||
SCEX_BOARD = 23,
|
||||
NUM_THERMAL_COMPONENTS
|
||||
};
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_CONTROLLER;
|
||||
static constexpr Event NO_VALID_SENSOR_TEMPERATURE = MAKE_EVENT(0, severity::MEDIUM);
|
||||
static constexpr Event NO_HEALTHY_HEATER_AVAILABLE = MAKE_EVENT(1, severity::MEDIUM);
|
||||
@ -18,6 +97,12 @@ static constexpr Event CAMERA_OVERHEATING = MAKE_EVENT(5, severity::HIGH);
|
||||
static constexpr Event PCDU_SYSTEM_OVERHEATING = MAKE_EVENT(6, severity::HIGH);
|
||||
static constexpr Event HEATER_NOT_OFF_FOR_OFF_MODE = MAKE_EVENT(7, severity::MEDIUM);
|
||||
static constexpr Event MGT_OVERHEATING = MAKE_EVENT(8, severity::HIGH);
|
||||
//! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index
|
||||
static constexpr Event TCS_SWITCHING_HEATER_ON = MAKE_EVENT(9, severity::INFO);
|
||||
//! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index
|
||||
static constexpr Event TCS_SWITCHING_HEATER_OFF = MAKE_EVENT(10, severity::INFO);
|
||||
//! [EXPORT] : [COMMENT] P1: Heater index. P2: Maximum burn time for heater.
|
||||
static constexpr Event TCS_HEATER_MAX_BURN_TIME_REACHED = MAKE_EVENT(11, severity::MEDIUM);
|
||||
|
||||
enum SetId : uint32_t {
|
||||
SENSOR_TEMPERATURES = 0,
|
||||
@ -25,6 +110,7 @@ enum SetId : uint32_t {
|
||||
SUS_TEMPERATURES = 2,
|
||||
COMPONENT_TEMPERATURES = 3,
|
||||
HEATER_SET = 4,
|
||||
TCS_CTRL_INFO = 5
|
||||
};
|
||||
|
||||
enum PoolIds : lp_id_t {
|
||||
@ -92,7 +178,13 @@ enum PoolIds : lp_id_t {
|
||||
TEMP_ADC_PAYLOAD_PCDU,
|
||||
|
||||
HEATER_SWITCH_LIST,
|
||||
HEATER_CURRENT
|
||||
HEATER_CURRENT,
|
||||
|
||||
HEATER_ON_FOR_COMPONENT_VEC,
|
||||
SENSOR_USED_FOR_TCS_CTRL,
|
||||
HEATER_IDX_USED_FOR_TCS_CTRL,
|
||||
HEATER_START_TIME,
|
||||
HEATER_END_TIME
|
||||
};
|
||||
|
||||
static const uint8_t ENTRIES_SENSOR_TEMPERATURE_SET = 25;
|
||||
@ -232,6 +324,29 @@ class HeaterInfo : public StaticLocalDataSet<3> {
|
||||
lp_var_t<int16_t> heaterCurrent = lp_var_t<int16_t>(sid.objectId, PoolIds::HEATER_CURRENT, this);
|
||||
};
|
||||
|
||||
class TcsCtrlInfo : public StaticLocalDataSet<6> {
|
||||
public:
|
||||
explicit TcsCtrlInfo(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TCS_CTRL_INFO) {}
|
||||
|
||||
explicit TcsCtrlInfo(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TCS_CTRL_INFO)) {}
|
||||
|
||||
lp_vec_t<uint8_t, tcsCtrl::NUM_THERMAL_COMPONENTS> heatingOnVec =
|
||||
lp_vec_t<uint8_t, tcsCtrl::NUM_THERMAL_COMPONENTS>(
|
||||
sid.objectId, PoolIds::HEATER_ON_FOR_COMPONENT_VEC, this);
|
||||
lp_vec_t<uint8_t, tcsCtrl::NUM_THERMAL_COMPONENTS> sensorIdxUsedForTcsCtrl =
|
||||
lp_vec_t<uint8_t, tcsCtrl::NUM_THERMAL_COMPONENTS>(sid.objectId,
|
||||
PoolIds::SENSOR_USED_FOR_TCS_CTRL, this);
|
||||
lp_vec_t<uint8_t, tcsCtrl::NUM_THERMAL_COMPONENTS> heaterSwitchIdx =
|
||||
lp_vec_t<uint8_t, tcsCtrl::NUM_THERMAL_COMPONENTS>(
|
||||
sid.objectId, PoolIds::HEATER_IDX_USED_FOR_TCS_CTRL, this);
|
||||
lp_vec_t<uint32_t, tcsCtrl::NUM_THERMAL_COMPONENTS> heaterStartTimes =
|
||||
lp_vec_t<uint32_t, tcsCtrl::NUM_THERMAL_COMPONENTS>(sid.objectId, PoolIds::HEATER_START_TIME,
|
||||
this);
|
||||
lp_vec_t<uint32_t, tcsCtrl::NUM_THERMAL_COMPONENTS> heaterEndTimes =
|
||||
lp_vec_t<uint32_t, tcsCtrl::NUM_THERMAL_COMPONENTS>(sid.objectId, PoolIds::HEATER_END_TIME,
|
||||
this);
|
||||
};
|
||||
|
||||
} // namespace tcsCtrl
|
||||
|
||||
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_THERMALCONTROLLERDEFINITIONS_H_ */
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "mission/system/acs/acsModeTree.h"
|
||||
#include "mission/system/tcs/tcsModeTree.h"
|
||||
#include "mission/tcs/defs.h"
|
||||
#include "mission/tmtc/Service15TmStorage.h"
|
||||
#include "mission/tmtc/tmFilters.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
#include "tmtc/pusIds.h"
|
||||
@ -58,15 +59,13 @@ using persTmStore::PersistentTmStores;
|
||||
#if OBSW_ADD_TCPIP_SERVERS == 1
|
||||
#if OBSW_ADD_TMTC_UDP_SERVER == 1
|
||||
// UDP server includes
|
||||
#include "devices/gpioIds.h"
|
||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||
#include <fsfw/osal/common/UdpTcPollingTask.h>
|
||||
#include <fsfw/osal/common/UdpTmTcBridge.h>
|
||||
#endif
|
||||
#if OBSW_ADD_TMTC_TCP_SERVER == 1
|
||||
// TCP server includes
|
||||
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
||||
#include "fsfw/osal/common/TcpTmTcServer.h"
|
||||
#include "mission/tmtc/Service15TmStorage.h"
|
||||
#include <fsfw/osal/common/TcpTmTcBridge.h>
|
||||
#include <fsfw/osal/common/TcpTmTcServer.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -92,19 +91,21 @@ EiveFaultHandler EIVE_FAULT_HANDLER;
|
||||
} // namespace cfdp
|
||||
|
||||
std::atomic_bool tcs::TCS_BOARD_SHORTLY_UNAVAILABLE = false;
|
||||
std::atomic_bool core::SAVE_PUS_SEQUENCE_COUNT = false;
|
||||
std::atomic_bool core::SAVE_CFDP_SEQUENCE_COUNT = false;
|
||||
|
||||
void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel,
|
||||
CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan,
|
||||
StorageManagerIF** ipcStore, StorageManagerIF** tmStore,
|
||||
PersistentTmStores& stores,
|
||||
uint32_t eventManagerQueueDepth) {
|
||||
uint32_t eventManagerQueueDepth, bool enableHkSets) {
|
||||
// Framework objects
|
||||
new EventManager(objects::EVENT_MANAGER, eventManagerQueueDepth);
|
||||
auto healthTable = new HealthTable(objects::HEALTH_TABLE);
|
||||
if (healthTable_ != nullptr) {
|
||||
*healthTable_ = healthTable;
|
||||
}
|
||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER, 5, enableHkSets, 120);
|
||||
new VerificationReporter();
|
||||
auto* timeStamper = new CdsShortTimeStamper(objects::TIME_STAMPER);
|
||||
StorageManagerIF* tcStore;
|
||||
@ -156,9 +157,11 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
new PusDistributor(config::EIVE_PUS_APID, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib);
|
||||
|
||||
PusTmFunnel::FunnelCfg pusFunnelCfg(objects::PUS_TM_FUNNEL, "PusTmFunnel", **tmStore, **ipcStore,
|
||||
config::MAX_PUS_FUNNEL_QUEUE_DEPTH);
|
||||
config::MAX_PUS_FUNNEL_QUEUE_DEPTH, sdcMan,
|
||||
config::PUS_SEQUENCE_COUNT_FILE,
|
||||
core::SAVE_PUS_SEQUENCE_COUNT);
|
||||
// The PUS funnel routes all live TM to the live destinations and to the TM stores.
|
||||
*pusFunnel = new PusTmFunnel(pusFunnelCfg, *ramToFileStore, *timeStamper, sdcMan);
|
||||
*pusFunnel = new PusTmFunnel(pusFunnelCfg, *ramToFileStore, *timeStamper);
|
||||
|
||||
// MISC store and PUS funnel to MISC store routing
|
||||
{
|
||||
@ -217,7 +220,9 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
stores.cfdpStore->getReportReceptionQueue(0));
|
||||
}
|
||||
PusTmFunnel::FunnelCfg cfdpFunnelCfg(objects::CFDP_TM_FUNNEL, "CfdpTmFunnel", **tmStore,
|
||||
**ipcStore, config::MAX_CFDP_FUNNEL_QUEUE_DEPTH);
|
||||
**ipcStore, config::MAX_CFDP_FUNNEL_QUEUE_DEPTH, sdcMan,
|
||||
config::CFDP_SEQUENCE_COUNT_FILE,
|
||||
core::SAVE_CFDP_SEQUENCE_COUNT);
|
||||
*cfdpFunnel = new CfdpTmFunnel(cfdpFunnelCfg, stores.cfdpStore->getReportReceptionQueue(0),
|
||||
*ramToFileStore, config::EIVE_CFDP_APID);
|
||||
|
||||
@ -234,16 +239,17 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
|
||||
// PUS service stack
|
||||
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, config::EIVE_PUS_APID,
|
||||
pus::PUS_SERVICE_1, objects::PUS_TM_FUNNEL, 40);
|
||||
pus::PUS_SERVICE_1, objects::PUS_TM_FUNNEL,
|
||||
config::VERIFICATION_SERVICE_QUEUE_DEPTH);
|
||||
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, config::EIVE_PUS_APID,
|
||||
pus::PUS_SERVICE_2, 3, 10);
|
||||
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, config::EIVE_PUS_APID,
|
||||
pus::PUS_SERVICE_3, config::HK_SERVICE_QUEUE_DEPTH);
|
||||
pus::PUS_SERVICE_3, config::HK_SERVICE_QUEUE_DEPTH, 16);
|
||||
new Service5EventReporting(
|
||||
PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, config::EIVE_PUS_APID, pus::PUS_SERVICE_5),
|
||||
80, 160);
|
||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, config::EIVE_PUS_APID,
|
||||
pus::PUS_SERVICE_8, 16, 60);
|
||||
pus::PUS_SERVICE_8, config::ACTION_SERVICE_QUEUE_DEPTH, 16, 60);
|
||||
new Service9TimeManagement(
|
||||
PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_9));
|
||||
|
||||
@ -305,9 +311,9 @@ void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF&
|
||||
heaterHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
|
||||
}
|
||||
|
||||
void ObjectFactory::createThermalController(HeaterHandler& heaterHandler) {
|
||||
void ObjectFactory::createThermalController(HeaterHandler& heaterHandler, bool pollPlPcduTmp1) {
|
||||
auto* tcsCtrl = new ThermalController(objects::THERMAL_CONTROLLER, heaterHandler,
|
||||
tcs::TCS_BOARD_SHORTLY_UNAVAILABLE);
|
||||
tcs::TCS_BOARD_SHORTLY_UNAVAILABLE, pollPlPcduTmp1);
|
||||
tcsCtrl->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
|
||||
}
|
||||
void ObjectFactory::createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
|
||||
|
@ -45,11 +45,12 @@ namespace ObjectFactory {
|
||||
void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel,
|
||||
CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan,
|
||||
StorageManagerIF** ipcStore, StorageManagerIF** tmStore,
|
||||
PersistentTmStores& stores, uint32_t eventManagerQueueDepth);
|
||||
PersistentTmStores& stores, uint32_t eventManagerQueueDepth,
|
||||
bool enableHkSets);
|
||||
void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher,
|
||||
HeaterHandler*& heaterHandler);
|
||||
|
||||
void createThermalController(HeaterHandler& heaterHandler);
|
||||
void createThermalController(HeaterHandler& heaterHandler, bool pollPlPcduTmp1);
|
||||
void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
|
||||
std::array<DeviceHandlerBase*, 4> rws, std::array<object_id_t, 4> rwIds);
|
||||
void createSusAssy(PowerSwitchIF& pwrSwitcher, std::array<DeviceHandlerBase*, 12> suses);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <OBSWConfig.h>
|
||||
#include <devices/gpioIds.h>
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <mission/payload/RadiationSensorHandler.h>
|
||||
#include <mission/power/gsDefs.h>
|
||||
#include <mission/tcs/max1227.h>
|
||||
@ -15,6 +16,8 @@ RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t
|
||||
if (comCookie == nullptr) {
|
||||
sif::error << "RadiationSensorHandler: Invalid com cookie" << std::endl;
|
||||
}
|
||||
// Time out immediately so we get an immediate measurement at device startup.
|
||||
measurementCd.timeOut();
|
||||
}
|
||||
|
||||
RadiationSensorHandler::~RadiationSensorHandler() {}
|
||||
@ -51,14 +54,17 @@ void RadiationSensorHandler::doShutDown() {
|
||||
}
|
||||
|
||||
ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
if (measurementCd.isBusy()) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
switch (communicationStep) {
|
||||
case CommunicationStep::START_CONVERSION: {
|
||||
*id = RAD_SENSOR::START_CONVERSION;
|
||||
*id = radSens::START_CONVERSION;
|
||||
communicationStep = CommunicationStep::READ_CONVERSIONS;
|
||||
break;
|
||||
}
|
||||
case CommunicationStep::READ_CONVERSIONS: {
|
||||
*id = RAD_SENSOR::READ_CONVERSIONS;
|
||||
*id = radSens::READ_CONVERSIONS;
|
||||
communicationStep = CommunicationStep::START_CONVERSION;
|
||||
break;
|
||||
}
|
||||
@ -73,7 +79,7 @@ ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(DeviceCommandId_t
|
||||
|
||||
ReturnValue_t RadiationSensorHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
if (internalState == InternalState::SETUP) {
|
||||
*id = RAD_SENSOR::WRITE_SETUP;
|
||||
*id = radSens::WRITE_SETUP;
|
||||
} else {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
@ -84,15 +90,19 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
|
||||
const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
switch (deviceCommand) {
|
||||
case (RAD_SENSOR::WRITE_SETUP): {
|
||||
cmdBuffer[0] = RAD_SENSOR::SETUP_DEFINITION;
|
||||
case (radSens::WRITE_SETUP): {
|
||||
cmdBuffer[0] = radSens::SETUP_DEFINITION;
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = 1;
|
||||
internalState = InternalState::CONFIGURED;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case (RAD_SENSOR::START_CONVERSION): {
|
||||
case (radSens::START_CONVERSION): {
|
||||
ReturnValue_t result = gpioIF->pullHigh(gpioIds::ENABLE_RADFET);
|
||||
// Test a small delay between pulling the RADFET high and reading the sensor. As long as this
|
||||
// delay remains small enough, this should not cause scheduling issues. Do not make this
|
||||
// delay large, this device might be scheduled inside the ACS PST!
|
||||
TaskFactory::delayTask(5);
|
||||
if (result != returnvalue::OK) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::warning
|
||||
@ -102,25 +112,25 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
|
||||
#endif
|
||||
}
|
||||
/* First the fifo will be reset here */
|
||||
cmdBuffer[0] = RAD_SENSOR::RESET_DEFINITION;
|
||||
cmdBuffer[1] = RAD_SENSOR::CONVERSION_DEFINITION;
|
||||
cmdBuffer[0] = radSens::RESET_DEFINITION;
|
||||
cmdBuffer[1] = radSens::CONVERSION_DEFINITION;
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = 2;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case (RAD_SENSOR::READ_CONVERSIONS): {
|
||||
cmdBuffer[0] = RAD_SENSOR::DUMMY_BYTE;
|
||||
std::memset(cmdBuffer, RAD_SENSOR::DUMMY_BYTE, RAD_SENSOR::READ_SIZE);
|
||||
case (radSens::READ_CONVERSIONS): {
|
||||
cmdBuffer[0] = radSens::DUMMY_BYTE;
|
||||
std::memset(cmdBuffer, radSens::DUMMY_BYTE, radSens::READ_SIZE);
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = RAD_SENSOR::READ_SIZE;
|
||||
rawPacketLen = radSens::READ_SIZE;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: {
|
||||
case radSens::ENABLE_DEBUG_OUTPUT: {
|
||||
printPeriodicData = true;
|
||||
rawPacketLen = 0;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: {
|
||||
case radSens::DISABLE_DEBUG_OUTPUT: {
|
||||
rawPacketLen = 0;
|
||||
printPeriodicData = false;
|
||||
return returnvalue::OK;
|
||||
@ -132,12 +142,11 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
|
||||
}
|
||||
|
||||
void RadiationSensorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(RAD_SENSOR::WRITE_SETUP);
|
||||
this->insertInCommandMap(RAD_SENSOR::START_CONVERSION);
|
||||
this->insertInCommandMap(RAD_SENSOR::ENABLE_DEBUG_OUTPUT);
|
||||
this->insertInCommandMap(RAD_SENSOR::DISABLE_DEBUG_OUTPUT);
|
||||
this->insertInCommandAndReplyMap(RAD_SENSOR::READ_CONVERSIONS, 1, &dataset,
|
||||
RAD_SENSOR::READ_SIZE);
|
||||
this->insertInCommandMap(radSens::WRITE_SETUP);
|
||||
this->insertInCommandMap(radSens::START_CONVERSION);
|
||||
this->insertInCommandMap(radSens::ENABLE_DEBUG_OUTPUT);
|
||||
this->insertInCommandMap(radSens::DISABLE_DEBUG_OUTPUT);
|
||||
this->insertInCommandAndReplyMap(radSens::READ_CONVERSIONS, 1, &dataset, radSens::READ_SIZE);
|
||||
}
|
||||
|
||||
ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t remainingSize,
|
||||
@ -145,11 +154,11 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
|
||||
*foundId = this->getPendingCommand();
|
||||
|
||||
switch (*foundId) {
|
||||
case RAD_SENSOR::START_CONVERSION:
|
||||
case RAD_SENSOR::WRITE_SETUP:
|
||||
case radSens::START_CONVERSION:
|
||||
case radSens::WRITE_SETUP:
|
||||
*foundLen = remainingSize;
|
||||
return IGNORE_REPLY_DATA;
|
||||
case RAD_SENSOR::READ_CONVERSIONS: {
|
||||
case radSens::READ_CONVERSIONS: {
|
||||
ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET);
|
||||
if (result != returnvalue::OK) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
@ -160,8 +169,8 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT:
|
||||
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT:
|
||||
case radSens::ENABLE_DEBUG_OUTPUT:
|
||||
case radSens::DISABLE_DEBUG_OUTPUT:
|
||||
sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl;
|
||||
break;
|
||||
default:
|
||||
@ -176,8 +185,10 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
|
||||
ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) {
|
||||
switch (id) {
|
||||
case RAD_SENSOR::READ_CONVERSIONS: {
|
||||
case radSens::READ_CONVERSIONS: {
|
||||
uint8_t offset = 0;
|
||||
measurementCd.resetTimer();
|
||||
{
|
||||
PoolReadGuard readSet(&dataset);
|
||||
uint16_t tempRaw = ((packet[offset] & 0x0f) << 8) | packet[offset + 1];
|
||||
dataset.temperatureCelcius = max1227::getTemperature(tempRaw);
|
||||
@ -194,6 +205,7 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
offset += 2;
|
||||
dataset.ain7 = (*(packet + offset) << 8) | *(packet + offset + 1);
|
||||
dataset.setValidity(true, true);
|
||||
}
|
||||
if (printPeriodicData) {
|
||||
sif::info << "Radiation sensor temperature: " << dataset.temperatureCelcius << " °C"
|
||||
<< std::dec << std::endl;
|
||||
@ -204,6 +216,12 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
sif::info << "Radiation sensor ADC value channel 6: " << dataset.ain6 << std::endl;
|
||||
sif::info << "Radiation sensor ADC value channel 7: " << dataset.ain7 << std::endl;
|
||||
}
|
||||
ReturnValue_t result =
|
||||
getHkManagerHandle()->generateHousekeepingPacket(dataset.getSid(), &dataset, true);
|
||||
if (result != returnvalue::OK) {
|
||||
// TODO: Maybe add event?
|
||||
sif::error << "Generating HK set for radiation sensor failed" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -220,15 +238,18 @@ uint32_t RadiationSensorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t mo
|
||||
|
||||
ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(RAD_SENSOR::TEMPERATURE_C, new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(RAD_SENSOR::AIN0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(RAD_SENSOR::AIN1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(RAD_SENSOR::AIN4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(RAD_SENSOR::AIN5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(RAD_SENSOR::AIN6, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::TEMPERATURE_C, new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(radSens::AIN0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN6, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(radSens::AIN7, new PoolEntry<uint16_t>({0}));
|
||||
// It should normally not be necessary to enable this set, as a sample TM will be generated
|
||||
// after a measurement. If this is still enabled, sample with double the measurement frequency
|
||||
// to ensure we get all measurements.
|
||||
poolManager.subscribeForRegularPeriodicPacket(
|
||||
subdp::RegularHkPeriodicParams(dataset.getSid(), false, 20.0));
|
||||
subdp::RegularHkPeriodicParams(dataset.getSid(), false, DEFAULT_MEASUREMENT_CD_MS / 2));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user