Merge remote-tracking branch 'origin/develop' into mueller/clang-formatting-applied
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-01-19 11:52:06 +01:00
11 changed files with 569 additions and 164 deletions

View File

@ -29,7 +29,7 @@ int obsw::obsw() {
if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
sif::warning << "File " << watchdog::RUNNING_FILE_NAME
<< " exists so the software might "
"already be running. Aborting.."
"already be running. Check if obsw systemd service has been stopped."
<< std::endl;
return OBSW_ALREADY_RUNNING;
}

View File

@ -197,7 +197,48 @@ enum PoolIds : lp_id_t {
BLOBPIX_TOT_VAL,
BLOBPIX_IN_USE,
BLOBPIX_BRIGHT_NEIGHBOURS,
BLOBPIX_REGION
BLOBPIX_REGION,
CAMERA_MODE,
FOCALLENGTH,
EXPOSURE,
INTERVAL,
CAMERA_OFFSET,
PGAGAIN,
ADCGAIN,
CAM_REG1,
CAM_VAL1,
CAM_REG2,
CAM_VAL2,
CAM_REG3,
CAM_VAL3,
CAM_REG4,
CAM_VAL4,
LIMITS_ACTION,
LIMITS_FPGA18CURRENT,
LIMITS_FPGA25CURRENT,
LIMITS_FPGA10CURRENT,
LIMITS_MCUCURRENT,
LIMITS_CMOS21CURRENT,
LIMITS_CMOSPIXCURRENT,
LIMITS_CMOS33CURRENT,
LIMITS_CMOSVRESCURRENT,
LIMITS_CMOSTEMPERATURE,
LIMITS_MCUTEMPERATURE,
BLOB_MODE,
BLOB_MIN_VALUE,
BLOB_MIN_DISTANCE,
BLOB_NEIGHBOUR_DISTANCE,
BLOB_NEIGHBOUR_BRIGHTPIXELS,
BLOB_MIN_TOTAL_VALUE,
BLOB_MAX_TOTAL_VALUE,
BLOB_MIN_BRIGHT_NEIGHBOURS,
BLOB_MAX_BRIGHT_NEIGHBOURS,
BLOB_MAX_PIXELSTOCONSIDER,
BLOB_SIGNAL_THRESHOLD,
BLOB_DARK_THRESHOLD,
BLOB_ENABLE_HISTOGRAM,
BLOB_ENABLE_CONTRAST,
BLOB_BIN_MODE
};
static const DeviceCommandId_t PING_REQUEST = 0;
@ -246,6 +287,9 @@ static const DeviceCommandId_t DOWNLOAD_FPGA_IMAGE = 63;
static const DeviceCommandId_t CHANGE_FPGA_DOWNLOAD_FILE = 64;
static const DeviceCommandId_t UPLOAD_FPGA_IMAGE = 65;
static const DeviceCommandId_t FPGA_ACTION = 66;
static const DeviceCommandId_t REQ_CAMERA = 67;
static const DeviceCommandId_t REQ_LIMITS = 68;
static const DeviceCommandId_t REQ_BLOB_PARAMS = 69;
static const DeviceCommandId_t NONE = 0xFFFFFFFF;
static const uint32_t VERSION_SET_ID = REQ_VERSION;
@ -261,6 +305,9 @@ static const uint32_t DOWNLOADCENTROID_SET_ID = DOWNLOAD_CENTROID;
static const uint32_t DOWNLOAD_MATCHED_STAR_SET_ID = DOWNLOAD_MATCHED_STAR;
static const uint32_t DOWNLOAD_DBIMAGE_SET_ID = DOWNLOAD_DBIMAGE;
static const uint32_t DOWNLOAD_BLOBPIXEL_SET_ID = DOWNLOAD_BLOBPIXEL;
static const uint32_t CAMERA_SET_ID = REQ_CAMERA;
static const uint32_t LIMITS_SET_ID = REQ_LIMITS;
static const uint32_t BLOB_SET_ID = REQ_BLOB_PARAMS;
/** Max size of unencoded frame */
static const size_t MAX_FRAME_SIZE = 1200;
@ -278,6 +325,9 @@ static const uint8_t DOWNLOAD_CENTROID_SET_ENTRIES = 11;
static const uint8_t DOWNLOAD_MATCHED_STAR_SET_ENTRIES = 14;
static const uint8_t DOWNLOAD_DBIMAGE_SET_ENTRIES = 6;
static const uint8_t DOWNLOAD_BLOBPIXEL_SET_ENTRIES = 7;
static const uint8_t CAMERA_SET_ENTRIES = 15;
static const uint8_t LIMITS_SET_ENTRIES = 11;
static const uint8_t BLOB_SET_ENTRIES = 15;
// Action, parameter and telemetry IDs
namespace ID {
@ -373,7 +423,7 @@ class VersionSet : public StaticLocalDataSet<VERSION_SET_ENTRIES> {
void printSet() {
PoolReadGuard rg(this);
sif::info << "VersionSet::printSet: Ticks: " << this->ticks << std::endl;
sif::info << "VersionSet::printSet: Ticks: " << std::dec << this->ticks << std::endl;
sif::info << "VersionSet::printSet: Unix Time: " << this->time << " us" << std::endl;
sif::info << "VersionSet::printSet: Program: " << static_cast<unsigned int>(this->program.value)
<< std::endl;
@ -872,7 +922,7 @@ class ChecksumSet : public StaticLocalDataSet<CHECKSUM_SET_ENTRIES> {
class DownloadCentroidSet : public StaticLocalDataSet<DOWNLOAD_CENTROID_SET_ENTRIES> {
public:
// Size of dataset
static const size_t SIZE = 34;
static const size_t SIZE = 38;
DownloadCentroidSet(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, DOWNLOADCENTROID_SET_ID) {}
@ -894,18 +944,18 @@ class DownloadCentroidSet : public StaticLocalDataSet<DOWNLOAD_CENTROID_SET_ENTR
void printSet() {
PoolReadGuard rg(this);
sif::info << "ContrastSet::printSet: id: " << static_cast<unsigned int>(this->id.value)
sif::info << "DownloadCentroidSet::printSet: id: " << static_cast<unsigned int>(this->id.value)
<< std::endl;
sif::info << "ContrastSet::printSet: pixx: " << this->pixx << std::endl;
sif::info << "ContrastSet::printSet: pixy: " << this->pixy << std::endl;
sif::info << "ContrastSet::printSet: xUncorrected: " << this->xUncorrected << std::endl;
sif::info << "ContrastSet::printSet: yUncorrected: " << this->yUncorrected << std::endl;
sif::info << "ContrastSet::printSet: xCorrected: " << this->xCorrected << std::endl;
sif::info << "ContrastSet::printSet: yCorrected: " << this->yCorrected << std::endl;
sif::info << "ContrastSet::printSet: magnitude: " << this->magnitude << std::endl;
sif::info << "ContrastSet::printSet: cxa: " << this->cxa << std::endl;
sif::info << "ContrastSet::printSet: cya: " << this->cya << std::endl;
sif::info << "ContrastSet::printSet: quality: " << this->quality << std::endl;
sif::info << "DownloadCentroidSet::printSet: pixx: " << this->pixx << std::endl;
sif::info << "DownloadCentroidSet::printSet: pixy: " << this->pixy << std::endl;
sif::info << "DownloadCentroidSet::printSet: xUncorrected: " << this->xUncorrected << std::endl;
sif::info << "DownloadCentroidSet::printSet: yUncorrected: " << this->yUncorrected << std::endl;
sif::info << "DownloadCentroidSet::printSet: xCorrected: " << this->xCorrected << std::endl;
sif::info << "DownloadCentroidSet::printSet: yCorrected: " << this->yCorrected << std::endl;
sif::info << "DownloadCentroidSet::printSet: magnitude: " << this->magnitude << std::endl;
sif::info << "DownloadCentroidSet::printSet: cxa: " << this->cxa << std::endl;
sif::info << "DownloadCentroidSet::printSet: cya: " << this->cya << std::endl;
sif::info << "DownloadCentroidSet::printSet: quality: " << this->quality << std::endl;
}
};
@ -1044,5 +1094,180 @@ class DownloadBlobPixel : public StaticLocalDataSet<DOWNLOAD_BLOBPIXEL_SET_ENTRI
sif::info << "DownloadBlobPixel::printSet: region: " << this->region << std::endl;
}
};
/**
* @brief Will store the camera parameters set in the star tracker which are retrieved with
* a get parameter request.
*/
class CameraSet : public StaticLocalDataSet<CAMERA_SET_ENTRIES> {
public:
// Size of dataset
static const size_t SIZE = 25;
CameraSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, CAMERA_SET_ID) {}
CameraSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, CAMERA_SET_ID)) {}
lp_var_t<uint8_t> mode = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAMERA_MODE, this);
lp_var_t<float> focallength = lp_var_t<float>(sid.objectId, PoolIds::FOCALLENGTH, this);
lp_var_t<float> exposure = lp_var_t<float>(sid.objectId, PoolIds::EXPOSURE, this);
lp_var_t<float> interval = lp_var_t<float>(sid.objectId, PoolIds::INTERVAL, this);
lp_var_t<int16_t> offset = lp_var_t<int16_t>(sid.objectId, PoolIds::CAMERA_OFFSET, this);
lp_var_t<uint8_t> pgagain = lp_var_t<uint8_t>(sid.objectId, PoolIds::PGAGAIN, this);
lp_var_t<uint8_t> adcgain = lp_var_t<uint8_t>(sid.objectId, PoolIds::ADCGAIN, this);
lp_var_t<uint8_t> reg1 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_REG1, this);
lp_var_t<uint8_t> val1 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_VAL1, this);
lp_var_t<uint8_t> reg2 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_REG2, this);
lp_var_t<uint8_t> val2 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_VAL2, this);
lp_var_t<uint8_t> reg3 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_REG3, this);
lp_var_t<uint8_t> val3 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_VAL3, this);
lp_var_t<uint8_t> reg4 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_REG4, this);
lp_var_t<uint8_t> val4 = lp_var_t<uint8_t>(sid.objectId, PoolIds::CAM_VAL4, this);
void printSet() {
PoolReadGuard rg(this);
sif::info << "CameraSet::printSet: mode: " << static_cast<unsigned int>(this->mode.value)
<< std::endl;
sif::info << "CameraSet::printSet: focallength: " << this->focallength << std::endl;
sif::info << "CameraSet::printSet: exposure: " << this->exposure << std::endl;
sif::info << "CameraSet::printSet: interval: " << this->interval << std::endl;
sif::info << "CameraSet::printSet: offset: " << this->offset << std::endl;
sif::info << "CameraSet::printSet: PGA gain: " << static_cast<unsigned int>(this->pgagain.value)
<< std::endl;
sif::info << "CameraSet::printSet: ADC gain: " << static_cast<unsigned int>(this->adcgain.value)
<< std::endl;
sif::info << "CameraSet::printSet: Reg 1: " << static_cast<unsigned int>(this->reg1.value)
<< std::endl;
sif::info << "CameraSet::printSet: Val 1: " << static_cast<unsigned int>(this->val1.value)
<< std::endl;
sif::info << "CameraSet::printSet: Reg 2: " << static_cast<unsigned int>(this->reg2.value)
<< std::endl;
sif::info << "CameraSet::printSet: Val 2: " << static_cast<unsigned int>(this->val2.value)
<< std::endl;
sif::info << "CameraSet::printSet: Reg 3: " << static_cast<unsigned int>(this->reg3.value)
<< std::endl;
sif::info << "CameraSet::printSet: Val 3: " << static_cast<unsigned int>(this->val3.value)
<< std::endl;
sif::info << "CameraSet::printSet: Reg 4: " << static_cast<unsigned int>(this->reg4.value)
<< std::endl;
sif::info << "CameraSet::printSet: Val 4: " << static_cast<unsigned int>(this->val4.value)
<< std::endl;
}
};
/**
* @brief Will store the requested limits
*/
class LimitsSet : public StaticLocalDataSet<LIMITS_SET_ENTRIES> {
public:
// Size of dataset
static const size_t SIZE = 41;
LimitsSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LIMITS_SET_ID) {}
LimitsSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LIMITS_SET_ID)) {}
lp_var_t<uint8_t> action = lp_var_t<uint8_t>(sid.objectId, PoolIds::LIMITS_ACTION, this);
lp_var_t<float> fpga18current =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_FPGA18CURRENT, this);
lp_var_t<float> fpga25current =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_FPGA25CURRENT, this);
lp_var_t<float> fpga10current =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_FPGA10CURRENT, this);
lp_var_t<float> mcuCurrent = lp_var_t<float>(sid.objectId, PoolIds::LIMITS_MCUCURRENT, this);
lp_var_t<float> cmos21current =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_CMOS21CURRENT, this);
lp_var_t<float> cmosPixCurrent =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_CMOSPIXCURRENT, this);
lp_var_t<float> cmos33current =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_CMOS33CURRENT, this);
lp_var_t<float> cmosVresCurrent =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_CMOSVRESCURRENT, this);
lp_var_t<float> cmosTemperature =
lp_var_t<float>(sid.objectId, PoolIds::LIMITS_CMOSTEMPERATURE, this);
void printSet() {
PoolReadGuard rg(this);
sif::info << "CameraSet::printSet: action: " << static_cast<unsigned int>(this->action.value)
<< std::endl;
sif::info << "CameraSet::printSet: FPGA18Current: " << this->fpga18current << std::endl;
sif::info << "CameraSet::printSet: FPGA25Current: " << this->fpga25current << std::endl;
sif::info << "CameraSet::printSet: FPGA10Current: " << this->fpga10current << std::endl;
sif::info << "CameraSet::printSet: MCUCurrent: " << this->mcuCurrent << std::endl;
sif::info << "CameraSet::printSet: CMOS21Current: " << this->cmos21current << std::endl;
sif::info << "CameraSet::printSet: CMOSPixCurrent: " << this->cmosPixCurrent << std::endl;
sif::info << "CameraSet::printSet: CMOS33Current: " << this->cmos33current << std::endl;
sif::info << "CameraSet::printSet: CMOSVResCurrent: " << this->cmosVresCurrent << std::endl;
sif::info << "CameraSet::printSet: CMOSTemperature: " << this->cmosTemperature << std::endl;
}
};
/**
* @brief Will store the request of the blob parameters.
*/
class BlobSet : public StaticLocalDataSet<BLOB_SET_ENTRIES> {
public:
// Size of dataset
static const size_t SIZE = 22;
BlobSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BLOB_SET_ID) {}
BlobSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, BLOB_SET_ID)) {}
lp_var_t<uint8_t> mode = lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_MODE, this);
lp_var_t<uint8_t> minValue = lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_MIN_VALUE, this);
lp_var_t<uint8_t> minDistance = lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_MIN_DISTANCE, this);
lp_var_t<uint8_t> neighbourDistance =
lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_NEIGHBOUR_DISTANCE, this);
lp_var_t<uint8_t> neighbourBrightPixels =
lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_NEIGHBOUR_BRIGHTPIXELS, this);
lp_var_t<uint16_t> minTotalValue =
lp_var_t<uint16_t>(sid.objectId, PoolIds::BLOB_MIN_TOTAL_VALUE, this);
lp_var_t<uint16_t> maxTotalValue =
lp_var_t<uint16_t>(sid.objectId, PoolIds::BLOB_MAX_TOTAL_VALUE, this);
lp_var_t<uint16_t> minBrightNeighbours =
lp_var_t<uint16_t>(sid.objectId, PoolIds::BLOB_MIN_BRIGHT_NEIGHBOURS, this);
lp_var_t<uint16_t> maxBrightNeighbours =
lp_var_t<uint16_t>(sid.objectId, PoolIds::BLOB_MAX_BRIGHT_NEIGHBOURS, this);
lp_var_t<uint32_t> maxPixelsToConsider =
lp_var_t<uint32_t>(sid.objectId, PoolIds::BLOB_MAX_PIXELSTOCONSIDER, this);
lp_var_t<uint8_t> signalThreshold =
lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_SIGNAL_THRESHOLD, this);
lp_var_t<uint8_t> darkThreshold =
lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_DARK_THRESHOLD, this);
lp_var_t<uint8_t> enableContrast =
lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_ENABLE_CONTRAST, this);
lp_var_t<uint8_t> enableBinMode = lp_var_t<uint8_t>(sid.objectId, PoolIds::BLOB_BIN_MODE, this);
void printSet() {
PoolReadGuard rg(this);
sif::info << "BlobSet::printSet: mode: " << static_cast<unsigned int>(this->mode.value)
<< std::endl;
sif::info << "BlobSet::printSet: minValue: " << static_cast<unsigned int>(this->minValue.value)
<< std::endl;
sif::info << "BlobSet::printSet: minDistance: "
<< static_cast<unsigned int>(this->minDistance.value) << std::endl;
sif::info << "BlobSet::printSet: neighboutDistance: "
<< static_cast<unsigned int>(this->neighbourDistance.value) << std::endl;
sif::info << "BlobSet::printSet: neighboutBrightPixels: "
<< static_cast<unsigned int>(this->neighbourBrightPixels.value) << std::endl;
sif::info << "BlobSet::printSet: minTotalValue: " << this->minTotalValue << std::endl;
sif::info << "BlobSet::printSet: maxTotalValue: " << this->maxTotalValue << std::endl;
sif::info << "BlobSet::printSet: minBrightNeighbours: " << this->minBrightNeighbours
<< std::endl;
sif::info << "BlobSet::printSet: maxBrightNeighbours: " << this->maxBrightNeighbours
<< std::endl;
sif::info << "BlobSet::printSet: maxPixelsToConsider: " << this->maxPixelsToConsider
<< std::endl;
sif::info << "BlobSet::printSet: signalThreshold: "
<< static_cast<unsigned int>(this->signalThreshold.value) << std::endl;
sif::info << "BlobSet::printSet: darkThreshold: "
<< static_cast<unsigned int>(this->darkThreshold.value) << std::endl;
sif::info << "BlobSet::printSet: enableContrast: "
<< static_cast<unsigned int>(this->enableContrast.value) << std::endl;
sif::info << "BlobSet::printSet: enableBinMode: "
<< static_cast<unsigned int>(this->enableBinMode.value) << std::endl;
}
};
} // namespace StarTracker
#endif /* MISSION_STARTRACKER_DEFINITIONS_H_ */

