Changeset 2019 for trunk/MagicSoft/Cosy
- Timestamp:
- 04/28/03 11:04:17 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/.cosyrc_magic
r1814 r2019 1 #2 # -85.0 , +310.03 #4 Az_MaxTime2ReachHome[s]: 1505 6 #7 #8 #9 Zd_MaxTime2ReachHome[s]: 15010 11 # Model: Az_GearRatio[U_mot/U_tel]: 5891.7/412 # Model: Zd_GearRatio[U_mot/U_tel]: 2475.6/413 14 #Az_GearRatio[U_mot/U_tel]: 5353.215 #Zd_GearRatio[U_mot/U_tel]: 460016 1 17 2 Az_GearRatio[U_mot/U_tel]: 1338.8 18 3 # 1338.3 19 4 Zd_GearRatio[U_mot/U_tel]: 1165.2 5 # old value: 1165.2, try: 1211.8 20 6 #1149.5 21 7 #1208.29 22 23 #Az_ResRE[re/U_mot]: 50024 #Zd_ResRE[re/U_mot]: 50025 26 #Az_Min[deg]: -9027 #Az_Max[deg]: 31828 29 #Zd_Min[deg]: -74.530 #Zd_Max[deg]: 100.531 8 32 9 Az_Id-MAC1: 1 -
trunk/MagicSoft/Cosy/Changelog
r1959 r2019 1 1 -*-*- END -*-*- 2 2003/04/28 - Thomas Bretz 3 4 * .cosyrc_magic: 5 - removed Time2ReachHome 6 - changed Gear Ratio 7 8 * bending_magic.txt: 9 - added bening model calculated in March 10 11 * cosy.cc: 12 - added disable output to screen 13 14 * prepos_magic.txt: 15 - made positions fit the present bending model 16 17 * candrv/nodedrv.[h,cc]: 18 - added posibility to implement fake guarding (eg. check a 19 PDO frequence) 20 21 * devdrv/macs.cc: 22 - added HandleNodeguard to handling of PDO 23 24 * main/MCosy.[h,cc]: 25 - GetSePos declared const 26 - AlignTrackingPos declared const 27 - define EXPERT 28 - implemented EXPERT mode 29 - implemented Gear while positioning for Elevation axes 30 - fixed some bugs in LimitSpeed - to be chacked again! 31 - implemented preliminary version of starguider 32 - some small changes to the tracking 33 - changed default end positions 34 - fixed display of fZdAzSoll and fTrackingError 35 36 * videodev/Filter.cc: 37 fixed dealing with values above max and below min when stretching 38 39 40 2 41 2003/04/13 - Thomas Bretz 3 42 -
trunk/MagicSoft/Cosy/candrv/nodedrv.cc
r1959 r2019 490 490 // least one Nodeguard message was answered. 491 491 // 492 void NodeDrv::StartGuarding( )492 void NodeDrv::StartGuarding(Bool_t real=kTRUE) 493 493 { 494 494 if (fTimerOn) 495 495 return; 496 496 497 SendNodeguard(); 497 if (!real) 498 SendNodeguard(); 498 499 499 500 fTimerOn = kTRUE; … … 512 513 } 513 514 514 void NodeDrv::StartGuarding(Int_t ms, Int_t ltf )515 void NodeDrv::StartGuarding(Int_t ms, Int_t ltf, Bool_t real) 515 516 { 516 517 if (fTimerOn) … … 522 523 fLifeTimeFactor = ltf; 523 524 524 StartGuarding( );525 StartGuarding(real); 525 526 } 526 527 -
trunk/MagicSoft/Cosy/candrv/nodedrv.h
r1727 r2019 109 109 void EnableCanMsg(BYTE_t fcode); 110 110 111 void StartGuarding( );112 void StartGuarding(Int_t ms, Int_t ltf );111 void StartGuarding(Bool_t real=kTRUE); 112 void StartGuarding(Int_t ms, Int_t ltf, Bool_t real=kTRUE); 113 113 void StopGuarding(); 114 114 -
trunk/MagicSoft/Cosy/cosy.cc
r1953 r2019 79 79 80 80 clog("- Starting mainloop."); 81 lout.DisableOutputDevice(MLog::eStdout); 81 82 app->Run(kTRUE); 82 83 -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1959 r2019 153 153 case 1: 154 154 //lout << ddev(MLog::eGui); 155 lout << "- " << GetNodeName() << ": Dec celeration set." << endl;155 lout << "- " << GetNodeName() << ": Deceleration set." << endl; 156 156 //lout << edev(MLog::eGui); 157 157 return; … … 278 278 SetNoWait(TRUE); 279 279 280 // StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms 281 280 282 // StartGuarding(250, 4); 281 283 // StartHostGuarding(); … … 448 450 void Macs::HandlePDO1(BYTE_t *data, timeval_t *tv) 449 451 { 452 // FIXME!!!! 453 HandleNodeguard(tv); 454 /* 455 Timer t(tv); 456 cout << GetNodeName()<< " " <<t.GetTimeStr() << endl; 457 */ 450 458 fPdoPos = (data[4]<<24) | (data[5]<<16) | (data[6]<<8) | data[7]; 451 459 -
trunk/MagicSoft/Cosy/main/MCosy.cc
r1953 r2019 25 25 #include "base/timer.h" 26 26 #include "shaftencoder.h" 27 28 //#include <sys/resource.h> // PRIO_PROCESS29 27 30 28 ClassImp(MCosy); … … 52 50 */ 53 51 52 #define EXPERT 53 54 54 double MCosy::Rad2SE(double rad) const 55 55 { … … 161 161 // sending all changes immediatly. 162 162 // 163 ZdAz MCosy::GetSePos() 163 ZdAz MCosy::GetSePos() const 164 164 { 165 165 const int pa = fAz->GetPos(); … … 206 206 fMac1->WaitForSdo(0x6004); 207 207 208 // FIXME, what when waiting times out (Zombie)209 // WaitForSdos();210 211 208 // 212 209 // If waiting was not interrupted everything is ok. return. 213 210 // 214 if (!(Break() || HasError() ) && !HasZombie())211 if (!(Break() || HasError() || HasZombie())) 215 212 return kTRUE; 216 213 … … 302 299 if (axe1) fMac2->StartRelPos(rd.Zd()); 303 300 if (axe2) fMac1->StartRelPos(rd.Az()); 304 301 #ifdef EXPERT 305 302 cout << "Waiting for positioning..." << flush; 306 303 #endif 307 304 if (axe1) fMac2->WaitForSdo(0x6004, 1); 308 305 if (axe2) fMac1->WaitForSdo(0x6004, 1); 309 306 310 307 WaitForEndMovement(); 311 308 #ifdef EXPERT 312 309 cout << "done." << endl; 310 #endif 313 311 } 314 312 … … 400 398 if (d.Zd()<fMin.Zd() || d.Zd()>fMax.Zd()) 401 399 { 402 lout << "ERROR: Requested Zenith Angle (" << d.Zd() << "deg ) not";403 lout << "inside allowed range." << endl;400 lout << "ERROR: Requested Zenith Angle (" << d.Zd() << "deg, Az="; 401 lout << d.Az() << ") not inside allowed range." << endl; 404 402 return kFALSE; 405 403 } … … 407 405 if (d.Az()<fMin.Az() || d.Az()>fMax.Az()) 408 406 { 409 lout << "ERROR: Requested Azimuth Angle (" << d.Az() << "deg ) not";410 lout << "inside allowed range." << endl;407 lout << "ERROR: Requested Azimuth Angle (" << d.Az() << "deg, Zd="; 408 lout << d.Zd() << ") not inside allowed range." << endl; 411 409 return kFALSE; 412 410 } … … 428 426 int MCosy::SetPosition(const ZdAz &dst, Bool_t track) // [rad] 429 427 { 430 // FIXME: Correct by fOffset ?431 432 428 const ZdAz d = dst*kRad2Deg; 433 429 … … 441 437 // 442 438 const ZdAz src = GetSePos(); // [se] 443 444 /*445 if (fMac1->IsZombieNode() || fMac2->IsZombieNode())446 {447 cout << "SetPosition: No connection to at least one of the MACS!" << endl;448 return TRUE;449 }450 */451 439 452 440 // … … 457 445 //if (fMac3->IsZombieNode()) 458 446 // return false; 459 460 // ====================================461 RequestRePos();462 ZdAz before = GetRePos();463 // ====================================464 447 465 448 // … … 477 460 cout << "Shortest Dest Zd: " << dest.Zd() << "se Az:" << dest.Az() << "se" << endl; 478 461 479 /*480 * re(se) = -28.1*cos(x*360/16384/se - 14.4) + 443.2*re/se481 *482 * int(re) = -1278.86*sin(0.021972656 *x/se - 14.4 )re + 443.2re x/se483 * int(re) = -73273.4*sin(0.000383495197*x/se - .2513274)re + 443.2re x/se484 *485 * int (-75deg..95deg) = 3.28343e7 re486 *487 */488 489 462 // 490 463 // Set velocities … … 493 466 494 467 int i; 495 for (i=0; i<10 && !(Break() || HasError() ) && !HasZombie(); i++)468 for (i=0; i<10 && !(Break() || HasError() || HasZombie()); i++) 496 469 { 497 470 … … 506 479 // 507 480 ZdAz rd = dest-p; // [se] 508 /*509 if (rd.Az()>0 && rd.Az()<0.5)510 rd.Az(1);511 if (rd.Az()<0 && rd.Az()>-0.5)512 rd.Az(-1);513 */514 cout << "Deviation: " << rd.Zd() << "se Az:" << rd.Az() << "se" << endl;515 516 481 517 482 // =========================================== 518 Float_t k1 = dest.Zd()*360/16384 - 14.3979; //[deg] 519 Float_t k0 = p.Zd()*360/16384 - 14.3979; //[deg] 520 521 // 522 // -28re/se*cos((x/deg-14.4)*pi/180) + 443.2re/se x 523 // 28re/se*2*pi/360*sin((x/deg-14.4)*pi/180)*deg + 443.2re/se*x/deg 524 // 525 526 Float_t dk = 443.152*(dest.Zd()-p.Zd()); 527 Float_t dx = 28.0148/2/TMath::Pi()*(sin(k1/kRad2Deg)-sin(k0/kRad2Deg)); 528 529 cout << "Using: " << rd.Zd()*kGearRatio.X() << endl; // [re] 530 cout << "Estimated1: " << 16384*dx + dk << endl; 531 cout << "Estimated2: " << (16384*dx + dk)/1.085949688 << endl; 532 cout << "Estimated3: " << rd.Zd()*432 << endl; 483 const ZdAz ist = dst-rd*TMath::Pi()/8192; 484 485 const double p1 = ist.Zd()-19.0605/kRad2Deg; 486 const double p2 = dst.Zd()-19.0605/kRad2Deg; 487 488 const double f1 = (-26.0101*sin(p1)+443.761*ist.Zd())*8192/TMath::Pi(); 489 const double f2 = (-26.0101*sin(p2)+443.761*dst.Zd())*8192/TMath::Pi(); 533 490 // =========================================== 534 535 491 536 492 ZdAz cd = rd; // [se] 537 493 cd.Round(); 538 /* 539 if (rd.Az()>0 && rd.Az()<0.5) 540 rd.Az(0.5); 541 if (rd.Az()<0 && rd.Az()>-0.5) 542 rd.Az(-0.5); 543 */ 494 544 495 // 545 496 // Check if there is a control deviation on the axis … … 555 506 lout << "Positioning done in " << i << (i==1?" step.":" steps.") << endl; 556 507 SetStatus(MCosy::kStopped); 557 558 // ====================================559 RequestRePos();560 ZdAz after = GetRePos();561 // ====================================562 563 after -= before;564 565 cout << "Drove: " << after.Zd() << " " << after.Az() << endl;566 508 return TRUE; 567 509 } … … 571 513 // 572 514 rd *= kGearRatio; // [re] 515 rd.Zd(f2-f1); 573 516 574 517 // … … 590 533 if (rd.Az()>-15*kGearRatio.Y() && rd.Az()<15*kGearRatio.Y()) 591 534 { 535 #ifdef EXPERT 592 536 cout << " -------------- LO ---------------- " << endl; 537 #endif 593 538 fMac1->SetAcceleration(0.05*vr); 594 539 fMac1->SetDeceleration(0.05*vr); … … 596 541 else 597 542 { 543 #ifdef EXPERT 598 544 cout << " -------------- HI ---------------- " << endl; 545 fMac1->SetAcceleration(0.4*vr);// 0.4 546 fMac1->SetDeceleration(0.4*vr);// 0.4 547 #else 599 548 fMac1->SetAcceleration(0.2*vr); 600 549 fMac1->SetDeceleration(0.1*vr); 550 #endif 601 551 } 602 552 553 #ifdef EXPERT 554 fMac2->SetAcceleration(0.4*vr);// 0.4 555 fMac2->SetDeceleration(0.4*vr);// 0.4 556 SetPosVelocity(fabs(rd.Ratio()), 0.2); // 0.175 557 #else 603 558 fMac2->SetAcceleration(0.2*vr); 604 559 fMac2->SetDeceleration(0.1*vr); 605 606 // vel(0.6) acc(0.5) 607 SetPosVelocity(fabs(rd.Ratio()), 0.175); 608 // SetPosVelocity(fabs(rd.Ratio()), 0.1, 0.3); 560 SetPosVelocity(fabs(rd.Ratio()), 0.1); 561 #endif 609 562 } 610 563 … … 632 585 if (i<10) 633 586 StopMovement(); 587 else 588 SetStatus(MCosy::kStopped); 634 589 635 590 lout << "Warning: Requested position not reached (i=" << i << ")" << endl; … … 653 608 654 609 // 655 // Wait for the objects to be OKed. 656 // 657 610 // Wait for the objects to be acknoledged. 611 // 658 612 fMac2->WaitForSdo(0x3006, 1); 659 613 fMac1->WaitForSdo(0x3006, 1); 660 614 661 // FIXME, what when waiting times out (Zombie)662 // WaitForSdos();663 664 615 // 665 616 // If the waiting for the objects wasn't interrupted return kTRUE 666 617 // 667 if (!(Break() || HasError() ) && !HasZombie())618 if (!(Break() || HasError() || HasZombie())) 668 619 return kTRUE; 669 620 … … 694 645 // Start revolution mode 695 646 // 696 fMac2->SetAcceleration(0. 2*fMac2->GetVelRes());697 fMac2->SetDeceleration(0. 2*fMac2->GetVelRes());647 fMac2->SetAcceleration(0.1*fMac2->GetVelRes()); 648 fMac2->SetDeceleration(0.1*fMac2->GetVelRes()); 698 649 if (fMac2->IsZombieNode()) 699 650 return false; 700 651 701 fMac1->SetAcceleration(0. 2*fMac1->GetVelRes());702 fMac1->SetDeceleration(0. 2*fMac1->GetVelRes());652 fMac1->SetAcceleration(0.1*fMac1->GetVelRes()); 653 fMac1->SetDeceleration(0.1*fMac1->GetVelRes()); 703 654 if (fMac1->IsZombieNode()) 704 655 return false; … … 732 683 // we don't want fast changes! 733 684 // 734 735 685 ULong_t vrzd = fMac1->GetVelRes(); 736 686 ULong_t vraz = fMac2->GetVelRes(); … … 738 688 #define sgn(x) (x<0?-1:1) 739 689 740 const Float_t limit = 0.25; 690 // 691 // When speed changes sign, the maximum allowed speed 692 // is 25% of the |v| 693 // 694 const Float_t limit = 0.25; 695 696 // 697 // The maximum allowed speed while tracking is 10% 698 // 699 const Float_t maxtrack = 0.1; 741 700 /* 742 701 if (sgn(vt->Az()) != sgn(vcalc.Az())) … … 766 725 && fabs(vt->Az()) < limit*fabs(vcalc.Az()) 767 726 ) 768 vt->Az(0); 727 { 728 lout << "Warning: Negative Azimuth speed limit (" << limit*100 << "%) exceeded... set to 0." << endl; 729 vt->Az(0); 730 } 769 731 else 770 if (fabs(vt->Az()) > 0.9*vraz)771 { 772 lout << "Warning: Azimuth speed limit exceeded. Limiting speed to 90% max." << endl;773 vt->Az( 0.9*vraz*sgn(vt->Az()));732 if (fabs(vt->Az()) > maxtrack*vraz) 733 { 734 lout << "Warning: Azimuth speed limit (" << maxtrack*100 << "%) exceeded... limited." << endl; 735 vt->Az(maxtrack*vraz*sgn(vcalc.Az())); 774 736 } 775 737 … … 777 739 && fabs(vt->Zd()) < limit*fabs(vcalc.Zd()) 778 740 ) 779 vt->Zd(0); 741 { 742 lout << "Warning: Negative Altitude speed limit (" << limit*100 << "%) exceeded... set to 0." << endl; 743 vt->Zd(0); 744 } 780 745 else 781 if (fabs(vt->Zd()) > 0.9*vrzd)782 { 783 lout << "Warning: Altitude speed limit exceeded. Limiting speed to 90% max." << endl;784 vt->Zd( 0.9*vrzd*sgn(vt->Zd()));785 } 786 } 787 788 Bool_t MCosy::AlignTrackingPos(ZdAz pointing, ZdAz &za) 746 if (fabs(vt->Zd()) > maxtrack*vrzd) 747 { 748 lout << "Warning: Altitude speed limit (" << maxtrack*100 << "%) exceeded... limited." << endl; 749 vt->Zd(maxtrack*vrzd*sgn(vcalc.Zd())); 750 } 751 } 752 753 Bool_t MCosy::AlignTrackingPos(ZdAz pointing, ZdAz &za) const 789 754 { 790 755 // pointing [deg] 791 792 756 if (pointing.Zd()<0) 793 757 { … … 796 760 } 797 761 798 const ZdAz se = GetSePos()* 360/16384; // [deg]799 const ZdAz unbendedse = fBending.CorrectBack(se) ; // ist pointing762 const ZdAz se = GetSePos()*2*TMath::Pi()/16384; // [rad] 763 const ZdAz unbendedse = fBending.CorrectBack(se)*kRad2Deg; // ist pointing 800 764 801 765 do … … 805 769 break; 806 770 807 pointing.Az(pointing.Az()+TMath::Sign(360., -d));771 pointing.Az(pointing.Az()+TMath::Sign(360., d)); 808 772 } while (1); 809 /* 810 while (pointing.Az()<fMin.Az()) 811 pointing.Az(pointing.Az() + 360); 812 813 while (pointing.Az()>fMax.Az()) 814 pointing.Az(pointing.Az() - 360); 815 */ 773 816 774 const Bool_t rc = CheckRange(pointing); 817 za = fBending(pointing/kRad2Deg); // [rad]775 za = pointing/kRad2Deg; // [rad] 818 776 819 777 if (!rc) … … 821 779 822 780 return rc; 781 } 782 783 Double_t MCosy::Starguider(Double_t mjd, ZdAz &dest) const 784 { 785 ifstream fin("pointingpos.txt"); 786 if (!fin) 787 return -1; 788 789 Double_t mjd0, zd, az; 790 fin >> mjd0 >> zd >> az; 791 792 mjd0 += 52000; 793 794 if (mjd0+1./24/60 <mjd) 795 return -1; 796 797 ZdAz point; 798 if (!AlignTrackingPos(ZdAz(zd, az), point)) 799 { 800 cout << "Starguider position couldn't be aligned..." << endl; 801 return -1; 802 } 803 804 const ZdAz diff = (dest-point)*kRad2Deg; 805 806 if (diff.Zd()>5 || diff.Az()>5) 807 { 808 cout << "Starguider deviation too large... dZd=" << diff.Zd() <<" dAz="<<diff.Az() << endl; 809 return -1; 810 } 811 812 dest -= point; 813 dest *= 16384/TMath::Pi()/2; // [se] 814 dest *= -kGearRatio; // [re] 815 816 cout << "Using Starguider... dZd=" << dest.Zd() << " dAz=" << dest.Az() << endl; 817 818 return (mjd-mjd0) * (24*60*60); // [s] 823 819 } 824 820 … … 877 873 // 878 874 if (!InitTracking()) 875 { 876 StopMovement(); 879 877 return; 878 } 880 879 881 880 XY xy(Rad2Deg(dst.Ra())*24/360, Rad2Deg(dst.Dec())); … … 883 882 lout << "Start tracking:"; 884 883 lout << " Ra: " << xy.X() << "h " << "Dec: " << xy.Y() << "\xb0" << endl; 885 884 #ifdef EXPERT 886 885 ofstream fout("coordinates.txt"); 887 886 fout << xy; 888 887 fout.close(); 889 888 #endif 890 889 // 891 890 // Initialize Tracker (slalib or starguider) … … 922 921 break; 923 922 924 dest *= 16384/TMath::Pi()/2; // [se]925 926 /*927 ZdAz dummy1 = sla.CalcZdAz(fRaDec);928 929 if (dummy1.Az()<-TMath::Pi()/2)930 dummy1.Az(dummy1.Az() + TMath::Pi()*2);931 if (dummy1.Az()>3*TMath::Pi()/2)932 dummy1.Az(dummy1.Az() -TMath::Pi()*2);933 934 if (!CheckRange(dummy1*kRad2Deg))935 {936 lout << "Error: Tracking position out of Range." << endl;937 break;938 }939 940 ZdAz dummy = fBending(dummy1);941 dest = CorrectTarget(GetSePos(), dummy); // [se]942 */943 944 //*LP* const ZdAz d = dest*360./16384; // [deg]945 dest *= kGearRatio; // [re]946 947 //*LP* ZdAz min = fBending(fMin/kRad2Deg)*kRad2Deg;948 //*LP* ZdAz max = fBending(fMax/kRad2Deg)*kRad2Deg;949 950 923 ZdAz vcalc = sla.GetApproxVel(fRaDec) * kGearRatio2*4./60.; // [re/min] 951 924 952 // 953 // Request absolute position of rotary encoder from Macs 954 // 955 if (!RequestRePos()) 956 break; 957 958 // 959 // distance between (To+dt) and To [re] 960 // position time difference < 5usec 961 // fOffset does the synchronization between the 962 // Shaft- and the rotary encoders 963 // 964 dest -= GetRePos() + fOffset; 925 float dtime = -1; 926 if (kFALSE /*fUseStarguider*/) 927 dtime = Starguider(mjd, dest); 928 929 if (dtime<0) 930 { 931 dest = fBending(dest); // [rad] 932 dest *= 16384/TMath::Pi()/2; // [se] 933 dest *= kGearRatio; // [re] 934 935 // 936 // Request absolute position of rotary encoder from Macs 937 // 938 if (!RequestRePos()) 939 break; 940 941 // 942 // distance between (To+dt) and To [re] 943 // position time difference < 5usec 944 // fOffset does the synchronization between the 945 // Shaft- and the rotary encoders 946 dest -= GetRePos() + fOffset; 947 948 dtime = dt; 949 } 965 950 966 951 // … … 968 953 // correct for the duration of RaDec2AltAz 969 954 // 970 const ZdAz v = dest*60.0/(dt /*-(fMac2->GetTime()-sla)*/);955 const ZdAz v = dest*60.0/(dtime/*-(fMac2->GetTime()-sla)*/); 971 956 972 957 // … … 1020 1005 // (This is important on fast machines >500MHz) 1021 1006 // 1007 /* 1008 MTimeout t(1000); 1009 while (!t.HasTimedOut()) 1010 usleep(1); 1011 */ 1022 1012 usleep(1000000); // 1s 1023 1013 //usleep(50000); // 0.05s … … 1047 1037 // 1048 1038 cout << "Stopping movement (dec=30%)..." << endl; 1049 1039 #ifdef EXPERT 1040 fMac1->SetDeceleration(0.5*fMac1->GetVelRes()); 1041 fMac2->SetDeceleration(0.5*fMac2->GetVelRes()); 1042 #else 1050 1043 fMac1->SetDeceleration(0.3*fMac1->GetVelRes()); 1051 1044 fMac2->SetDeceleration(0.3*fMac2->GetVelRes()); 1045 #endif 1052 1046 fMac1->SetRpmMode(FALSE); 1053 1047 fMac2->SetRpmMode(FALSE); … … 1068 1062 // Wait for the movement to really be finished. 1069 1063 // 1064 #ifdef EXPERT 1070 1065 cout << "Waiting for end of movement..." << endl; 1066 #endif 1071 1067 WaitForEndMovement(); 1072 1068 … … 1075 1071 // 1076 1072 CheckForError(); 1073 #ifdef EXPERT 1077 1074 cout << "Movement stopped." << endl; 1075 #endif 1078 1076 } 1079 1077 … … 1203 1201 return (void*)0xaffe; 1204 1202 */ 1205 1203 #ifdef EXPERT 1206 1204 case WM_TPOINT: 1207 1205 { … … 1229 1227 } 1230 1228 return (void*)0xca1b; 1229 #endif 1231 1230 1232 1231 case WM_TRACKPOS: … … 1398 1397 1399 1398 cout << "Reading telescope range..." << flush; 1400 const Double_t amin = env.GetValue("Az_Min[deg]", -9 0.0);1401 const Double_t zmin = env.GetValue("Zd_Min[deg]", -7 4.5);1399 const Double_t amin = env.GetValue("Az_Min[deg]", -95.0); 1400 const Double_t zmin = env.GetValue("Zd_Min[deg]", -75.0); 1402 1401 fMin.Set(zmin, amin); 1403 1402 1404 1403 cout << " Min: " << zmin << "deg " << amin << "deg" << endl; 1405 1404 1406 const Double_t amax = env.GetValue("Az_Max[deg]", 3 18.0);1407 const Double_t zmax = env.GetValue("Zd_Max[deg]", 100.5);1405 const Double_t amax = env.GetValue("Az_Max[deg]", 305.0); 1406 const Double_t zmax = env.GetValue("Zd_Max[deg]", 98.25); 1408 1407 fMax.Set(zmax, amax); 1409 1408 … … 1450 1449 cout << " * Setting Gear Ratios:" << endl; 1451 1450 cout << " --------------------" << endl; 1452 cout << " * X: " << gzd << "*" << resrezd << "/" << ressezd << "= " << kGearRatio.X() << endl;1453 cout << " * Y: " << gaz << "*" << resreaz << "/" << resseaz << "= " << kGearRatio.Y() << endl;1451 cout << " * X: " << gzd << "*" << resrezd << "/" << ressezd << "=4*" << kGearRatio.X() << endl; 1452 cout << " * Y: " << gaz << "*" << resreaz << "/" << resseaz << "=4*" << kGearRatio.Y() << endl; 1454 1453 } 1455 1454 … … 1489 1488 ZdAz ist = GetSePos(); // [se] 1490 1489 1491 // ZdAz istre = -fOffset; // [re]1492 1490 ZdAz time; 1493 1491 … … 1583 1581 ZdAz soll(sollzd.Zd(), sollaz.Az()); // [rad] 1584 1582 1585 AlignTrackingPos(soll*360/16384, fZdAzSoll); 1586 /* 1587 fZdAzSoll = fBending.CorrectBack(soll*2*TMath::Pi()/16384); 1588 1589 // FIXME? 1590 if (fZdAzSoll.Az()<-TMath::Pi()/2) 1591 fZdAzSoll.Az(fZdAzSoll.Az() + TMath::Pi()*2); 1592 if (fZdAzSoll.Az()>3*TMath::Pi()/2) 1593 fZdAzSoll.Az(fZdAzSoll.Az() -TMath::Pi()*2); 1594 1595 // FIXME? 1596 while (ist.Az()>3*16384/4/2) 1597 ist.Az(ist.Az() - 16384); 1598 while (soll.Az()>3*16384/4/2) 1599 soll.Az(soll.Az() - 16384); 1600 while (ist.Az()<-16384/4) 1601 ist.Az(ist.Az() + 16384); 1602 while (soll.Az()<-16384/4) 1603 soll.Az(soll.Az() + 16384); 1604 */ 1583 AlignTrackingPos(soll*kRad2Deg, fZdAzSoll); 1584 1605 1585 ist *= TMath::Pi()*2/16384; 1606 fTrackingError.Set(ist.Zd()-fZdAzSoll.Zd(), ist.Az()-fZdAzSoll.Az()); 1586 soll = fBending(fZdAzSoll); 1587 fTrackingError.Set(ist.Zd()-soll.Zd(), ist.Az()-soll.Az()); 1607 1588 1608 1589 //--- fout << setprecision(15) << setw(17) << time.Zd()*60.*60.*24. << " "; … … 1724 1705 re0.Zd(re.Zd()); 1725 1706 1707 se -= dse/2; 1708 1726 1709 ZdAz bend = fBending.CorrectBack(se*2*TMath::Pi()/16384)*kRad2Deg; 1727 1710 ((TH3*)fHist)->Fill(bend.Zd(), bend.Az(), dre.Zd()/dse.Zd()); … … 1732 1715 se0.Az(se.Az()); 1733 1716 re0.Az(re.Az()); 1717 1718 se -= dse/2; 1734 1719 1735 1720 ZdAz bend = fBending.CorrectBack(se*2*TMath::Pi()/16384)*kRad2Deg; … … 2124 2109 fZd2->SetDisplay(fWin->GetLabel3()); 2125 2110 fAz->SetDisplay(fWin->GetLabel1()); 2126 2111 #ifdef EXPERT 2127 2112 int i=0; 2128 2113 char name[100]; … … 2145 2130 *tpout << time.Year() << " " << time.Month() << " " << time.Day() << " "; 2146 2131 *tpout << /*"20 1013.25 300 0.5 0.55 0.0065" <<*/ endl; 2132 #endif 2147 2133 // temp(°C) pressure(mB) height(m) humidity(1) wavelength(microm) troplapserate(K/m) 2148 2134 } … … 2170 2156 MCosy::~MCosy() 2171 2157 { 2158 #ifdef EXPERT 2172 2159 *tpout << "END" << endl; 2173 2160 delete tpout; 2161 #endif 2174 2162 2175 2163 cout << "Deleting GUI timer." << endl; -
trunk/MagicSoft/Cosy/main/MCosy.h
r1953 r2019 118 118 ofstream *tpout; 119 119 120 Bool_t AlignTrackingPos(ZdAz pointing, ZdAz &za) ;120 Bool_t AlignTrackingPos(ZdAz pointing, ZdAz &za) const; 121 121 Bool_t CheckRange(const ZdAz &d) const; 122 Double_t Starguider(Double_t mjd, ZdAz &dest) const; 122 123 123 124 double Rad2SE(double rad) const; … … 132 133 ZdAz GetRePos(); 133 134 ZdAz GetRePosPdo(); 134 ZdAz GetSePos() ;// [se]135 ZdAz GetSePos() const; // [se] 135 136 136 137 Bool_t RequestRePos(); -
trunk/MagicSoft/Cosy/videodev/Filter.cc
r1959 r2019 205 205 void Filter::Stretch(byte *img) 206 206 { 207 const int offset = 10;207 const int offset = 25; 208 208 209 209 int max; … … 212 212 /*const float mean =*/Mean(img, offset, &min, &max); 213 213 214 const byte diff = max-min; 215 214 216 for (int x=0; x<768; x++) 215 217 for (int y=0; y<576; y++) 216 218 { 217 img[y*768+x] -= min; 218 img[y*768+x] *= 255/(max-min); 219 } 220 } 219 byte &b = img[y*768+x]; 220 221 if (b<min) 222 { 223 b=0; 224 continue; 225 } 226 if (b>max) 227 { 228 b=max; 229 continue; 230 } 231 b -= min; 232 b *= 255/diff; 233 } 234 }
Note:
See TracChangeset
for help on using the changeset viewer.