Changeset 1275 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 04/12/02 16:59:23 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCosy.cc
r1111 r1275 187 187 // 188 188 if (HasError()) 189 lout << "Error #6004 (requesting re pos from Macs) happened." << endl;189 lout << "Error while requesting re pos from Macs (SDO #6004)" << endl; 190 190 191 191 return kFALSE; … … 400 400 if (!cdzd && !cdaz) 401 401 { 402 lout << "Positioning done with " << i << "manuvers." << endl; 402 lout << "Positioning done in " << i << (i==1?" step.":" steps.") << endl; 403 SetStatus(MCosy::kStopped); 403 404 return TRUE; 404 405 } … … 468 469 // 469 470 if (HasError()) 470 lout << "Error #3006 (setting velocity of Macs) happened." << endl;471 lout << "Error while setting velocity (SDO #3006)" << endl; 471 472 472 473 return kFALSE; … … 520 521 521 522 const Float_t limit = 0.25; 522 523 if (sgn(vt->Az()) != sgn(vcalc.Az()) && 524 fabs(vt->Az()) < limit*fabs(vcalc.Az())) 523 /* 524 if (sgn(vt->Az()) != sgn(vcalc.Az())) 525 vt->Az(0); 526 // else 527 { 528 if (fabs(vt->Az()) < fabs(vcalc.Az()) *0.5) 529 vt->Az(0.5*vcalc.Az()); 530 531 if (fabs(vt->Az()) > fabs(vcalc.Az()) *1.5) 532 vt->Az(1.5*vcalc.Az()); 533 } 534 535 if (sgn(vt->Zd()) != sgn(vcalc.Zd())) 536 vt->Zd(0); 537 // else 538 { 539 if (fabs(vt->Zd()) > fabs(vcalc.Az()) *1.5) 540 vt->Zd(1.5*vcalc.Zd()); 541 542 if (fabs(vt->Zd()) < fabs(vcalc.Az()) *0.5) 543 vt->Zd(0.5*vcalc.Zd()); 544 } 545 */ 546 547 if (sgn(vt->Az()) != sgn(vcalc.Az()) 548 && fabs(vt->Az()) < limit*fabs(vcalc.Az()) 549 ) 525 550 vt->Az(0); 526 551 else … … 531 556 } 532 557 533 if (sgn(vt->Zd()) != sgn(vcalc.Zd()) && 534 fabs(vt->Zd()) < limit*fabs(vcalc.Zd())) 558 if (sgn(vt->Zd()) != sgn(vcalc.Zd()) 559 && fabs(vt->Zd()) < limit*fabs(vcalc.Zd()) 560 ) 535 561 vt->Zd(0); 536 562 else … … 605 631 { 606 632 // 633 // The loop should not be executed faster than the ramp of 634 // a change in the velocity can be followed. 635 // (This is important on fast machines >500MHz) 636 // 637 //usleep(100000000); 638 639 // 607 640 // Request Target position for this moment 608 641 // … … 715 748 // Stop revolution mode (movement) 716 749 // 717 cout << "Stop ing possibleRPM mode..." << endl;750 cout << "Stopping possibleRPM mode..." << endl; 718 751 fMac1->SetRpmMode(FALSE); 719 752 fMac2->SetRpmMode(FALSE); … … 734 767 void *MCosy::Proc(int msg, void *mp) 735 768 { 769 cout << "MCosy::Proc: 0x" << msg << endl; 736 770 switch (msg) 737 771 { … … 846 880 << Deg2ZdRE(env.GetValue("MaxZd[Deg]", +1.0)) << "RE" << endl; 847 881 */ 882 848 883 849 884 cout << "Setting up software endswitch..." << flush; … … 890 925 // wait until a tracking session is started 891 926 // 892 while (!fTracking && !fTTalk->HasStopFlag())927 while (!fTracking) 893 928 usleep(1); 894 895 if (fTTalk->HasStopFlag())896 break;897 929 898 930 ofstream fout("log/cosy.err"); … … 915 947 // only update fTrackingError while tracking 916 948 // 917 while (fTracking && !fTTalk->HasStopFlag()) 949 bool phca1=false; 950 bool phca2=false; 951 bool phcaz=false; 952 953 while (fTracking) 918 954 { 919 955 // … … 922 958 const float weight = 1.; //0.3; 923 959 924 ZdAz offset(fOffset.Zd()*(1.-weight)+(ist.Zd()*kGearRatio.X()-istre.Zd())*weight,925 fOffset.Az()*(1.-weight)+(ist.Az()*kGearRatio.Y()-istre.Az())*weight);926 927 fOffset = offset;928 929 960 // 930 961 // This is the time constant which defines how fast 931 962 // you correct for external influences (like wind) 932 963 // 933 bool phca1; 934 bool phca2; 935 bool phcaz; 936 964 fZd1->ResetPosHasChanged(); 965 fZd2->ResetPosHasChanged(); 966 fAz->ResetPosHasChanged(); 937 967 do 938 968 { … … 941 971 phcaz = fAz->PosHasChanged(); 942 972 usleep(1); 943 } while (!phca1 && !phca2 && !phcaz); 973 } while (!phca1 && !phca2 && !phcaz && fTracking); 974 944 975 //---usleep(100000); // 0.1s 945 976 … … 975 1006 sla.SetMjd(time.Zd()); 976 1007 sollzd = CorrectTarget(ist, sla.CalcZdAz(fRaDec)); // [se] 1008 1009 fOffset.Zd(fOffset.Zd()*(1.-weight)+(ist.Zd()*kGearRatio.X()-istre.Zd())*weight); 977 1010 } 978 1011 … … 981 1014 sla.SetMjd(time.Az()); 982 1015 sollaz = CorrectTarget(ist, sla.CalcZdAz(fRaDec)); // [se] 1016 1017 fOffset.Az(fOffset.Az()*(1.-weight)+(ist.Az()*kGearRatio.Y()-istre.Az())*weight); 983 1018 } 984 1019 … … 1063 1098 // Create Nodes 1064 1099 // 1100 lout << "- Setting up network." << endl; 1101 1065 1102 fMac1=new Macs(1, "Mac.1/Az", lout); 1066 1103 fMac2=new Macs(2, "Mac.2/Zd", lout); … … 1084 1121 // Create Gui Event timer and Gui 1085 1122 // 1123 lout << "- Initializing GUI Timer." << endl; 1086 1124 fUpdateGui = new TTimer(this, 100); // 100ms 1087 1125 1126 lout << "- Starting GUI." << endl; 1088 1127 fWin=new MGCosy(this, gClient->GetRoot(), 1, 1); 1089 1128 … … 1108 1147 */ 1109 1148 1149 lout.DisableOutputDevice(MLog::eGui); 1150 lout.SetOutputGui(NULL, kFALSE); 1151 1110 1152 gApplication->Terminate(0); 1111 1153 } -
trunk/MagicSoft/Cosy/main/MCosy.h
r1111 r1275 15 15 #define WM_STOP 0x1003 16 16 #define WM_POLARIS 0x1004 17 #define WM_QUIT 0x100518 17 19 18 class ShaftEncoder; … … 33 32 { 34 33 SetPriority(10); 34 Detach(); 35 35 Start(); 36 36 } 37 ~MTTalk() { cout << "~MTTalk::MTTalk" << endl; } 37 38 }; 38 39 … … 41 42 class MCosy : public Network, public MsgQueue, public TObject 42 43 { 43 friend class MTGui;44 44 friend class MTTalk; 45 45 … … 94 94 95 95 void TalkThread(); 96 void GuiThread(MTGui *t);97 96 98 97 int SetPosition(const ZdAz &dst);
Note:
See TracChangeset
for help on using the changeset viewer.