Newer
Older
#include <ChimeraTK/ApplicationCore/ApplicationCore.h>
#include <ChimeraTK/ApplicationCore/PeriodicTrigger.h>
#include <ChimeraTK/ApplicationCore/EnableXMLGenerator.h>
namespace ctk = ChimeraTK;
struct Controller : public ctk::ApplicationModule {
using ctk::ApplicationModule::ApplicationModule;
ctk::ScalarPollInput<float> sp{this, "temperatureSetpoint", "degC", "Description"};
ctk::ScalarPushInput<float> rb{this, "temperatureReadback", "degC", "..."};
ctk::ScalarOutput<float> cur{this, "heatingCurrent", "mA", "..."};
readAll(); // waits until rb updated, then reads sp
cur = gain * (sp - rb);
writeAll(); // writes any outputs
};
struct ExampleApp : public ctk::Application {
Martin Killenberg
committed
ExampleApp() : Application("demoApp2") { ChimeraTK::setDMapFilePath("example2.dmap"); }
ctk::PeriodicTrigger timer{this, "Timer", "Periodic timer for the controller", 1000};
Martin Killenberg
committed
// Look at the map file: This device provides "Heater/temperatureReadback" and "Heater/heatingCurrent".
Martin Killenberg
committed
ctk::ConnectingDeviceModule oven{this, "oven", "/Timer/tick"};
Martin Killenberg
committed
// Pick the name "Heater" for the controller module. Now the variable "Heater/temperatureReadback" and
// "Heater/heatingCurrent" are automatically connected to the matching variables on the device.
Controller controller{this, "Heater", "A controller for the heater of the oven."};
Martin Killenberg
committed
static ExampleApp theExampleApp;