The printing of the sensor data has been commented out. Errors in the device handler and controller tasks.
This commit is contained in:
parent
d857487d17
commit
2ce14d84f0
@ -103,13 +103,12 @@ void InitMission::createTasks(){
|
|||||||
|
|
||||||
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->
|
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->
|
||||||
createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||||
1.6, nullptr);
|
4, nullptr);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
sif::debug << "debug1: arduino tasks" << std::endl;
|
|
||||||
FixedTimeslotTaskIF* arduinoTask = TaskFactory::instance()->
|
FixedTimeslotTaskIF* arduinoTask = TaskFactory::instance()->
|
||||||
createFixedTimeslotTask("ARDUINO_TASK",40,
|
createFixedTimeslotTask("ARDUINO_TASK",40,
|
||||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2, nullptr);
|
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2, nullptr);
|
||||||
@ -119,16 +118,15 @@ void InitMission::createTasks(){
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
sif::debug << "debug2: arduino tasks" << std::endl;
|
PeriodicTaskIF* controllerTask = TaskFactory::instance()->
|
||||||
FixedTimeslotTaskIF* controllerTask = TaskFactory::instance()->
|
createPeriodicTask("CONTROLLER_TASK",40,
|
||||||
createFixedTimeslotTask("CONTROLLER_TASK",40,
|
PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, nullptr);
|
||||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 3, nullptr);
|
//result = pollingSequenceControllerFunction(controllerTask);
|
||||||
result = pollingSequenceControllerFunction(controllerTask);
|
result = controllerTask->addComponent(objects::THERMAL_CONTROLLER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::createTasks:ArduinoController initialization failed!"
|
sif::error << "InitMission::createTasks:ArduinoController initialization failed!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
sif::debug << "debug3: arduino tasks" << std::endl;
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->
|
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->
|
||||||
@ -158,10 +156,8 @@ void InitMission::createTasks(){
|
|||||||
udpBridgeTask->startTask();
|
udpBridgeTask->startTask();
|
||||||
udpPollingTask->startTask();
|
udpPollingTask->startTask();
|
||||||
//serializeTask->startTask();
|
//serializeTask->startTask();
|
||||||
arduinoTask->startTask();
|
//arduinoTask->startTask();
|
||||||
sif::debug << "debug4: arduino tasks" << std::endl;
|
|
||||||
controllerTask->startTask();
|
controllerTask->startTask();
|
||||||
sif::debug << "debug5: arduino tasks" << std::endl;
|
|
||||||
|
|
||||||
//payloadTask->startTask();
|
//payloadTask->startTask();
|
||||||
eventTask->startTask();
|
eventTask->startTask();
|
||||||
|
@ -39,11 +39,8 @@ int main() {
|
|||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
objectManager = new ObjectManager(ObjectFactory::produce);
|
objectManager = new ObjectManager(ObjectFactory::produce);
|
||||||
sif::debug << "debug_MAIN: object produced" << std::endl;
|
|
||||||
objectManager->initialize();
|
objectManager->initialize();
|
||||||
sif::debug << "debug_MAIN: object initialized" << std::endl;
|
|
||||||
InitMission::createTasks();
|
InitMission::createTasks();
|
||||||
sif::debug << "debug_MAIN: tasks created" << std::endl;
|
|
||||||
//MutexExample::example();
|
//MutexExample::example();
|
||||||
PusPacketCreator::createPusPacketAndPrint();
|
PusPacketCreator::createPusPacketAndPrint();
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ void ArduinoTCSTemperatureSensor::doChildOperation() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
outputTemperature = calculateOutputTemperature(*inputTemperature);
|
outputTemperature = calculateOutputTemperature(*inputTemperature);
|
||||||
outputTemperature.setValid(PoolVariableIF::VALID);
|
|
||||||
if (outputTemperature<parameters.lowerLimit || outputTemperature>parameters.upperLimit){
|
if (outputTemperature<parameters.lowerLimit || outputTemperature>parameters.upperLimit){
|
||||||
outputTemperature.setValid(PoolVariableIF::INVALID);
|
outputTemperature.setValid(PoolVariableIF::INVALID);
|
||||||
outputTemperature = INVALID_TEMPERATURE;
|
outputTemperature = INVALID_TEMPERATURE;
|
||||||
|
@ -40,8 +40,6 @@ ThermalController::~ThermalController() {
|
|||||||
|
|
||||||
ReturnValue_t ThermalController::initialize() {
|
ReturnValue_t ThermalController::initialize() {
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_TCS: Controller starts initialization. "<<std::endl;
|
|
||||||
|
|
||||||
ReturnValue_t result = ControllerBase::initialize();
|
ReturnValue_t result = ControllerBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -65,7 +63,7 @@ ReturnValue_t ThermalController::initialize() {
|
|||||||
}*/
|
}*/
|
||||||
/* ************************ */
|
/* ************************ */
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_TCS: Controller ends initialization. "<<std::endl;
|
sif::debug<<"\nDEBUG_TCS: Start initialization"<<std::endl;
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -88,6 +86,7 @@ ReturnValue_t ThermalController::handleCommandMessage(CommandMessage *message) {
|
|||||||
ReturnValue_t ThermalController::performOperation() {
|
ReturnValue_t ThermalController::performOperation() {
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_TCS: Start of controller operations"<<std::endl;
|
sif::debug<<"\nDEBUG_TCS: Start of controller operations"<<std::endl;
|
||||||
|
std::cout << "\nDEBUG_TCS: Start of controller operations" << std::endl;
|
||||||
|
|
||||||
for (std::list<ArduinoTCSTemperatureSensor>::iterator iter = sensors.begin(); iter != sensors.end(); iter++) {
|
for (std::list<ArduinoTCSTemperatureSensor>::iterator iter = sensors.begin(); iter != sensors.end(); iter++) {
|
||||||
iter->performHealthOp();
|
iter->performHealthOp();
|
||||||
@ -105,14 +104,15 @@ ReturnValue_t ThermalController::performOperation() {
|
|||||||
}
|
}
|
||||||
TCSData.commit();
|
TCSData.commit();
|
||||||
|
|
||||||
TCSData.read();
|
TCSData.read(); // ?check the read, separate dataset
|
||||||
//calculateStrategy(true, true);
|
//calculateStrategy(true, true);
|
||||||
ThermalComponentIF::HeaterRequest request;
|
ThermalComponentIF::HeaterRequest request;
|
||||||
for (std::list<TCS_ThermalComponent>::iterator iter = components.begin(); iter != components.end(); iter++) {
|
for (std::list<TCS_ThermalComponent>::iterator iter = components.begin(); iter != components.end(); iter++) {
|
||||||
request = iter->performOperation(0, true, false);
|
request = iter->performOperation(0, true, false); // request returnvalue
|
||||||
//request = iter->performOperation(0, ThermalComponentIF::SAFE, true, false);
|
//request = iter->performOperation(0, ThermalComponentIF::SAFE, true, false);
|
||||||
}
|
}
|
||||||
TCSData.commit();
|
TCSData.commit();
|
||||||
|
std::cout << "\nDEBUG_TCS: End of controller operations" << std::endl;
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -101,25 +101,20 @@ ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
|||||||
|
|
||||||
Cookie->Serial_port_number = serial_port;
|
Cookie->Serial_port_number = serial_port;
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_COMIF: debug0-IF"<<std::endl;
|
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie,
|
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie,
|
||||||
const uint8_t *sendData, size_t sendLen) {
|
const uint8_t *sendData, size_t sendLen) {
|
||||||
sif::debug<<"\nDEBUG_COMIF: debug1-IF"<<std::endl;
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
||||||
sif::debug<<"\nDEBUG_COMIF: debug2-IF"<<std::endl;
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
||||||
size_t requestLen) {
|
size_t requestLen) {
|
||||||
sif::debug<<"\nDEBUG_COMIF: debug3-IF"<<std::endl;
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,8 +130,6 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
// At the end these 8 arrays are concatenated in
|
// At the end these 8 arrays are concatenated in
|
||||||
// the main buffer array read_buf.
|
// the main buffer array read_buf.
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_COMIF: start of copy received data in the buffer"<<std::endl;
|
|
||||||
|
|
||||||
uint8_t read_buf[2034]; // 2034 bytes from SPC serial output
|
uint8_t read_buf[2034]; // 2034 bytes from SPC serial output
|
||||||
uint8_t read_buf1[255]; // 255 bytes
|
uint8_t read_buf1[255]; // 255 bytes
|
||||||
uint8_t read_buf2[255]; // 255 bytes
|
uint8_t read_buf2[255]; // 255 bytes
|
||||||
|
@ -82,7 +82,7 @@ ReturnValue_t ArduinoDH::scanForReply(const uint8_t *start, size_t len,
|
|||||||
/* Unless a command was sent explicitely, we don't expect any replies and ignore
|
/* Unless a command was sent explicitely, we don't expect any replies and ignore
|
||||||
the packet. On a real device, there might be replies which are sent without a previous
|
the packet. On a real device, there might be replies which are sent without a previous
|
||||||
command. */
|
command. */
|
||||||
sif::debug<<"\nDEBUG_DH: scan for reply"<<std::endl;
|
//sif::debug<<"DEBUG_DH: scan for reply"<<std::endl;
|
||||||
/*if (not commandSent) {
|
/*if (not commandSent) {
|
||||||
sif::debug<<" DH: scan for reply2"<<std::endl;
|
sif::debug<<" DH: scan for reply2"<<std::endl;
|
||||||
return DeviceHandlerBase::IGNORE_FULL_PACKET;
|
return DeviceHandlerBase::IGNORE_FULL_PACKET;
|
||||||
@ -114,7 +114,7 @@ ReturnValue_t ArduinoDH::scanForReply(const uint8_t *start, size_t len,
|
|||||||
ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet) {
|
const uint8_t *packet) {
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_DH: interprete for reply"<<std::endl;
|
//sif::debug<<"DEBUG_DH: interprete for reply"<<std::endl;
|
||||||
// The data stored in the read buffer are here copied in the variables with the SPC format.
|
// The data stored in the read buffer are here copied in the variables with the SPC format.
|
||||||
// After copying, the data of temperature, environment and accelerometer are stored in three separated vectors.
|
// After copying, the data of temperature, environment and accelerometer are stored in three separated vectors.
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
|
|
||||||
// All data are here printed to monitor from the three vectors of data measurements.
|
// All data are here printed to monitor from the three vectors of data measurements.
|
||||||
|
|
||||||
printf(
|
/*printf(
|
||||||
"\n***********************************************************************************************\n");
|
"\n***********************************************************************************************\n");
|
||||||
printf("TEMPERATURE parameters are: ");
|
printf("TEMPERATURE parameters are: ");
|
||||||
|
|
||||||
@ -169,8 +169,8 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
printf("\nTemperature: %f", vecTemp[i].temperature);
|
printf("\nTemperature: %f", vecTemp[i].temperature);
|
||||||
printf("\nTimestamp: %u", vecTemp[i].Timestamp);
|
printf("\nTimestamp: %u", vecTemp[i].Timestamp);
|
||||||
printf("\nEnd: %7s", vecTemp[i].end_string);
|
printf("\nEnd: %7s", vecTemp[i].end_string);
|
||||||
}
|
}*/
|
||||||
printf(
|
/*printf(
|
||||||
"\n\n***********************************************************************************************\n");
|
"\n\n***********************************************************************************************\n");
|
||||||
printf("ENVIRONMENTAL parameters are: ");
|
printf("ENVIRONMENTAL parameters are: ");
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
printf("\nEnd: %7s", vecAcc[3 * k + 2].end_string);
|
printf("\nEnd: %7s", vecAcc[3 * k + 2].end_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\n\nEnd reading data.\n" << std::endl;
|
std::cout << "\n\nEnd reading data.\n" << std::endl;*/
|
||||||
|
|
||||||
// The data are here written to the data pool where they would be available to be used for other objects
|
// The data are here written to the data pool where they would be available to be used for other objects
|
||||||
|
|
||||||
@ -270,41 +270,49 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
|
|
||||||
PoolVector <float, 36> TempValueVec(datapool::Temperature_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
PoolVector <float, 36> TempValueVec(datapool::Temperature_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
||||||
for (int i = 0; i < 36; i++) {
|
for (int i = 0; i < 36; i++) {
|
||||||
memcpy(&TempValueVec, &vecTemp[27 * i + 11], 4);
|
memcpy(&TempValueVec[i], &vecTemp[27 * i + 11], 4);
|
||||||
}
|
}
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
|
||||||
|
/*
|
||||||
PoolVector <unsigned int, 36> TempTimeVec(datapool::Temperature_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
PoolVector <unsigned int, 36> TempTimeVec(datapool::Temperature_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
||||||
for (int i = 0; i < 36; i++) {
|
for (int i = 0; i < 36; i++) {
|
||||||
memcpy(&TempTimeVec, &vecTemp[27 * i + 15], 4);
|
memcpy(&TempTimeVec[i], &vecTemp[27 * i + 15], 4);
|
||||||
}
|
}
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
|
||||||
|
sif::debug<<"\nDEBUG_DHi: End of copy to datapool"<<std::endl;
|
||||||
|
|
||||||
PoolVector <float, 9> EnvValueVec(datapool::Environmental_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
PoolVector <float, 9> EnvValueVec(datapool::Environmental_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 9; j++) {
|
||||||
memcpy(&EnvValueVec, &vecEnv[27 * (36 + j) + 11], 4);
|
memcpy(&EnvValueVec[j], &vecEnv[27 * (36 + j) + 11], 4);
|
||||||
}
|
}
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
|
||||||
PoolVector <unsigned int, 9> EnvTimeVec(datapool::Environmental_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
PoolVector <unsigned int, 9> EnvTimeVec(datapool::Environmental_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 9; j++) {
|
||||||
memcpy(&EnvTimeVec, &vecEnv[27 * (36 + j) + 15], 4);
|
memcpy(&EnvTimeVec[j], &vecEnv[27 * (36 + j) + 15], 4);
|
||||||
}
|
}
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
|
||||||
|
sif::debug<<"\nDEBUG_DHj: End of copy to datapool"<<std::endl;
|
||||||
|
|
||||||
PoolVector <float, 15> AccValueVec(datapool::Accelerometer_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
PoolVector <float, 15> AccValueVec(datapool::Accelerometer_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
||||||
for (int k = 0; k < 15; k++) {
|
for (int k = 0; k < 15; k++) {
|
||||||
memcpy(&AccValueVec, &vecAcc[27 * (36 + 9) + 91 * k + 11], 36);
|
memcpy(&AccValueVec[k], &vecAcc[27 * (36 + 9) + 91 * k + 11], 36);
|
||||||
|
sif::debug<<"\nDEBUG_DHk1: End of copy to datapool"<<std::endl;
|
||||||
}
|
}
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
|
||||||
PoolVector <unsigned int, 15> AccTimeVec(datapool::Accelerometer_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
PoolVector <unsigned int, 15> AccTimeVec(datapool::Accelerometer_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
||||||
for (int k = 0; k < 15; k++) {
|
for (int k = 0; k < 15; k++) {
|
||||||
memcpy(&AccTimeVec, &vecAcc[27 * (36 + 9) + 91 * k + 47], 36);
|
memcpy(&AccTimeVec[k], &vecAcc[27 * (36 + 9) + 91 * k + 47], 36);
|
||||||
|
sif::debug<<"\nDEBUG_DHk2: End of copy to datapool"<<std::endl;
|
||||||
}
|
}
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
*/
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_DH: End of copy to datapool"<<std::endl;
|
//sif::debug<<"DEBUG_DH: End of copy to datapool"<<std::endl;
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user