Commit e393f3b9 authored by Franck Cecillon's avatar Franck Cecillon

status and chopper indice

parent fd324eac
......@@ -119,7 +119,7 @@ static const uint16 PAR_COUNTERCLOCKWISE= 1;
static const uint16 SPEED_TOL = 1;
static const float64 PHASE_TOL = 0.01;
static const int32 IND_CH1 = 1;
static const int32 IND_CH2 = 1;
static const int32 IND_CH2 = 2;
static const uint32 CHOPPER_NO_STATUS_DEVICE_CONTAINER = 0x0000;
......
......@@ -70,7 +70,7 @@ public:
Property<int32, SETPOINT > speed; //! speed property
Property<float64, SETPOINT > phase; //! phase property
Property<int32, SETPOINT > gear; //! phase property
Property<std::string, SETPOINT> dire; //! dir property
Property<int32, SETPOINT> dire; //! dir property
Property<int32> isSync;
Property<int32> isMaster;
Property<int32, SETPOINT > indChopperActive; //! speed property
......
......@@ -158,12 +158,18 @@ void PerfectchopperNCSDriver::readStatus() {
}else {
local_status = owner()->status() ;
if (local_status == CMD_ON_RESET) {
owner()->status = CHOPPER_NO_STATUS_DEVICE_CONTAINER;
} else if (local_status == CMD_ON_CALIBRATION) {
owner()->status = CHOPPER_CALIBRATING_DEVICE_CONTAINER;
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
} else if (local_status == CMD_ON_BRAKE) {
owner()->status = CHOPPER_BRAKING_DEVICE_CONTAINER;
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
} else if (local_status == CMD_ON_STOP) {
owner()->status = CHOPPER_EMERGENCY_STOP_DEVICE_CONTAINER;
} else if (local_status == CMD_ON_MOVE) {
......@@ -174,6 +180,8 @@ void PerfectchopperNCSDriver::readStatus() {
owner()->status = CHOPPER_PHASING_RUNNING_DEVICE_CONTAINER;
} else if (local_status == CMD_ON_IDLE) {
owner()->status = CHOPPER_NO_STATUS_DEVICE_CONTAINER;
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
} else if (local_status == CMD_ON_RESUME) {
// owner()->status =
} else if (local_status == CMD_ON_ESTOP) {
......@@ -188,43 +196,52 @@ void PerfectchopperNCSDriver::readStatus() {
}
/**
* Stop the execution.
*/
void PerfectchopperNCSDriver::calibrate() {
if ( owner()->indChopperActive.setpoint() == IND_CH1){
cout <<"PerfectchopperNCSDriver::calibrate CH1 " << endl;
writeRegInt(MB_DES_CMD1, CMD_ON_CALIBRATION);
} else if (owner()->indChopperActive.setpoint() == IND_CH2){
cout <<"PerfectchopperNCSDriver::calibrate CH2 " << endl;
writeRegInt(MB_DES_CMD2, CMD_ON_CALIBRATION);
}
owner()->status = CMD_ON_CALIBRATION;
}
/**
* Stop the execution.
*/
void PerfectchopperNCSDriver::setDir() {
int32 val;
if (owner()->dire.setpoint() == "CLOCKWISE" ){
/* if (owner()->dire.setpoint() == "CLOCKWISE" ){
val = PAR_CLOCKWISE;
}else {
val =PAR_COUNTERCLOCKWISE;
}
}*/
val =owner()->dire.setpoint();
if (owner()->indChopperActive.setpoint() == IND_CH1) {
cout <<"PerfectchopperNCSDriver::setDir CH1 " << endl;
writeRegInt(MB_DES_DIR1,val );
} else if (owner()->indChopperActive.setpoint() == IND_CH2) {
cout <<"PerfectchopperNCSDriver::setDir CH2 " << endl;
writeRegInt(MB_DES_DIR2,val );
}
owner()->status = CMD_ON_IDLE;
}
/**
* Stop the execution.
*/
void PerfectchopperNCSDriver::setGear() {
if (owner()->indChopperActive.setpoint() == IND_CH1) {
cout <<"PerfectchopperNCSDriver::setGear CH1 " << endl;
writeRegInt(MB_DES_GEAR1, owner()->gear.setpoint() );
} else if (owner()->indChopperActive.setpoint() == IND_CH2) {
cout <<"PerfectchopperNCSDriver::setGear CH2 " << endl;
writeRegInt(MB_DES_GEAR2, owner()->gear.setpoint() );
}
owner()->status = CMD_ON_IDLE;
}
/**
* Stop the execution.
......@@ -235,6 +252,7 @@ void PerfectchopperNCSDriver::brake() {
} else if (owner()->indChopperActive.setpoint() == IND_CH2) {
writeRegInt(MB_DES_CMD2, CMD_ON_BRAKE);
}
owner()->status =CMD_ON_BRAKE;
}
......
......@@ -200,11 +200,13 @@ void RealchopperNCSDriver::calibrate() {
*/
void RealchopperNCSDriver::setDir() {
int32 val;
if (owner()->dire.setpoint() == "CLOCKWISE" ){
val = PAR_CLOCKWISE;
}else {
val =PAR_COUNTERCLOCKWISE;
}
/* if (owner()->dire.setpoint() == "CLOCKWISE" ){
val = PAR_CLOCKWISE;
}else {
val =PAR_COUNTERCLOCKWISE;
}*/
val =owner()->dire.setpoint();
if (owner()->indChopperActive.setpoint() == IND_CH1) {
writeRegInt(MB_DES_DIR1,val );
......
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