Commit 3588cb0d authored by Franck Cecillon's avatar Franck Cecillon

create combo

parent db8d3b44
......@@ -63,6 +63,23 @@ ChopperSetup::ChopperSetup(const string& name) :
indChopperActive.init(this, SAVE, "indChopperActive");
indiceActionChopper.init(this, SAVE, "indiceActionChopper");
nChopper.init(this, NOSAVE , "nChopper");
chopperLabels.init(this, NOSAVE , "chopperLabels");
chopperValues.init(this, NOSAVE , "chopperValues");
nAction.init(this, NOSAVE , "nAction");
actionLabels.init(this, NOSAVE , "actionLabels");
actionValues.init(this, NOSAVE , "actionValues");
nGear.init(this, NOSAVE , "nGear");
gearLabels.init(this, NOSAVE , "gearLabels");
gearValues.init(this, NOSAVE , "gearValues");
nDire.init(this, NOSAVE , "nDire");
direLabels.init(this, NOSAVE , "direLabels");
direValues.init(this, NOSAVE , "direValues");
// Init drivers
m_NCSDriver.init(this, "ncs_driver");
......@@ -95,6 +112,70 @@ void ChopperSetup::postConfiguration() {
chopper1Name = "CH1";
chopper2Name = "CH2";
nChopper = 2;
chopperLabels.resize(nChopper());
chopperValues.resize(nChopper());
chopperLabels.set(0, "CH1");
chopperValues.set(0, 1);
chopperLabels.set(1, "CH2");
chopperValues.set(1, 2);
indChopperActive.setEnumeratedValues(chopperValues);
indChopperActive.setEnumeratedLabels(chopperLabels);
nChopper = 5;
actionLabels.resize(nChopper());
actionValues.resize(nChopper());
actionLabels.set(0, "RESET");
actionValues.set(0, CMD1_ON_RESET);
actionLabels.set(1, "CALIBRATION");
actionValues.set(1, CMD1_ON_CALIBRATION);
actionLabels.set(2, "BRAKE");
actionValues.set(2, CMD1_ON_BRAKE);
actionLabels.set(3, "SET DIR");
actionValues.set(3, CMD1_SETDIR);
actionLabels.set(4, "SET GEAR");
actionValues.set(4, CMD1_SETGEAR);
indiceActionChopper.setEnumeratedValues(actionValues);
indiceActionChopper.setEnumeratedLabels(actionLabels);
nGear = 4;
gearLabels.resize(nGear());
gearValues.resize(nGear());
gearLabels.set(0, "1:1");
gearValues.set(0, 7);
gearLabels.set(1, "1:2");
gearValues.set(1, 6);
gearLabels.set(2, "1:4");
gearValues.set(2, 4);
gearLabels.set(3, "1:8");
gearValues.set(3, 0);
gear1.setpoint.setEnumeratedValues(gearValues);
gear1.setpoint.setEnumeratedLabels(gearLabels);
gear2.setpoint.setEnumeratedValues(gearValues);
gear2.setpoint.setEnumeratedLabels(gearLabels);
nDire=2;
direLabels.resize(nDire());
direValues.resize(nDire());
direLabels.set(0, "CW");
direValues.set(0, 0);
direLabels.set(1, "CCW");
direValues.set(1, 1);
dire1.setpoint.setEnumeratedValues(direValues);
dire1.setpoint.setEnumeratedLabels(direLabels);
dire2.setpoint.setEnumeratedValues(direValues);
dire2.setpoint.setEnumeratedLabels(direLabels);
}
......@@ -136,6 +217,8 @@ void ChopperSetup::start() {
commandStatus.setRunning();
cout << " ChopperSetup::start indChopperActive " << indChopperActive() << endl;
indiceChopperMaster = indChopperActive();
m_NCSDriver->isSync = 0;
m_NCSDriver->isMaster = 1;
......@@ -150,6 +233,11 @@ void ChopperSetup::start() {
//m_NCSDriver.execute(driver::START_COMMAND, true);
break;
case CMD1_ON_CALIBRATION:
if (indChopperActive() == chopper_ncs::IND_CH1) {
m_NCSDriver->indChopperActive.setpoint = chopper_ncs::IND_CH1;
} else {
m_NCSDriver->indChopperActive.setpoint = chopper_ncs::IND_CH2;
}
m_NCSDriver.execute(COMMAND_CALIBRATE_DEVICE_CONTAINER, true);
break;
case CMD1_ON_BRAKE:
......
......@@ -61,9 +61,9 @@ public:
Property<float64, SETPOINT> phaseChopper2;
Property<int32, SETPOINT > gear1; //! phase property
Property<std::string, SETPOINT> dire1; //! dir property
Property<int32, SETPOINT> dire1; //! dir property
Property<int32, SETPOINT > gear2; //! phase property
Property<std::string, SETPOINT> dire2; //! dir property
Property<int32, SETPOINT> dire2; //! dir property
Property<std::string> chopper1Name;
Property<std::string> chopper2Name;
......@@ -72,6 +72,25 @@ public:
Property<int32> indChopperActive;
Property<int32> indiceActionChopper;
Property<int32> nChopper;
DynamicProperty<std::string> chopperLabels; // Possible states
DynamicProperty<int32> chopperValues; // Possible state values
Property<int32> nAction;
DynamicProperty<std::string> actionLabels; // Possible states
DynamicProperty<int32> actionValues; // Possible state values
Property<int32> nGear;
DynamicProperty<std::string> gearLabels; // Possible states
DynamicProperty<int32> gearValues; // Possible state values
Property<int32> nDire;
DynamicProperty<std::string> direLabels; // Possible states
DynamicProperty<int32> direValues; // Possible state values
DriverPtr<chopper_ncs::chopperNCSDriver> m_NCSDriver;
/*!
* \brief Method called before changing the property value
......
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