Changeset 8875 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 02/24/08 11:26:09 (17 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCosy.cc
r8865 r8875 406 406 407 407 //#ifdef EXPERT 408 //point.SetPointAccDec(0.3, 0.3);409 //point.SetPointVelocity(0.3);408 // point.SetPointAccDec(0.25, 0.25); 409 // point.SetPointVelocity(0.4); 410 410 //#else 411 411 … … 449 449 track.SetPointVelocity(0.1); 450 450 451 // 451 // track.SetPointAccDec(0.4, 0.4); 452 452 // track.SetPointVelocity(0.4); 453 453 … … 699 699 return 0xebb0; 700 700 701 //const bool arm = *((bool*)mp);702 //if (arm)703 //{701 const bool arm = mp ? *((bool*)mp) : true; 702 if (arm) 703 { 704 704 fMac1->Arm(); 705 705 fMac2->Arm(); 706 //cout << "ARMED" << endl; 707 //} 708 //else 709 //{ 710 // fMac1->Disarm(); 711 // fMac2->Disarm(); 712 //cout << "DISARMED" << endl; 713 //} 706 } 707 else 708 { 709 fMac1->Disarm(); 710 fMac2->Disarm(); 711 } 714 712 } 715 713 //cout << "WM_Position: done. (return 0x7777)" << endl; … … 1290 1288 //cout << (fStatus&MDriveCom::kTracking?"TRA: ":"POS: ") << bendist.Zd() << " " << bendist.Az() << endl; 1291 1289 1292 fCom->SendReport(fStatus, fRaDec, fZdAzSoll, bendist, fTrackingError );1290 fCom->SendReport(fStatus, fRaDec, fZdAzSoll, bendist, fTrackingError, armed); 1293 1291 1294 1292 fWin->UpdateWeather(*fCom); … … 1614 1612 } 1615 1613 1616 MCosy::MCosy(MEnv &env, const char *addr, const char *pointing)1614 MCosy::MCosy(MEnv &env, MDriveCom *com, const char *pointing) 1617 1615 : Network(), fObservatory(MObservatory::kMagic1), fStarguider(NULL), 1618 1616 fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), /*fMac3(0),*/ … … 1665 1663 fAz->SetDisplay(fWin->GetLabel1()); 1666 1664 1667 fCom = new MDriveCom(this, addr, fOutRep); 1668 // fCom->Start(); 1665 fCom = com;//new MDriveCom(this, addr, tx, rx, fOutRep); 1666 fCom->SetOutRep(fOutRep); 1667 // fCom->Start(); 1669 1668 } 1670 1669 … … 1691 1690 MCosy::~MCosy() 1692 1691 { 1692 if(fCom) 1693 { 1694 fCom->SetMsgQueue(NULL); 1695 fCom->SetOutRep(NULL); 1696 } 1697 1693 1698 gLog << inf2 << "Deleting GUI timer." << endl; 1694 1699 // FIXME: Wait until last Update was finished!!! … … 1704 1709 delete fOutTp; 1705 1710 } 1711 1706 1712 delete fOutRep; 1707 1713 1708 gLog << inf2 << "Deleting CC communication." << endl;1709 delete fCom;1714 //gLog << inf2 << "Deleting CC communication." << endl; 1715 //delete fCom; 1710 1716 1711 1717 gLog << inf2 << "Deleting Nodes." << endl; -
trunk/MagicSoft/Cosy/main/MCosy.h
r8865 r8875 181 181 182 182 public: 183 MCosy(MEnv &env, const char *addr, const char *pointing);183 MCosy(MEnv &env, MDriveCom *com, const char *pointing); 184 184 ~MCosy(); 185 185 … … 212 212 MLog *GetOutRep() { return fOutRep; } 213 213 214 //rwagner215 214 MDriveCom *GetDriveCom() { return fCom; } 216 215 -
trunk/MagicSoft/Cosy/main/MSlewing.cc
r8824 r8875 1 #include "MSlewing.h" 1 2 #include "MSlewing.h" 2 3 … … 7 8 #include "MDriveCom.h" 8 9 10 #include "MString.h" 9 11 #include "MPointing.h" 10 12 … … 165 167 // Round to check whether we are as near as possible 166 168 // to the value we expect 167 cd.Round(); 168 169 170 cout << cd.Zd() << " " << cd.Az() << endl; 171 172 cd /= fCosy->kResSE; // Scale to Revolutions 173 174 gLog << inf2 << "- Shaftencoders show a residual deviation of dZd="; 175 gLog << MString::Format("%.2f", cd.Zd()*360*60) << "' and dAz="; 176 gLog << MString::Format("%.2f", cd.Az()*360*60) << "'" << endl; 177 178 cout << cd.Zd() << " " << cd.Az() << endl; 179 180 cd *= 1./fMaxResidual; // Scale to units of the maximum residual 181 182 cout << fCosy->kResSE.X() << " " << 1./fMaxResidual << endl; 183 cout << cd.Zd() << " " << cd.Az() << endl; 184 185 cd.Abs(); 186 187 // FIXME:: Do NOT check Shaftencoder values!!! 169 188 // Check if there is a control deviation on the axis 170 const Bool_t cdzd = (int)cd.Zd() ? kTRUE : kFALSE; 171 const Bool_t cdaz = (int)cd.Az() ? kTRUE : kFALSE; 189 const Bool_t cdzd = cd.Zd()>0.5 ? kTRUE : kFALSE; 190 const Bool_t cdaz = cd.Az()>0.5 ? kTRUE : kFALSE; 191 192 cout << (int)cdzd << " " << (int)cdaz << endl; 172 193 173 194 // check if we reached the correct position already … … 183 204 // ============================================== 184 205 // Estimate the noncircularity of the zd axis 185 const ZdAz ist = dst-rd*TMath::TwoPi()/fCosy->kResSE; 186 187 const double p1 = ist.Zd()-19.0605/kRad2Deg; 188 const double p2 = dst.Zd()-19.0605/kRad2Deg; 189 190 const double f1 = (-26.0101*sin(p1)+443.761*ist.Zd())*rad2se; 191 const double f2 = (-26.0101*sin(p2)+443.761*dst.Zd())*rad2se; 192 // ==++========================================= 206 // const ZdAz ist = dst-rd*TMath::TwoPi()/fCosy->kResSE; 207 208 // const double p1 = ist.Zd()-19.0605/kRad2Deg; 209 // const double p2 = dst.Zd()-19.0605/kRad2Deg; 210 211 // const double f1 = (-26.0101*sin(p1)+443.761*ist.Zd())*rad2se; 212 // const double f2 = (-26.0101*sin(p2)+443.761*dst.Zd())*rad2se; 213 // =========================================== 214 215 gLog << warn << "WARNING - The center of the elevation axis is taken as center of the drive bow" << endl; 216 193 217 194 218 // change units from se to re 195 219 // rd *= fCosy->kGearTot/fCosy->kResSE; // [re] 196 220 rd *= Div(fCosy->kGearTot,fCosy->kResSE); // [re] 197 rd.Zd(f2-f1);221 // rd.Zd(f2-f1); 198 222 199 223 // Initialize Velocities so that we reach both positions … … 201 225 if (i) 202 226 { 203 // lout << "--- LO-SPEED ---" << endl;204 SetAccDec(fCosy->fMac1, 0. 1, 0.1);205 SetAccDec(fCosy->fMac2, 0. 1, 0.1);227 //cout << "--- LO-SPEED ---" << endl; 228 SetAccDec(fCosy->fMac1, 0.05, 0.05); 229 SetAccDec(fCosy->fMac2, 0.05, 0.05); 206 230 207 231 SetPosVelocity(1.0, 0.05); … … 209 233 else 210 234 { 235 // 15 motor revolutions 211 236 const Double_t y = 15*fCosy->kGearTot.Y()/fCosy->kResSE.Y(); 212 237 … … 215 240 216 241 if (rd.Az()>-y && rd.Az()<y) 217 {218 //lout << "--- LO-SPEED Mac1 ---" << endl;219 242 SetAccDec(fCosy->fMac1, 0.05, 0.05); 220 }221 243 else 222 { 223 224 //lout << "MSlewing::SetPosition SetAccDec Mac1: " << fAcc << fDec << endl; 225 226 SetAccDec(fCosy->fMac1, fAcc, fDec); 227 228 } 229 230 231 // new 16.05.05 F.G. 232 // SetAccDec(fCosy->fMac1, fAcc, fDec); 244 SetAccDec(fCosy->fMac1, fAcc, fDec); 233 245 234 246 SetAccDec(fCosy->fMac2, fAcc, fDec); … … 267 279 268 280 t.Now(); 269 gLog << warn << t << " - Warning: Requested position not reached (i=" << dec <<i << ")" << endl;281 gLog << warn << t << " - Warning: Requested position not reached (i=" << i << ")" << endl; 270 282 271 283 fCosy->fCom->SendStatus("Target position missed!"); -
trunk/MagicSoft/Cosy/main/MSlewing.h
r8869 r8875 23 23 Float_t fDec; 24 24 25 Float_t fMaxResidual; // [rev] Maximum residual deviation to stop pointin 26 25 27 void DoRelPos(const ZdAz &rd, const Bool_t axe1, const Bool_t axe2); 26 28 void SetPosVelocity(const Float_t ratio, Float_t vel); 27 29 28 30 public: 29 MSlewing(MCosy *cosy) : fCosy(cosy), fVel(0.1), fAcc(0.2), fDec(0.1) { }31 MSlewing(MCosy *cosy) : fCosy(cosy), fVel(0.1), fAcc(0.2), fDec(0.1), fMaxResidual(1./16384) { } 30 32 31 33 void SetPointAccDec(Float_t acc, Float_t dec) { fAcc = acc; fDec = dec; } 32 34 void SetPointVelocity(Float_t vel) { fVel = vel; } 33 35 int SetPosition(const ZdAz &dst, Bool_t track=kFALSE); 36 void SetMaxResidual(Float_t ac) { fMaxResidual = ac; } 34 37 35 38 ClassDef(MSlewing, 0)
Note:
See TracChangeset
for help on using the changeset viewer.