Commit 381774a3 authored by legoc's avatar legoc
Browse files

Updated AxisRecorder with special Figaro axis.

parent 0a10cb49
......@@ -18,8 +18,10 @@
#include "AxisRecorder.h"
#include "controllers/common/family/Families.h"
#include "controllers/common/axis/AxisController.h"
#include "ics/InstrumentManager/InstrumentManager.h"
#include "controllers/common/axis/AxisController.h"
#include "controllers/lss/figaro/DetA.h"
#include "controllers/lss/figaro/DetH.h"
namespace axis {
......@@ -49,23 +51,53 @@ void AxisRecorder::postConfiguration() {
m_experimentControllersMap = InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap();
map<string, ExperimentController*>::iterator it;
for (it = m_experimentControllersMap.begin(); it != m_experimentControllersMap.end(); it++) {
// AxisController
if (dynamic_cast<axis::AxisController*>(it->second) != 0) {
axis::AxisController* controller = dynamic_cast<axis::AxisController*>(it->second);
controller->attach(this);
registerUpdater(controller->position, &AxisRecorder::updateActualPosition, this, controller->getName());
}
}
// DetA
else if (dynamic_cast<figaro::DetA*>(it->second) != 0) {
figaro::DetA* controller = dynamic_cast<figaro::DetA*>(it->second);
controller->attach(this);
registerUpdater(controller->angle, &AxisRecorder::updateActualPosition, this, controller->getName());
}
// DetH
else if (dynamic_cast<figaro::DetH*>(it->second) != 0) {
figaro::DetH* controller = dynamic_cast<figaro::DetH*>(it->second);
controller->attach(this);
registerUpdater(controller->height, &AxisRecorder::updateActualPosition, this, controller->getName());
}
}
}
void AxisRecorder::updateActualPosition(const std::string& controllerName) {
common::Date now;
if (*m_dataFile) {
(*m_dataFile) << (now.getTimeUs() - m_initialDate) << ", " << controllerName << ", " << dynamic_cast<axis::AxisController*>(m_experimentControllersMap[controllerName])->position() << endl;
// AxisController
if (dynamic_cast<axis::AxisController*>(m_experimentControllersMap[controllerName]) != 0) {
axis::AxisController* controller = dynamic_cast<axis::AxisController*>(m_experimentControllersMap[controllerName]);
(*m_dataFile) << (now.getTimeUs() - m_initialDate) << ", " << controllerName << ", " << controller->position() << endl;
}
// DetA
else if (dynamic_cast<figaro::DetA*>(m_experimentControllersMap[controllerName]) != 0) {
figaro::DetA* controller = dynamic_cast<figaro::DetA*>(m_experimentControllersMap[controllerName]);
(*m_dataFile) << (now.getTimeUs() - m_initialDate) << ", " << controllerName << ", " << controller->angle() << endl;
}
// DetH
else if (dynamic_cast<figaro::DetH*>(m_experimentControllersMap[controllerName]) != 0) {
figaro::DetH* controller = dynamic_cast<figaro::DetH*>(m_experimentControllersMap[controllerName]);
(*m_dataFile) << (now.getTimeUs() - m_initialDate) << ", " << controllerName << ", " << controller->height() << endl;
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment