Commit b78c9550 authored by Alessandro Abrami's avatar Alessandro Abrami
Browse files

2021/09/09:

	BRANCH(withFilters): piccola modifica per il segno di d2, verificato Mag/Andor vs dati di Fava: OK.
parent d99838dd
......@@ -328,6 +328,7 @@ typedef struct {
qr.set_size(2,false);
#endif
need_newpos_afterstop = false;
rot(0,0)=cos(rotationXN);
rot(0,1)=-sin(rotationXN);
......@@ -397,6 +398,7 @@ typedef struct {
#endif
else
p_stage2flt = NULL;
//===============================================================
} else {
pstage = NULL;
......@@ -409,6 +411,9 @@ typedef struct {
init_ok = false;
}
if (p_stage2flt != NULL) {
olds = p_stage2flt->currSelector();
};
ccdstageN.dev = cCDStageAxis[0];
ccdstageN.move_attr = cCDStageAxis[1];
......@@ -1824,9 +1829,32 @@ void PespCCDStage::updateattributes(){
*attr_FocusDistance_read = br[1];
//FFFF
if (p_stage2flt != NULL) {
//Tango::DevShort olds = p_stage2flt->currSelector();
if (!p_stage2flt->update()) {
ERROR_STREAM << "Read filters FAILED !!!" << endl;
ERROR_STREAM << "Read filters FAILED !!!" << endl;
} else {
Tango::DevShort currs = p_stage2flt->currSelector();
if ( currs != olds ) {
cout << "OLD selector:" << olds << " | NEW selector:" << currs << endl;
olds = currs;
need_newpos_afterstop = true;
}
}
if (need_newpos_afterstop){
// quando si fermera' si fara' un correct pos
if ( p_stage2flt->stateSelector() != Tango::MOVING ){
if ( attr_FilterTrackEnable_read[0] ) {
itpp::vec Focus(2);
Focus(0) = *attr_FocusX_read;
Focus(1) = *attr_FocusZ_read;
if (!p_stage2flt->correct_position(Focus)){
INFO_STREAM << "PespCCDStage::write_FocusX() error on filters"<< endl;
}
need_newpos_afterstop = false;
}
}
}
} else {
cout << "p_stage2flt NULL !!!" << endl;
......
......@@ -86,6 +86,9 @@ class PespCCDStage : public TANGO_BASE_CLASS
// Add your own data members
private:
PespStage_ns::Stage2Filter* p_stage2flt;
bool need_newpos_afterstop;
Tango::DevShort olds;
public:
mover_t ccdstageN;
mover_t ccdstageL;
......
......@@ -273,8 +273,14 @@ bool Stage2Filter::correct_position(itpp::vec Focus){
// sposto di D2 la posizione del filtro
// la direzione di d2 e' da asse tubo verso x,z >0,>0
// mentre l'asse filtro e inverso
//!!
//!! pero' d2, distanza e' sempre positiva,
//!! mentre devo spostare in positivo o negativo
//!! ovvero devo capire se I2 sta' al di la' o al di qua' dell'asse tubo
//!! I2(x) - I1(x) < 0 allora d2<0
//
double newpos = _sel.nominal_pos[_sel.selector].pos - d2;
if ( (i2(0) - i1(0)) < 0 ) d2 *= (-1.0);
double newpos = _sel.nominal_pos[_sel.selector].pos + d2;
#ifdef _DBG_STAGE2FILTER
cout << ">>>>> " << __func__ << " newpos=" << newpos << endl;
......
......@@ -60,6 +60,9 @@ public:
bool correct_position(itpp::vec Focus);
Tango::DevShort currSelector() { return _sel.selector; };
Tango::DevState stateSelector() { return _sel.state; };
};
} // namespace
......
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