Changeset 7297 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 08/22/05 10:46:31 (20 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MStarguider.cc
r7230 r7297 498 498 fStargCaos = new MCaos; 499 499 fStargCaos->ReadResources("stargleds.txt"); 500 fStargCaos->SetMinNumberRings( 2);500 fStargCaos->SetMinNumberRings(3); 501 501 fStargCaos->SetRadii(158,164); 502 502 … … 1206 1206 f.FindStarCircle(leds, (Int_t)center.GetX(), (Int_t)center.GetY()); 1207 1207 1208 if (leds.GetEntries()<0) 1209 return ZdAz(0, 0); 1210 1208 1211 // Check whether star found 1209 1212 Led *star = (Led*)leds.At(0); 1210 if (!star || leds.GetEntries()<1)1213 if (!star) 1211 1214 return ZdAz(.0,.0); 1212 1215 -
trunk/MagicSoft/Cosy/main/MTracking.cc
r7230 r7297 247 247 const XY re = fCosy->kGearTot/fCosy->kResSE; //[re/se] 248 248 249 // Check wether moving direction has changed 249 250 const bool bool1 = fCosy->fZd1->DirHasChanged(); 250 251 const bool bool2 = fCosy->fZd2->DirHasChanged(); 251 252 252 if (bool1 && bool2) { 253 fCosy->fZd1->ResetDirHasChanged(); 254 fCosy->fZd2->ResetDirHasChanged(); 253 // If both directions have changed reset the flags 254 if (bool1 && bool2) 255 { 256 fCosy->fZd1->ResetDirHasChanged(); 257 fCosy->fZd2->ResetDirHasChanged(); 255 258 } 256 257 Int_t pzd1 = !bool1 ? fCosy->fZd1->GetPos() : fCosy->fZd1->GetDirChangedPos(); 258 Int_t pzd2 = !bool2 ? fCosy->fZd2->GetPos() : fCosy->fZd2->GetDirChangedPos(); 259 Int_t paz = fCosy->fAz->GetPos(); 260 259 260 // Get shaftencoder positions 261 // Ignore the shaftencoder which has not yet changed its value 262 const Int_t pzd1 = fCosy->fZd1->GetPosDirCorrected(); 263 const Int_t pzd2 = fCosy->fZd2->GetPosDirCorrected(); 264 const Int_t paz = fCosy->fAz->GetPos(); 265 261 266 // Get current shaftencoder position of the telescope 262 267 Double_t seposzd1 = ((pzd1+8192)%16384)*re.X(); 263 268 Double_t seposzd2 = ((pzd2+8192)%16384)*re.X(); 264 269 Double_t seposaz = paz *re.Y(); 265 270 266 271 // distance between (To+dt) and To [re] 267 272 // position time difference < 5usec … … 269 274 // Shaft- and the rotary encoders 270 275 const ZdAz repos = pdo ? fCosy->GetRePosPdo() : fCosy->GetRePos(); 271 272 const Int_t offset1 = !bool1 ? fCosy->fZd1->GetOffset() : fCosy->fZd1->GetDirChangedOffset(); 273 const Int_t offset2 = !bool2 ? fCosy->fZd2->GetOffset() : fCosy->fZd2->GetDirChangedOffset(); 274 276 277 // Get rotary encoder positions 278 // Get stored offset if one SE has not changed its direction yet 279 const Int_t offset1 = fCosy->fZd1->GetOffsetDirCorrected(); 280 const Int_t offset2 = fCosy->fZd2->GetOffsetDirCorrected(); 281 275 282 // Calculate the part of one SE which the motors moved 276 283 // since the last SE has changed its value … … 278 285 const Double_t offzd2 = repos.Zd() - offset2; 279 286 const Double_t offaz = repos.Az() - fCosy->fAz->GetOffset(); 280 287 281 288 // Correct for the direction in which the motor is moving 282 289 // (in which the shaftencoders should change its values) … … 287 294 if (offzd2<0) 288 295 seposzd2 += re.X(); 289 296 297 // If the correction exceeds one shaftencoder step stop interpolation 298 // of shaftencoder positions using rotary encoder values. 299 //ofstream fout("offsets.log", ios::app); 300 //fout << MTime(-1) << " " << offaz << " " << offzd1 << " " << offzd2 << endl; 301 /* 302 if (TMath::Abs(offaz)>re.Y()) 303 offaz = TMath::Sign(re.Y(), offaz); 304 if (TMath::Abs(offzd1)>re.X()) 305 offzd1 = TMath::Sign(re.X(), offzd1); 306 if (TMath::Abs(offzd2)>re.X()) 307 offzd2 = TMath::Sign(re.X(), offzd2); 308 */ 309 290 310 // and interpolate the shaftencoder steps using the motor 291 311 // encoder positon (Be carefull the minus-sign is important) … … 293 313 seposzd2 -= offzd2; 294 314 seposaz += offaz; 295 296 297 315 298 316 return ZdAz((seposzd1-seposzd2)/2, seposaz); 299 317 } 300 /*301 if (fCosy->fZd1->DirHasChanged() != fCosy->fZd2->DirHasChanged())302 {303 pzd1 -= fCosy->fZd1->GetDirection();304 pzd2 -= fCosy->fZd2->GetDirection();305 }306 else307 {308 fCosy->fZd1->ResetDirHasChanged();309 fCosy->fZd2->ResetDirHasChanged();310 }311 */312 318 313 319 void MTracking::TrackPosition(const RaDec &dst) // ra, dec [rad]
Note:
See TracChangeset
for help on using the changeset viewer.