Merge pull request 'Object ID Update' (#49) from mueller/update into develop
Reviewed-on: #49 Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
commit
d976697c2a
@ -79,7 +79,7 @@ wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/2Fp2ag6NGnbtAsK/downloa
|
||||
3. Run the following commands in MinGW64
|
||||
|
||||
```sh
|
||||
pacman -Syuuu
|
||||
pacman -Syu
|
||||
```
|
||||
|
||||
It is recommended to install the full base development toolchain
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||
#include <mission/devices/GPSHandler.h>
|
||||
#include <mission/devices/GPSHyperionHandler.h>
|
||||
#include "ObjectFactory.h"
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
@ -157,7 +157,7 @@ void ObjectFactory::produce(void* args){
|
||||
UartModes::CANONICAL, 9600, 1024);
|
||||
uartCookie->setToFlushInput(true);
|
||||
uartCookie->setReadCycles(6);
|
||||
GPSHandler* gpsHandler = new GPSHandler(objects::GPS0_HANDLER,
|
||||
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
|
||||
objects::UART_COM_IF, uartCookie);
|
||||
gpsHandler->setStartUpImmediately();
|
||||
#endif
|
||||
|
23
cmake/scripts/Q7S/ninja_debug_cfg.sh
Executable file
23
cmake/scripts/Q7S/ninja_debug_cfg.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Debug-Q7S"
|
||||
build_generator="Ninja"
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
@ -16,12 +16,8 @@ fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/raspberrypi"
|
||||
build_generator=""
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
build_generator="Ninja"
|
||||
build_dir="build-Debug-RPi"
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size" -t "${tgt_bsp}"
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
@ -6,51 +6,72 @@
|
||||
namespace objects {
|
||||
enum commonObjects: uint32_t {
|
||||
/* First Byte 0x50-0x52 reserved for PUS Services **/
|
||||
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
|
||||
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
||||
UDP_BRIDGE = 0x50000300,
|
||||
UDP_POLLING_TASK = 0x50000400,
|
||||
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
|
||||
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
||||
UDP_BRIDGE = 0x50000300,
|
||||
UDP_POLLING_TASK = 0x50000400,
|
||||
|
||||
/* 0x43 ('C') for Controllers */
|
||||
THERMAL_CONTROLLER = 0x43001000,
|
||||
ATTITUDE_CONTROLLER = 0x43002000,
|
||||
ACS_CONTROLLER = 0x43003000,
|
||||
CORE_CONTROLLER = 0x43004000,
|
||||
THERMAL_CONTROLLER = 0x43400001,
|
||||
ACS_CONTROLLER = 0x43100002,
|
||||
CORE_CONTROLLER = 0x43000003,
|
||||
|
||||
/* 0x44 ('D') for device handlers */
|
||||
P60DOCK_HANDLER = 0x44000001,
|
||||
PDU1_HANDLER = 0x44000002,
|
||||
PDU2_HANDLER = 0x44000003,
|
||||
ACU_HANDLER = 0x44000004,
|
||||
TMP1075_HANDLER_1 = 0x44000005,
|
||||
TMP1075_HANDLER_2 = 0x44000006,
|
||||
MGM_0_LIS3_HANDLER = 0x44000007,
|
||||
MGM_1_RM3100_HANDLER = 0x44000008,
|
||||
MGM_2_LIS3_HANDLER = 0x44000009,
|
||||
MGM_3_RM3100_HANDLER = 0x44000010,
|
||||
GYRO_0_ADIS_HANDLER = 0x44000011,
|
||||
GYRO_1_L3G_HANDLER = 0x44000012,
|
||||
GYRO_2_L3G_HANDLER = 0x44000013,
|
||||
/* 0x44 ('D') for device handlers */
|
||||
P60DOCK_HANDLER = 0x44250000,
|
||||
PDU1_HANDLER = 0x44250001,
|
||||
PDU2_HANDLER = 0x44250002,
|
||||
ACU_HANDLER = 0x44250003,
|
||||
TMP1075_HANDLER_1 = 0x44420004,
|
||||
TMP1075_HANDLER_2 = 0x44420005,
|
||||
MGM_0_LIS3_HANDLER = 0x44120006,
|
||||
MGM_1_RM3100_HANDLER = 0x44120107,
|
||||
MGM_2_LIS3_HANDLER = 0x44120208,
|
||||
MGM_3_RM3100_HANDLER = 0x44120309,
|
||||
GYRO_0_ADIS_HANDLER = 0x44120010,
|
||||
GYRO_1_L3G_HANDLER = 0x44120111,
|
||||
GYRO_2_ADIS_HANDLER = 0x44120212,
|
||||
GYRO_3_L3G_HANDLER = 0x44120313,
|
||||
|
||||
IMTQ_HANDLER = 0x44000014,
|
||||
PLOC_HANDLER = 0x44000015,
|
||||
IMTQ_HANDLER = 0x44140014,
|
||||
PLOC_HANDLER = 0x44330015,
|
||||
|
||||
SUS_1 = 0x44000016,
|
||||
SUS_2 = 0x44000017,
|
||||
SUS_3 = 0x44000018,
|
||||
SUS_4 = 0x44000019,
|
||||
SUS_5 = 0x4400001A,
|
||||
SUS_6 = 0x4400001B,
|
||||
SUS_7 = 0x4400001C,
|
||||
SUS_8 = 0x4400001D,
|
||||
SUS_9 = 0x4400001E,
|
||||
SUS_10 = 0x4400001F,
|
||||
SUS_11 = 0x44000021,
|
||||
SUS_12 = 0x44000022,
|
||||
SUS_13 = 0x44000023,
|
||||
/**
|
||||
* Not yet specified which pt1000 will measure which device/location in the satellite.
|
||||
* Therefore object ids are named according to the IC naming of the RTDs in the schematic.
|
||||
*/
|
||||
RTD_IC3 = 0x44420016,
|
||||
RTD_IC4 = 0x44420017,
|
||||
RTD_IC5 = 0x44420018,
|
||||
RTD_IC6 = 0x44420019,
|
||||
RTD_IC7 = 0x44420020,
|
||||
RTD_IC8 = 0x44420021,
|
||||
RTD_IC9 = 0x44420022,
|
||||
RTD_IC10 = 0x44420023,
|
||||
RTD_IC11 = 0x44420024,
|
||||
RTD_IC12 = 0x44420025,
|
||||
RTD_IC13 = 0x44420026,
|
||||
RTD_IC14 = 0x44420027,
|
||||
RTD_IC15 = 0x44420028,
|
||||
RTD_IC16 = 0x44420029,
|
||||
RTD_IC17 = 0x44420030,
|
||||
RTD_IC18 = 0x44420031,
|
||||
|
||||
GPS0_HANDLER = 0x44001000,
|
||||
GPS1_HANDLER = 0x44002000
|
||||
SUS_1 = 0x44120032,
|
||||
SUS_2 = 0x44120033,
|
||||
SUS_3 = 0x44120034,
|
||||
SUS_4 = 0x44120035,
|
||||
SUS_5 = 0x44120036,
|
||||
SUS_6 = 0x44120037,
|
||||
SUS_7 = 0x44120038,
|
||||
SUS_8 = 0x44120039,
|
||||
SUS_9 = 0x44120040,
|
||||
SUS_10 = 0x44120041,
|
||||
SUS_11 = 0x44120042,
|
||||
SUS_12 = 0x44120043,
|
||||
SUS_13 = 0x44120044,
|
||||
|
||||
GPS0_HANDLER = 0x44130045,
|
||||
GPS1_HANDLER = 0x44130146
|
||||
};
|
||||
}
|
||||
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 5f9a6bb155eb59981e7ff851b7efaa1ae25e42b4
|
||||
Subproject commit 38f2f69c784c74cd87a10dce6c968325cf1cb472
|
@ -17,7 +17,8 @@ namespace addresses {
|
||||
|
||||
GYRO_0_ADIS = objects::GYRO_0_ADIS_HANDLER,
|
||||
GYRO_1_L3G = objects::GYRO_1_L3G_HANDLER,
|
||||
GYRO_2_L3G = objects::GYRO_2_L3G_HANDLER,
|
||||
GYRO_2_ADIS = objects::GYRO_2_ADIS_HANDLER,
|
||||
GYRO_3_L3G = objects::GYRO_3_L3G_HANDLER,
|
||||
|
||||
RAD_SENSOR = objects::RAD_SENSOR,
|
||||
|
||||
|
@ -6,67 +6,64 @@
|
||||
#include <cstdint>
|
||||
|
||||
// The objects will be instantiated in the ID order
|
||||
// For naming scheme see flight manual
|
||||
/*
|
||||
https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/EIVE_Project_IDs
|
||||
|
||||
Second byte first four bits is the subsystem:
|
||||
OBDH 0x0
|
||||
ACS 0x1
|
||||
EPS 0x2
|
||||
PL 0x3
|
||||
TCS 0x4
|
||||
COM 0x5
|
||||
|
||||
Second byte last four bits is the bus:
|
||||
None 0x0
|
||||
GPIO 0x1
|
||||
SPI 0x2
|
||||
UART 0x3
|
||||
I2C 0x4
|
||||
CAN 0x5
|
||||
|
||||
Third byte is an assembly counter if there are multiple redundant devices.
|
||||
Fourth byte is a unique counter.
|
||||
|
||||
*/
|
||||
namespace objects {
|
||||
enum sourceObjects: uint32_t {
|
||||
/* 0x53 reserved for FSFW */
|
||||
FW_ADDRESS_START = PUS_SERVICE_1_VERIFICATION,
|
||||
FW_ADDRESS_END = TIME_STAMPER,
|
||||
enum sourceObjects: uint32_t {
|
||||
/* 0x53 reserved for FSFW */
|
||||
FW_ADDRESS_START = PUS_SERVICE_1_VERIFICATION,
|
||||
FW_ADDRESS_END = TIME_STAMPER,
|
||||
PUS_SERVICE_6 = 0x51000500,
|
||||
|
||||
CCSDS_IP_CORE_BRIDGE = 0x50000500,
|
||||
CCSDS_IP_CORE_BRIDGE = 0x73500000,
|
||||
TM_FUNNEL = 0x73000100,
|
||||
|
||||
PUS_SERVICE_6 = 0x51000500,
|
||||
/* 0x49 ('I') for Communication Interfaces **/
|
||||
ARDUINO_COM_IF = 0x49000000,
|
||||
CSP_COM_IF = 0x49050001,
|
||||
I2C_COM_IF = 0x49040002,
|
||||
UART_COM_IF = 0x49030003,
|
||||
SPI_COM_IF = 0x49020004,
|
||||
GPIO_IF = 0x49010005,
|
||||
|
||||
TM_FUNNEL = 0x52000002,
|
||||
/* Custom device handler */
|
||||
PCDU_HANDLER = 0x442000A1,
|
||||
SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2,
|
||||
SYRLINKS_HK_HANDLER = 0x445300A3,
|
||||
HEATER_HANDLER = 0x444100A4,
|
||||
RAD_SENSOR = 0x443200A5,
|
||||
|
||||
/* 0x49 ('I') for Communication Interfaces **/
|
||||
ARDUINO_COM_IF = 0x49000001,
|
||||
CSP_COM_IF = 0x49000002,
|
||||
I2C_COM_IF = 0x49000003,
|
||||
UART_COM_IF = 0x49000004,
|
||||
SPI_COM_IF = 0x49000005,
|
||||
|
||||
/* 0x47 ('G') for Gpio Interfaces */
|
||||
GPIO_IF = 0x47000001,
|
||||
|
||||
/* Custom device handler */
|
||||
PCDU_HANDLER = 0x44001000,
|
||||
SOLAR_ARRAY_DEPL_HANDLER = 0x44001001,
|
||||
SYRLINKS_HK_HANDLER = 0x44001002,
|
||||
|
||||
/* 0x54 ('T') for thermal objects */
|
||||
HEATER_HANDLER = 0x54000003,
|
||||
/**
|
||||
* Not yet specified which pt1000 will measure which device/location in the satellite.
|
||||
* Therefore object ids are named according to the IC naming of the RTDs in the schematic.
|
||||
*/
|
||||
RTD_IC3 = 0x54000004,
|
||||
RTD_IC4 = 0x54000005,
|
||||
RTD_IC5 = 0x54000006,
|
||||
RTD_IC6 = 0x54000007,
|
||||
RTD_IC7 = 0x54000008,
|
||||
RTD_IC8 = 0x54000009,
|
||||
RTD_IC9 = 0x5400000A,
|
||||
RTD_IC10 = 0x5400000B,
|
||||
RTD_IC11 = 0x5400000C,
|
||||
RTD_IC12 = 0x5400000D,
|
||||
RTD_IC13 = 0x5400000E,
|
||||
RTD_IC14 = 0x5400000F,
|
||||
RTD_IC15 = 0x5400001F,
|
||||
RTD_IC16 = 0x5400002F,
|
||||
RTD_IC17 = 0x5400003F,
|
||||
RTD_IC18 = 0x5400004F,
|
||||
|
||||
RAD_SENSOR = 0x54000050,
|
||||
|
||||
/* 0x54 ('T') for test handlers */
|
||||
TEST_TASK = 0x54694269,
|
||||
LIBGPIOD_TEST = 0x54123456,
|
||||
SPI_TEST = 0x54000010,
|
||||
UART_TEST = 0x54000020,
|
||||
DUMMY_INTERFACE = 0x5400CAFE,
|
||||
DUMMY_HANDLER = 0x5400AFFE,
|
||||
P60DOCK_TEST_TASK = 0x00005060
|
||||
};
|
||||
/* 0x54 ('T') for test handlers */
|
||||
TEST_TASK = 0x54694269,
|
||||
LIBGPIOD_TEST = 0x54123456,
|
||||
SPI_TEST = 0x54000010,
|
||||
UART_TEST = 0x54000020,
|
||||
DUMMY_INTERFACE = 0x5400CAFE,
|
||||
DUMMY_HANDLER = 0x5400AFFE,
|
||||
P60DOCK_TEST_TASK = 0x00005060
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
||||
|
@ -1,6 +1,5 @@
|
||||
target_sources(${TARGET_NAME} PUBLIC
|
||||
GPSHandler.cpp
|
||||
# GyroL3GD20Handler.cpp
|
||||
GPSHyperionHandler.cpp
|
||||
MGMHandlerLIS3MDL.cpp
|
||||
MGMHandlerRM3100.cpp
|
||||
GomspaceDeviceHandler.cpp
|
||||
|
@ -1,98 +0,0 @@
|
||||
#include "GPSHandler.h"
|
||||
#include "devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
#include "lwgps/lwgps.h"
|
||||
|
||||
GPSHandler::GPSHandler(object_id_t objectId, object_id_t deviceCommunication,
|
||||
CookieIF *comCookie):
|
||||
DeviceHandlerBase(objectId, deviceCommunication, comCookie) {
|
||||
lwgps_init(&gpsData);
|
||||
}
|
||||
|
||||
GPSHandler::~GPSHandler() {}
|
||||
|
||||
void GPSHandler::doStartUp() {
|
||||
if(internalState == InternalStates::NONE) {
|
||||
commandExecuted = false;
|
||||
internalState = InternalStates::WAIT_FIRST_MESSAGE;
|
||||
}
|
||||
|
||||
if(internalState == InternalStates::WAIT_FIRST_MESSAGE) {
|
||||
if(commandExecuted) {
|
||||
internalState = InternalStates::IDLE;
|
||||
setMode(MODE_ON);
|
||||
commandExecuted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GPSHandler::doShutDown() {
|
||||
internalState = InternalStates::NONE;
|
||||
commandExecuted = false;
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
// Pass data to GPS library
|
||||
if(len > 0) {
|
||||
sif::info << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl;
|
||||
if (internalState == InternalStates::WAIT_FIRST_MESSAGE) {
|
||||
// TODO: Check whether data is valid by chcking whether NMEA start string is valid
|
||||
commandExecuted = true;
|
||||
}
|
||||
int result = lwgps_process(&gpsData, start, len);
|
||||
if(result != 1) {
|
||||
sif::warning << "GPSHandler::scanForReply: Issue processing GPS data with lwgps"
|
||||
<< std::endl;
|
||||
}
|
||||
else {
|
||||
sif::info << "GPS Data" << std::endl;
|
||||
// Print messages
|
||||
printf("Valid status: %d\n", gpsData.is_valid);
|
||||
printf("Latitude: %f degrees\n", gpsData.latitude);
|
||||
printf("Longitude: %f degrees\n", gpsData.longitude);
|
||||
printf("Altitude: %f meters\n", gpsData.altitude);
|
||||
}
|
||||
*foundLen = len;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
uint32_t GPSHandler::getTransitionDelayMs(Mode_t from, Mode_t to) {
|
||||
return 5000;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void GPSHandler::fillCommandAndReplyMap() {
|
||||
// Reply length does not matter, packets should always arrive periodically
|
||||
insertInReplyMap(GpsHyperion::GPS_REPLY, 4, nullptr, 0, true);
|
||||
}
|
||||
|
||||
void GPSHandler::modeChanged() {
|
||||
internalState = InternalStates::NONE;
|
||||
}
|
150
mission/devices/GPSHyperionHandler.cpp
Normal file
150
mission/devices/GPSHyperionHandler.cpp
Normal file
@ -0,0 +1,150 @@
|
||||
#include "GPSHyperionHandler.h"
|
||||
#include "devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
#include "lwgps/lwgps.h"
|
||||
|
||||
GPSHyperionHandler::GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication,
|
||||
CookieIF *comCookie):
|
||||
DeviceHandlerBase(objectId, deviceCommunication, comCookie), gpsSet(this) {
|
||||
lwgps_init(&gpsData);
|
||||
}
|
||||
|
||||
GPSHyperionHandler::~GPSHyperionHandler() {}
|
||||
|
||||
void GPSHyperionHandler::doStartUp() {
|
||||
if(internalState == InternalStates::NONE) {
|
||||
commandExecuted = false;
|
||||
internalState = InternalStates::WAIT_FIRST_MESSAGE;
|
||||
}
|
||||
|
||||
if(internalState == InternalStates::WAIT_FIRST_MESSAGE) {
|
||||
if(commandExecuted) {
|
||||
internalState = InternalStates::IDLE;
|
||||
setMode(MODE_ON);
|
||||
commandExecuted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GPSHyperionHandler::doShutDown() {
|
||||
internalState = InternalStates::NONE;
|
||||
commandExecuted = false;
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
// Pass data to GPS library
|
||||
if(len > 0) {
|
||||
sif::info << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl;
|
||||
if (internalState == InternalStates::WAIT_FIRST_MESSAGE) {
|
||||
// TODO: Check whether data is valid by chcking whether NMEA start string is valid
|
||||
commandExecuted = true;
|
||||
}
|
||||
int result = lwgps_process(&gpsData, start, len);
|
||||
if(result != 1) {
|
||||
sif::warning << "GPSHandler::scanForReply: Issue processing GPS data with lwgps"
|
||||
<< std::endl;
|
||||
}
|
||||
else {
|
||||
// The data from the device will generally be read all at once. Therefore, we
|
||||
// can set all field here
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::warning << "GPSHyperionHandler::scanForReply: Reading dataset failed"
|
||||
<< std::endl;
|
||||
#endif
|
||||
}
|
||||
// Print messages
|
||||
if(gpsData.is_valid) {
|
||||
// Set all entries valid now, set invalid on case basis if values are sanitized
|
||||
gpsSet.setValidity(true, true);
|
||||
}
|
||||
// Negative latitude -> South direction
|
||||
gpsSet.latitude.value = gpsData.latitude;
|
||||
// Negative longitude -> West direction
|
||||
gpsSet.longitude.value = gpsData.latitude;
|
||||
gpsSet.fixMode.value = gpsData.fix_mode;
|
||||
gpsSet.satInUse.value = gpsData.sats_in_use;
|
||||
Clock::TimeOfDay_t timeStruct = {};
|
||||
timeStruct.day = gpsData.date;
|
||||
timeStruct.hour = gpsData.hours;
|
||||
timeStruct.minute = gpsData.minutes;
|
||||
timeStruct.month = gpsData.month;
|
||||
timeStruct.second = gpsData.seconds;
|
||||
// Convert two-digit year to full year (AD)
|
||||
timeStruct.year = gpsData.year + 2000;
|
||||
timeval timeval = {};
|
||||
Clock::convertTimeOfDayToTimeval(&timeStruct, &timeval);
|
||||
gpsSet.year = timeStruct.year;
|
||||
gpsSet.month = gpsData.month;
|
||||
gpsSet.day = gpsData.date;
|
||||
gpsSet.hours = gpsData.hours;
|
||||
gpsSet.minutes = gpsData.minutes;
|
||||
gpsSet.seconds = gpsData.seconds;
|
||||
#if FSFW_HAL_DEBUG_HYPERION_GPS == 1
|
||||
sif::info << "GPS Data" << std::endl;
|
||||
printf("Valid status: %d\n", gpsData.is_valid);
|
||||
printf("Latitude: %f degrees\n", gpsData.latitude);
|
||||
printf("Longitude: %f degrees\n", gpsData.longitude);
|
||||
printf("Altitude: %f meters\n", gpsData.altitude);
|
||||
#endif
|
||||
}
|
||||
*foundLen = len;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
uint32_t GPSHyperionHandler::getTransitionDelayMs(Mode_t from, Mode_t to) {
|
||||
return 5000;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionHandler::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LATITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::YEAR, new PoolEntry<uint16_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::MONTH, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::DAY, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::HOURS, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::MINUTES, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SECONDS, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::UNIX_SECONDS, new PoolEntry<uint32_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void GPSHyperionHandler::fillCommandAndReplyMap() {
|
||||
// Reply length does not matter, packets should always arrive periodically
|
||||
insertInReplyMap(GpsHyperion::GPS_REPLY, 4, nullptr, 0, true);
|
||||
}
|
||||
|
||||
void GPSHyperionHandler::modeChanged() {
|
||||
internalState = InternalStates::NONE;
|
||||
}
|
@ -1,20 +1,25 @@
|
||||
#ifndef MISSION_DEVICES_GPSHANDLER_H_
|
||||
#define MISSION_DEVICES_GPSHANDLER_H_
|
||||
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "devicedefinitions/GPSDefinitions.h"
|
||||
#include "lwgps/lwgps.h"
|
||||
|
||||
#ifndef FSFW_HAL_DEBUG_HYPERION_GPS
|
||||
#define FSFW_HAL_DEBUG_HYPERION_GPS 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device handler for the Hyperion HT-GPS200 device
|
||||
* @details
|
||||
* Flight manual:
|
||||
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/Hyperion_HT-GPS200
|
||||
*/
|
||||
class GPSHandler: public DeviceHandlerBase {
|
||||
class GPSHyperionHandler: public DeviceHandlerBase {
|
||||
public:
|
||||
GPSHandler(object_id_t objectId, object_id_t deviceCommunication,
|
||||
GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication,
|
||||
CookieIF* comCookie);
|
||||
virtual ~GPSHandler();
|
||||
virtual ~GPSHyperionHandler();
|
||||
|
||||
protected:
|
||||
enum class InternalStates {
|
||||
@ -48,6 +53,7 @@ protected:
|
||||
|
||||
private:
|
||||
lwgps_t gpsData = {};
|
||||
GpsPrimaryDataset gpsSet;
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_GPSHANDLER_H_ */
|
||||
#endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */
|
@ -1,7 +1,9 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include "MGMHandlerLIS3MDL.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
|
||||
#endif
|
||||
|
||||
MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId,
|
||||
object_id_t deviceCommunication, CookieIF* comCookie):
|
||||
@ -300,9 +302,9 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
|
||||
sif::printInfo("X: %f " "\xC2\xB5" "T\n", mgmX);
|
||||
sif::printInfo("Y: %f " "\xC2\xB5" "T\n", mgmY);
|
||||
sif::printInfo("Z: %f " "\xC2\xB5" "T\n", mgmZ);
|
||||
#endif
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */
|
||||
}
|
||||
#endif
|
||||
#endif /* OBSW_VERBOSE_LEVEL >= 1 */
|
||||
PoolReadGuard readHelper(&dataset);
|
||||
if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
||||
dataset.fieldStrengthX = mgmX;
|
||||
@ -482,6 +484,3 @@ ReturnValue_t MGMHandlerLIS3MDL::initializeLocalDataPool(
|
||||
new PoolEntry<float>({0.0}));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void MGMHandlerLIS3MDL::performOperationHook() {
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
#ifndef MISSION_DEVICES_MGMLIS3MDLHANDLER_H_
|
||||
#define MISSION_DEVICES_MGMLIS3MDLHANDLER_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "devicedefinitions/MGMHandlerLIS3Definitions.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
|
||||
#include <OBSWConfig.h>
|
||||
#include <events/subsystemIdRanges.h>
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
class PeriodicOperationDivider;
|
||||
|
||||
/**
|
||||
* @brief Device handler object for the LIS3MDL 3-axis magnetometer
|
||||
@ -162,9 +162,6 @@ private:
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
PeriodicOperationDivider* debugDivider;
|
||||
#endif
|
||||
|
||||
void performOperationHook() override;
|
||||
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include "MGMHandlerRM3100.h"
|
||||
|
||||
#include <fsfw/globalfunctions/bitutility.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerMessage.h>
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/globalfunctions/bitutility.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerMessage.h"
|
||||
#include "fsfw/objectmanager/SystemObjectIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
|
||||
MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId,
|
||||
|
@ -1,13 +1,12 @@
|
||||
#ifndef MISSION_DEVICES_MGMRM3100HANDLER_H_
|
||||
#define MISSION_DEVICES_MGMRM3100HANDLER_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "devicedefinitions/MGMHandlerRM3100Definitions.h"
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
|
||||
#include <OBSWConfig.h>
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -21,11 +20,11 @@ class MGMHandlerRM3100: public DeviceHandlerBase {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::MGM_RM3100;
|
||||
|
||||
//! P1: TMRC value which was set, P2: 0
|
||||
//! [EXPORT] : [COMMENT] P1: TMRC value which was set, P2: 0
|
||||
static constexpr Event tmrcSet = event::makeEvent(SUBSYSTEM_ID::MGM_RM3100,
|
||||
0x00, severity::INFO);
|
||||
|
||||
//! P1: First two bytes new Cycle Count X
|
||||
//! [EXPORT] : [COMMENT] Cycle counter set. P1: First two bytes new Cycle Count X
|
||||
//! P1: Second two bytes new Cycle Count Y
|
||||
//! P2: New cycle count Z
|
||||
static constexpr Event cycleCountersSet = event::makeEvent(
|
||||
|
@ -1,21 +1,65 @@
|
||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_
|
||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
|
||||
#include "fsfw/datapoollocal/StaticLocalDataSet.h"
|
||||
|
||||
namespace GpsHyperion {
|
||||
|
||||
static constexpr DeviceCommandId_t GPS_REPLY = 0;
|
||||
|
||||
enum GpsPoolIds: lp_id_t {
|
||||
static constexpr uint32_t DATASET_ID = 0;
|
||||
|
||||
enum GpsPoolIds: lp_id_t {
|
||||
LATITUDE = 0,
|
||||
LONGITUDE = 1,
|
||||
ALTITUDE = 2,
|
||||
FIX_MODE = 3,
|
||||
SATS_IN_USE = 4,
|
||||
UNIX_SECONDS = 5,
|
||||
YEAR = 6,
|
||||
MONTH = 7,
|
||||
DAY = 8,
|
||||
HOURS = 9,
|
||||
MINUTES = 10,
|
||||
SECONDS = 11
|
||||
};
|
||||
|
||||
enum GpsFixModes: uint8_t {
|
||||
INVALID = 0,
|
||||
NO_FIX = 1,
|
||||
FIX_2D = 2,
|
||||
FIX_3D = 3
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class GpsPrimaryDataset: public StaticLocalDataSet<5> {
|
||||
class GpsPrimaryDataset: public StaticLocalDataSet<18> {
|
||||
public:
|
||||
GpsPrimaryDataset(object_id_t gpsId):
|
||||
StaticLocalDataSet(sid_t(gpsId, GpsHyperion::DATASET_ID)) {
|
||||
setAllVariablesReadOnly();
|
||||
}
|
||||
|
||||
lp_var_t<double> latitude = lp_var_t<double>(sid.objectId,
|
||||
GpsHyperion::LATITUDE, this);
|
||||
lp_var_t<double> longitude = lp_var_t<double>(sid.objectId,
|
||||
GpsHyperion::LONGITUDE, this);
|
||||
lp_var_t<double> altitude = lp_var_t<double>(sid.objectId, GpsHyperion::ALTITUDE, this);
|
||||
lp_var_t<uint8_t> fixMode = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::FIX_MODE, this);
|
||||
lp_var_t<uint8_t> satInUse = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SATS_IN_USE, this);
|
||||
lp_var_t<uint16_t> year = lp_var_t<uint16_t>(sid.objectId, GpsHyperion::YEAR, this);
|
||||
lp_var_t<uint8_t> month = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::MONTH, this);
|
||||
lp_var_t<uint8_t> day = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::DAY, this);
|
||||
lp_var_t<uint8_t> hours = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::HOURS, this);
|
||||
lp_var_t<uint8_t> minutes = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::MINUTES, this);
|
||||
lp_var_t<uint8_t> seconds = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SECONDS, this);
|
||||
lp_var_t<uint32_t> unixSeconds = lp_var_t<uint32_t>(sid.objectId,
|
||||
GpsHyperion::UNIX_SECONDS, this);
|
||||
private:
|
||||
friend class GPSHyperionHandler;
|
||||
GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner):
|
||||
StaticLocalDataSet(hkOwner, GpsHyperion::DATASET_ID) {}
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_ */
|
||||
|
@ -20,8 +20,8 @@ static constexpr size_t MAX_BUFFER_SIZE = 16;
|
||||
|
||||
static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100;
|
||||
|
||||
static const DeviceCommandId_t SETUP_MGM = 0x00;
|
||||
static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x01;
|
||||
static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00;
|
||||
static const DeviceCommandId_t SETUP_MGM = 0x01;
|
||||
static const DeviceCommandId_t READ_TEMPERATURE = 0x02;
|
||||
static const DeviceCommandId_t IDENTIFY_DEVICE = 0x03;
|
||||
static const DeviceCommandId_t TEMP_SENSOR_ENABLE = 0x04;
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 5be05c2a929dfc908b8de61250e4db890b010fa5
|
||||
Subproject commit 2a9862489d57e2ccbf8b9ca5017f5e89395acddf
|
Loading…
Reference in New Issue
Block a user