Changeset 6923 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 04/11/05 10:58:30 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MTracking.cc
r6823 r6923 22 22 bool MTracking::RequestRePos() 23 23 { 24 // 25 // Send request 26 // 27 fCosy->fMac2->RequestSDO(0x6004); 28 fCosy->fMac1->RequestSDO(0x6004); 29 30 // 31 // Wait until the objects are received. 32 // 33 fCosy->fMac2->WaitForSdo(0x6004); 34 fCosy->fMac1->WaitForSdo(0x6004); 35 36 // 37 // If waiting was not interrupted everything is ok. return. 38 // 39 if (!Break()) 40 return true; 24 for (int i=0; i<2; i++) 25 { 26 // 27 // Send request 28 // 29 fCosy->fMac2->RequestSDO(0x6004); 30 fCosy->fMac1->RequestSDO(0x6004); 31 32 // 33 // Wait until the objects are received. 34 // 35 fCosy->fMac2->WaitForSdo(0x6004, 0, 500, i>0); 36 fCosy->fMac1->WaitForSdo(0x6004, 0, 500, i>0); 37 38 // 39 // If waiting was not interrupted everything is ok. return. 40 // 41 if (!Break()) 42 return true; 43 44 fCosy->PrintError(); 45 } 41 46 42 47 // … … 48 53 49 54 return false; 55 } 56 57 // -------------------------------------------------------------------------- 58 // 59 // Sets the tracking velocity 60 // 61 // The velocities are given in a ZdAz object in re/min. Return kTRUE 62 // in case of success, kFALSE in case of failure. 63 // 64 Bool_t MTracking::SetVelocity(const ZdAz &v) 65 { 66 for (int i=0; i<2; i++) 67 { 68 // 69 // Send the new velocities for both axes. 70 // 71 fCosy->fMac2->SendSDO(0x3006, 1, (LWORD_t)v.Zd()); // SetRpmVelocity [re/min] 72 fCosy->fMac1->SendSDO(0x3006, 1, (LWORD_t)v.Az()); // SetRpmVelocity [re/min] 73 74 // 75 // Wait for the objects to be acknoledged. 76 // 77 fCosy->fMac2->WaitForSdo(0x3006, 1, 500, i>0); 78 fCosy->fMac1->WaitForSdo(0x3006, 1, 500, i>0); 79 80 // 81 // If the waiting for the objects wasn't interrupted return kTRUE 82 // 83 if (!Break()) 84 return kTRUE; 85 86 fCosy->PrintError(); 87 } 88 89 // 90 // print a message if the interruption was due to a Can-node Error 91 // 92 if (fCosy->HasError()) 93 lout << "Error while setting tracking velocity (SDO #3006)" << endl; 94 95 return kFALSE; 50 96 } 51 97 … … 189 235 } 190 236 191 // --------------------------------------------------------------------------192 //193 // Sets the tracking velocity194 //195 // The velocities are given in a ZdAz object in re/min. Return kTRUE196 // in case of success, kFALSE in case of failure.197 //198 Bool_t MTracking::SetVelocity(const ZdAz &v)199 {200 //201 // Send the new velocities for both axes.202 //203 fCosy->fMac2->SendSDO(0x3006, 1, (LWORD_t)v.Zd()); // SetRpmVelocity [re/min]204 fCosy->fMac1->SendSDO(0x3006, 1, (LWORD_t)v.Az()); // SetRpmVelocity [re/min]205 206 //207 // Wait for the objects to be acknoledged.208 //209 fCosy->fMac2->WaitForSdo(0x3006, 1);210 fCosy->fMac1->WaitForSdo(0x3006, 1);211 212 //213 // If the waiting for the objects wasn't interrupted return kTRUE214 //215 if (!Break())216 return kTRUE;217 218 //219 // print a message if the interruption was due to a Can-node Error220 //221 if (fCosy->HasError())222 lout << "Error while setting tracking velocity (SDO #3006)" << endl;223 224 return kFALSE;225 }226 227 237 // -------------------------------------------------------------------- 228 238 // … … 237 247 const XY re = fCosy->kGearTot/fCosy->kResSE; //[re/se] 238 248 249 Int_t pzd1 = fCosy->fZd1->GetPos(); 250 Int_t pzd2 = fCosy->fZd2->GetPos(); 251 Int_t paz = fCosy->fAz->GetPos(); 252 253 if (fCosy->fZd1->DirHasChanged() != fCosy->fZd2->DirHasChanged()) 254 { 255 pzd1 -= fCosy->fZd1->GetDirection(); 256 pzd2 -= fCosy->fZd2->GetDirection(); 257 } 258 else 259 { 260 fCosy->fZd1->ResetDirHasChanged(); 261 fCosy->fZd2->ResetDirHasChanged(); 262 } 263 239 264 // Get current shaftencoder position of the telescope 240 Double_t seposzd1 = (( fCosy->fZd1->GetPos()+8192)%16384)*re.X();241 Double_t seposzd2 = (( fCosy->fZd2->GetPos()+8192)%16384)*re.X();242 Double_t seposaz = fCosy->fAz->GetPos()*re.Y();265 Double_t seposzd1 = ((pzd1+8192)%16384)*re.X(); 266 Double_t seposzd2 = ((pzd2+8192)%16384)*re.X(); 267 Double_t seposaz = paz *re.Y(); 243 268 244 269 // distance between (To+dt) and To [re] … … 503 528 return (void*)3; 504 529 505 lout << "- Tracking Thread started ..." << endl;530 lout << "- Tracking Thread started (" << MTime() << ")" << endl; 506 531 507 532 //const XY re2se = fCosy->kGearTot/fCosy->kResSE; //[re/se] … … 590 615 } 591 616 592 lout << "- Tracking Thread done." << endl; 593 617 lout << "- Tracking Thread done. (" << MTIme() << ")" << endl; 594 618 return 0; 595 619 }
Note:
See TracChangeset
for help on using the changeset viewer.