Merge remote-tracking branch 'upstream/master' into mueller_FixedSequenceImprovements
This commit is contained in:
commit
24441809a9
@ -7,14 +7,8 @@ FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
FixedSlotSequence::~FixedSlotSequence() {
|
FixedSlotSequence::~FixedSlotSequence() {
|
||||||
// This should call the destructor on each list entry.
|
// Call the destructor on each list entry.
|
||||||
slotList.clear();
|
slotList.clear();
|
||||||
// SlotListIter slotListIter = this->slotList.begin();
|
|
||||||
// //Iterate through slotList and delete all entries.
|
|
||||||
// while (slotListIter != this->slotList.end()) {
|
|
||||||
// delete (*slotIt);
|
|
||||||
// slotIt++;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedSlotSequence::executeAndAdvance() {
|
void FixedSlotSequence::executeAndAdvance() {
|
||||||
@ -87,8 +81,11 @@ uint32_t FixedSlotSequence::getLengthMs() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FixedSlotSequence::checkSequence() const {
|
ReturnValue_t FixedSlotSequence::checkSequence() const {
|
||||||
// Iterate through slotList and check successful creation.
|
if(slotList.empty()) {
|
||||||
// Checks if timing is ok (must be ascending) and if all handlers were found.
|
error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
auto slotIt = slotList.begin();
|
auto slotIt = slotList.begin();
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
uint32_t time = 0;
|
uint32_t time = 0;
|
||||||
|
@ -12,13 +12,19 @@ using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
|
|||||||
/**
|
/**
|
||||||
* @brief This class is the representation of a Polling Sequence Table in software.
|
* @brief This class is the representation of a Polling Sequence Table in software.
|
||||||
*
|
*
|
||||||
* @details The FixedSlotSequence object maintains the dynamic execution of device handler objects.
|
* @details
|
||||||
* The main idea is to create a list of device handlers, to announce all handlers to the
|
* The FixedSlotSequence object maintains the dynamic execution of
|
||||||
* polling sequence and to maintain a list of polling slot objects. This slot list represents the
|
* device handler objects.
|
||||||
* Polling Sequence Table in software. Each polling slot contains information to indicate when and
|
*
|
||||||
* which device handler shall be executed within a given polling period.
|
* The main idea is to create a list of device handlers, to announce all
|
||||||
* The sequence is then executed by iterating through this slot list.
|
* handlers to thepolling sequence and to maintain a list of
|
||||||
* Handlers are invoking by calling a certain function stored in the handler list.
|
* polling slot objects. This slot list represents the Polling Sequence Table
|
||||||
|
* in software.
|
||||||
|
*
|
||||||
|
* Each polling slot contains information to indicate when and
|
||||||
|
* which device handler shall be executed within a given polling period.
|
||||||
|
* The sequence is then executed by iterating through this slot list.
|
||||||
|
* Handlers are invoking by calling a certain function stored in the handler list.
|
||||||
*/
|
*/
|
||||||
class FixedSlotSequence {
|
class FixedSlotSequence {
|
||||||
public:
|
public:
|
||||||
@ -111,7 +117,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
SlotListIter current;
|
SlotListIter current;
|
||||||
|
|
||||||
virtual ReturnValue_t checkSequence() const;
|
/**
|
||||||
|
* Iterate through slotList and check successful creation.
|
||||||
|
* Checks if timing is ok (must be ascending) and if all handlers were found.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkSequence() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,18 +57,19 @@ ReturnValue_t FixedTimeslotTask::startTask() {
|
|||||||
|
|
||||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||||
uint32_t slotTimeMs, int8_t executionStep) {
|
uint32_t slotTimeMs, int8_t executionStep) {
|
||||||
if (objectManager->get<ExecutableObjectIF>(componentId) != NULL) {
|
|
||||||
|
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||||
if(slotTimeMs == 0) {
|
if(slotTimeMs == 0) {
|
||||||
// TODO: FreeRTOS throws errors for zero values.
|
// FreeRTOS throws a sanity error for zero values, so we set
|
||||||
// maybe there is a better solution than this.
|
// the time to one millisecond.
|
||||||
slotTimeMs = 1;
|
slotTimeMs = 1;
|
||||||
}
|
}
|
||||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error << "Component " << std::hex << componentId
|
error << "Component " << std::hex << componentId <<
|
||||||
<< " not found, not adding it to pst" << std::endl;
|
" not found, not adding it to pst" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,14 @@ uint32_t FixedTimeslotTask::getPeriodMs() const {
|
|||||||
|
|
||||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||||
uint32_t slotTimeMs, int8_t executionStep) {
|
uint32_t slotTimeMs, int8_t executionStep) {
|
||||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
error << "Component " << std::hex << componentId <<
|
||||||
|
" not found, not adding it to pst" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FixedTimeslotTask::checkSequence() const {
|
ReturnValue_t FixedTimeslotTask::checkSequence() const {
|
||||||
|
@ -66,10 +66,16 @@ ReturnValue_t PollingTask::startTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PollingTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
ReturnValue_t PollingTask::addSlot(object_id_t componentId,
|
||||||
int8_t executionStep) {
|
uint32_t slotTimeMs, int8_t executionStep) {
|
||||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
error << "Component " << std::hex << componentId <<
|
||||||
|
" not found, not adding it to pst" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t PollingTask::getPeriodMs() const {
|
uint32_t PollingTask::getPeriodMs() const {
|
||||||
|
@ -91,7 +91,7 @@ template<typename T>
|
|||||||
ReturnValue_t ParameterWrapper::serializeData(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t ParameterWrapper::serializeData(uint8_t** buffer, uint32_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
const uint32_t max_size, bool bigEndian) const {
|
||||||
const T *element = (const T*) readonlyData;
|
const T *element = (const T*) readonlyData;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
uint16_t dataSize = columns * rows;
|
uint16_t dataSize = columns * rows;
|
||||||
while (dataSize != 0) {
|
while (dataSize != 0) {
|
||||||
result = SerializeAdapter<T>::serialize(element, buffer, size, max_size,
|
result = SerializeAdapter<T>::serialize(element, buffer, size, max_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user