View File

@ -10,6 +10,7 @@
#include "StarTrackerJsonCommands.h"
extern "C" {
#include <thirdparty/arcsec_star_tracker/client/generated/actionreq.h>
#include <thirdparty/arcsec_star_tracker/client/generated/parameter.h>
#include <thirdparty/arcsec_star_tracker/client/generated/telemetry.h>
#include "common/misc.h"
@ -33,6 +34,9 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
downloadMatchedStar(this),
downloadDbImage(this),
downloadBlobPixel(this),
cameraSet(this),
limitsSet(this),
blobSet(this),
strHelper(strHelper) {
if (comCookie == nullptr) {
sif::error << "StarTrackerHandler: Invalid com cookie" << std::endl;
@ -504,6 +508,18 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
result = prepareFpgaActionCommand(commandData, commandDataLen);
return result;
}
case (StarTracker::REQ_CAMERA): {
result = prepareRequestCameraParams();
return result;
}
case (StarTracker::REQ_LIMITS): {
result = prepareRequestLimitsParams();
return result;
}
case (StarTracker::REQ_BLOB_PARAMS): {
result = prepareRequestBlobParams();
return result;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
@ -582,6 +598,12 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::FPGA_ACTION, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_CAMERA, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_LIMITS, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_BLOB_PARAMS, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
}
ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize,
@ -612,7 +634,12 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
}
case TMTC_SETPARAMREPLY: {
*foundLen = remainingSize - bytesLeft;
result = scanForParameterReply(foundId);
result = scanForSetParameterReply(foundId);
break;
}
case TMTC_PARAMREPLY: {
*foundLen = remainingSize - bytesLeft;
result = scanForGetParameterReply(foundId);
break;
}
case TMTC_TELEMETRYREPLYA:
@ -734,6 +761,18 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
result = handleSetParamReply();
break;
}
case (StarTracker::REQ_CAMERA): {
handleParamRequest(cameraSet, StarTracker::CameraSet::SIZE);
break;
}
case (StarTracker::REQ_LIMITS): {
handleParamRequest(limitsSet, StarTracker::LimitsSet::SIZE);
break;
}
case (StarTracker::REQ_BLOB_PARAMS): {
handleParamRequest(blobSet, StarTracker::BlobSet::SIZE);
break;
}
default: {
sif::debug << "StarTrackerHandler::interpretDeviceReply: Unknown device reply id:" << id
<< std::endl;
@ -936,6 +975,50 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l
localDataPoolMap.emplace(StarTracker::BLOBPIX_IN_USE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOBPIX_BRIGHT_NEIGHBOURS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOBPIX_REGION, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(StarTracker::CAMERA_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::FOCALLENGTH, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::EXPOSURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::INTERVAL, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::CAMERA_OFFSET, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(StarTracker::PGAGAIN, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::ADCGAIN, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_REG1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_VAL1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_REG2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_VAL2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_REG3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_VAL3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_REG4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::CAM_VAL4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_ACTION, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_FPGA18CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_FPGA25CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_FPGA10CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_MCUCURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOS21CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOSPIXCURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOS33CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOSVRESCURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOSTEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_VALUE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_DISTANCE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_DISTANCE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_BRIGHTPIXELS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_BRIGHTPIXELS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_TOTAL_VALUE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MAX_TOTAL_VALUE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_BRIGHT_NEIGHBOURS, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MAX_BRIGHT_NEIGHBOURS, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_MAX_PIXELSTOCONSIDER, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_SIGNAL_THRESHOLD, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_DARK_THRESHOLD, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_ENABLE_HISTOGRAM, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_ENABLE_CONTRAST, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::BLOB_BIN_MODE, new PoolEntry<uint8_t>({0}));
return RETURN_OK;
}
@ -1038,7 +1121,7 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId)
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::scanForParameterReply(DeviceCommandId_t* foundId) {
ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* foundId) {
const uint8_t* reply = dataLinkLayer.getReply();
switch (*reply) {
case (StarTracker::ID::SUBSCRIBE): {
@ -1093,6 +1176,30 @@ ReturnValue_t StarTrackerHandler::scanForParameterReply(DeviceCommandId_t* found
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* foundId) {
const uint8_t* reply = dataLinkLayer.getReply();
switch (*reply) {
case (StarTracker::ID::CAMERA): {
*foundId = StarTracker::REQ_CAMERA;
break;
}
case (StarTracker::ID::LIMITS): {
*foundId = StarTracker::REQ_LIMITS;
break;
}
case (StarTracker::ID::BLOB): {
*foundId = StarTracker::REQ_BLOB_PARAMS;
break;
}
default: {
sif::warning << "tarTrackerHandler::scanForGetParameterReply: UnkNown ID" << std::endl;
return RETURN_FAILED;
break;
}
}
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) {
const uint8_t* reply = dataLinkLayer.getReply();
switch (*reply) {
@ -1701,6 +1808,33 @@ ReturnValue_t StarTrackerHandler::prepareFpgaActionCommand(const uint8_t* comman
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
uint32_t length = 0;
arc_pack_camera_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
uint32_t length = 0;
arc_pack_limits_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestBlobParams() {
uint32_t length = 0;
arc_pack_blob_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::handleSetParamReply() {
const uint8_t* reply = dataLinkLayer.getReply();
uint8_t status = *(reply + STATUS_OFFSET);
@ -1789,6 +1923,30 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() {
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::handleParamRequest(LocalPoolDataSetBase& dataset, size_t size) {
ReturnValue_t result = RETURN_OK;
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
return result;
}
const uint8_t* reply = dataLinkLayer.getReply() + PARAMS_OFFSET;
dataset.setValidityBufferGeneration(false);
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::handleParamRequest Deserialization failed" << std::endl;
}
dataset.setValidityBufferGeneration(true);
dataset.setValidity(true, true);
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
return result;
}
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
dataset.printSet();
#endif
return result;
}
ReturnValue_t StarTrackerHandler::handlePingReply() {
ReturnValue_t result = RETURN_OK;
uint32_t pingId = 0;

View File

@ -141,6 +141,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
// Max valid position value in upload image command
static const uint16_t MAX_POSITION = 4095;
static const uint8_t STATUS_OFFSET = 1;
static const uint8_t PARAMS_OFFSET = 1;
static const uint8_t TICKS_OFFSET = 2;
static const uint8_t TIME_OFFSET = 6;
static const uint8_t TM_DATA_FIELD_OFFSET = 14;
@ -259,6 +260,9 @@ class StarTrackerHandler : public DeviceHandlerBase {
StarTracker::DownloadMatchedStar downloadMatchedStar;
StarTracker::DownloadDBImage downloadDbImage;
StarTracker::DownloadBlobPixel downloadBlobPixel;
StarTracker::CameraSet cameraSet;
StarTracker::LimitsSet limitsSet;
StarTracker::BlobSet blobSet;
// Pointer to object responsible for uploading and downloading images to/from the star tracker
StrHelper* strHelper = nullptr;
@ -315,7 +319,8 @@ class StarTrackerHandler : public DeviceHandlerBase {
void slipInit();
ReturnValue_t scanForActionReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForParameterReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForSetParameterReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForGetParameterReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForTmReply(DeviceCommandId_t* foundId);
/**
@ -487,6 +492,21 @@ class StarTrackerHandler : public DeviceHandlerBase {
*/
ReturnValue_t prepareFpgaActionCommand(const uint8_t* commandData, size_t commandDataLen);
/**
* @brief Will fill the command buffer with the command to request the set camera parameters.
*/
ReturnValue_t prepareRequestCameraParams();
/**
* @brief Will fill the command buffer with the command to request the set limits.
*/
ReturnValue_t prepareRequestLimitsParams();
/**
* @brief Will fill the command buffer with the command to request the set blob parameters.
*/
ReturnValue_t prepareRequestBlobParams();
/**
* @brief Handles action replies with datasets.
*/
@ -519,6 +539,8 @@ class StarTrackerHandler : public DeviceHandlerBase {
ReturnValue_t handlePingReply();
ReturnValue_t handleParamRequest(LocalPoolDataSetBase& dataset, size_t size);
/**
* @brief Checks the loaded program by means of the version set
*/

View File

@ -114,7 +114,7 @@ ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
if (not std::filesystem::exists(fullname)) {
return FILE_NOT_EXISTS;
}
internalState = InternalState::UPLOAD_FPGA_IMAGE;
internalState = InternalState::UPLOAD_IMAGE;
semaphore.release();
terminate = false;
return RETURN_OK;