Changeset 1699 for trunk/MagicSoft
- Timestamp:
- 01/08/03 17:21:33 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/.cosyrc
r909 r1699 12 12 Zd_Min[Deg]: -70.0 13 13 Zd_Max[Deg]: +70.0 14 15 Az_GearRatio[U_mot/U_tel]: 5891.7 16 Zd_GearRatio[U_mot/U_tel]: 2475.6 17 18 Az_ResRE[re/U_mot]: 500 19 Zd_ResRE[re/U_mot]: 500 20 21 Az_Id-MAC1: 1 22 Az_Id-MAC2: 3 23 Zd_Id-MAC: 2 24 25 Zd_Id-MAC1: 4 26 Zd_Id-MAC2: 5 27 Az_Id-MAC: 6 28 29 30 -
trunk/MagicSoft/Cosy/Changelog
r1675 r1699 1 1 -*-*- END -*-*- 2 3 2003/01/08 - Thomas Bretz: 4 5 * bending.txt: 6 - added (preliminary) 7 8 * .cosyrc: 9 - added 10 > Az_GearRatio[U_mot/U_tel]: 5891.7 11 > Zd_GearRatio[U_mot/U_tel]: 2475.6 12 > Az_ResRE[re/U_mot]: 500 13 > Zd_ResRE[re/U_mot]: 500 14 > Az_Id-MAC1: 1 15 > Az_Id-MAC2: 3 16 > Zd_Id-MAC: 2 17 > Zd_Id-MAC1: 4 18 > Zd_Id-MAC2: 5 19 > Az_Id-MAC: 6 20 21 * Makefile: 22 - removed cosy.so 23 24 * Makefile.conf.linux-gnu: 25 - removed optimization (causes problems) --> TO BE FIXED 26 27 * candrv/canopen.h: 28 - added return value to WaitForSDO 29 30 * devdrv/macs.cc: 31 - fixed a typo 32 33 * gui/MGCosy.cc: 34 - added 'Reset Bending' 35 36 * main/MBending.[h,cc] 37 - added Reset 38 - fixed a problem with the units in the correction 39 - added CorrectBack functions 40 41 * main/MCosy.[h,cc]: 42 - changed the bahaviour in case no MAC3 is found 43 - fixed that the MAC3 didn't synchronize anymore 44 - added the bending correction to the displayed position 45 - added a workaround for the wrong (0) Gear Ratios --> TO BE FIXED 46 - added Reset Bending 47 - changed the MAC and SE Id to be a resource value (from .cosyrc) 48 49 50 2 51 2002/11/12 - Thomas Bretz (LaPalma): 3 52 -
trunk/MagicSoft/Cosy/Makefile
r1692 r1699 21 21 22 22 PROGRAMS = cosy starg 23 SOLIB = cosy.so23 SOLIB = 24 24 CINT = M 25 25 INCLUDES = -I. -Imain -Ibase -Icandrv -Iincl -Igui -Ivideodev -Icatalog -
trunk/MagicSoft/Cosy/Makefile.conf.linux-gnu
r1275 r1699 20 20 # 21 21 22 OPTIM = -O2 -Wall -fno-rtti -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual -D_REENTRANT 22 #-O2 23 OPTIM = -Wall -fno-rtti -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual -D_REENTRANT 23 24 DEBUG = -g 24 25 -
trunk/MagicSoft/Cosy/candrv/vmodican.cc
r1275 r1699 940 940 exit(1); // open module 941 941 } 942 942 943 Reset(); 943 944 EnableFifo(); // connect to host (in interrupt mode) -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1690 r1699 182 182 case 0: 183 183 lout << ddev(MLog::eGui); 184 lout << "- Relative positioning started (" << GetNodeName() << ")" << endl;184 lout << "- Absolute positioning started (" << GetNodeName() << ")" << endl; 185 185 lout << edev(MLog::eGui); 186 186 return; … … 188 188 case 1: 189 189 lout << ddev(MLog::eGui); 190 lout << "- Absolute positioning started (" << GetNodeName() << ")" << endl;190 lout << "- Relative positioning started (" << GetNodeName() << ")" << endl; 191 191 lout << edev(MLog::eGui); 192 192 return; -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1690 r1699 51 51 kPB_DECm, 52 52 kPB_LoadBending, 53 kPB_ResetBending, 53 54 kPB_CALIBSE 54 55 }; … … 337 338 but = new TGTextButton(tf4, "TPoint", kPB_TPOINT); 338 339 but->Resize(80, 25); 339 but->Move(25, 19 7);340 but->Move(25, 190); 340 341 but->SetToolTipText("Trigger writing a tpoint coordinate pair."); 341 342 but->Associate(this); … … 351 352 but = new TGTextButton(tf4, "Load", kPB_LoadBending); 352 353 but->Resize(80, 25); 353 but->Move(25, 22 7);354 but->Move(25, 220); 354 355 but->SetToolTipText("Load bending corrections from file 'bending.txt'"); 356 but->Associate(this); 357 fList->Add(but); 358 359 but = new TGTextButton(tf4, "Reset", kPB_ResetBending); 360 but->Resize(80, 25); 361 but->Move(25, 250); 362 but->SetToolTipText("Reset bending correction (coefficients=0)"); 355 363 but->Associate(this); 356 364 fList->Add(but); … … 681 689 fVelocity->Update(vel); 682 690 UpdateOffset(off); 683 684 691 685 692 #define kError 0x01 … … 962 969 fQueue->Proc(WM_LOADBENDING, NULL); 963 970 return kTRUE; 971 case kPB_ResetBending: 972 fQueue->Proc(WM_RESETBENDING, NULL); 973 return kTRUE; 964 974 965 975 default: -
trunk/MagicSoft/Cosy/main/MBending.cc
r1393 r1699 7 7 8 8 ClassImp(MBending); 9 10 void MBending::Reset() 11 { 12 fIa = 0; 13 fIe = 0; 14 fCa = 0; 15 fAn = 0; 16 fAw = 0; 17 fNrx = 0; 18 fNry = 0; 19 fCrx = 0; 20 fCry = 0; 21 fNpae = 0; 22 fEces = 0; 23 fAces = 0; 24 fEcec = 0; 25 fAcec = 0; 26 } 9 27 10 28 void MBending::Load(const char *name) … … 141 159 p += NPAE; 142 160 143 const AltAz I(fIe *kDeg2Rad, fIa*kDeg2Rad);161 const AltAz I(fIe/**kDeg2Rad*/, fIa/**kDeg2Rad*/); 144 162 p += I; 163 164 return p; 165 } 166 167 AltAz MBending::CorrectBack(const AltAz &aa) const 168 { 169 // Correct [rad] 170 // zdaz [rad] 171 AltAz p = aa; 172 173 const AltAz CES(-fEces*kDeg2Rad*sin(p.Alt()), -fAces*kDeg2Rad*sin(p.Az())); 174 const AltAz CEC(-fEcec*kDeg2Rad*cos(p.Alt()), -fAcec*kDeg2Rad*cos(p.Az())); 175 p -= CES; 176 p -= CEC; 177 178 const AltAz CRX(-fCrx*kDeg2Rad*sin(p.Az()-p.Alt()), fCrx*kDeg2Rad*cos(p.Az()-p.Alt())/cos(p.Alt())); 179 const AltAz CRY(-fCry*kDeg2Rad*cos(p.Az()-p.Alt()), -fCry*kDeg2Rad*sin(p.Az()-p.Alt())/cos(p.Alt())); 180 p -= CRX; 181 p -= CRY; 182 183 const AltAz NRX(fNrx*kDeg2Rad*sin(p.Alt()), -fNrx*kDeg2Rad); 184 const AltAz NRY(fNry*kDeg2Rad*cos(p.Alt()), -fNry*kDeg2Rad*tan(p.Alt())); 185 p -= NRX; 186 p -= NRY; 187 188 const AltAz AW( fAw*kDeg2Rad*sin(p.Az()), -fAw*kDeg2Rad*cos(p.Az())*tan(p.Alt())); 189 const AltAz AN(-fAn*kDeg2Rad*cos(p.Az()), -fAn*kDeg2Rad*sin(p.Az())*tan(p.Alt())); 190 p -= AW; 191 p -= AN; 192 193 const AltAz CA(0, -fCa*kDeg2Rad/cos(p.Alt())); 194 p -= CA; 195 196 const AltAz NPAE(0, -fNpae*kDeg2Rad*tan(p.Alt())); 197 p -= NPAE; 198 199 const AltAz I(fIe/**kDeg2Rad*/, fIa/**kDeg2Rad*/); 200 p -= I; 145 201 146 202 return p; … … 156 212 } 157 213 214 ZdAz MBending::CorrectBack(const ZdAz &zdaz) const 215 { 216 // Correct [rad] 217 // zdaz [rad] 218 AltAz p(TMath::Pi()/2-zdaz.Zd(), zdaz.Az()); 219 AltAz c = CorrectBack(p); 220 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az()); 221 } 222 158 223 void MBending::SetParameters(const Double_t *par, Int_t n=14) 159 224 { -
trunk/MagicSoft/Cosy/main/MBending.h
r1393 r1699 52 52 void Save(const char *name); 53 53 54 void Reset(); 55 54 56 ZdAz Correct(const ZdAz &zdaz) const; 55 57 AltAz Correct(const AltAz &aaz) const; 58 59 ZdAz CorrectBack(const ZdAz &zdaz) const; 60 AltAz CorrectBack(const AltAz &aaz) const; 56 61 57 62 ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); } -
trunk/MagicSoft/Cosy/main/MCosy.cc
r1691 r1699 378 378 // FIXME: Correct by fOffset ? 379 379 380 if (!(fMac1 && fMac2 && fMac3))380 if (!(fMac1 && fMac2)) 381 381 { 382 382 cout << "SetPosition: No MACS!" << endl; … … 395 395 // const ZdAz dest = CorrectTarget(src, dst); 396 396 // 397 const ZdAz dest = fBending(dst)*16384/2/TMath::Pi(); 397 const ZdAz bend = fBending(dst); 398 const ZdAz dest = bend*16384/2/TMath::Pi(); 398 399 399 400 lout << "Positioning to Target..." << endl; 400 //cout << "Source Zd: " << src.Zd() << "se Az:" << src.Az() << "se" << endl; 401 //cout << "Destination Zd: " << Rad2SE(dst.Zd()) << "se Az:" << Rad2SE(dst.Az()) << "se" << endl; 401 cout << "Source Zd: " << src.Zd() << "se Az:" << src.Az() << "se" << endl; 402 cout << "Destination Zd: " << Rad2SE(dst.Zd()) << "se Az:" << Rad2SE(dst.Az()) << "se" << endl; 403 cout << "Bend'd Dest Zd: " << Rad2SE(bend.Zd()) << "se Az:" << Rad2SE(bend.Az()) << "se" << endl; 402 404 cout << "Shortest Dest Zd: " << dest.Zd() << "se Az:" << dest.Az() << "se" << endl; 403 405 … … 450 452 451 453 /* 452 cout << " + " << cdzd << " " <<cdaz << endl;454 cout << " + " << (int)cdzd << " " << (int)cdaz << endl; 453 455 cout << " + APOS: Zd=" << setw(6) << p.Zd() << "se Az=" << setw(6) << p.Az() << "se" << endl; 454 456 cout << " + dZd=" << setw(6) << cd.Zd() << "se dAz=" << setw(6) << cd.Az() << "se" << endl; 455 457 cout << " + dZd=" << setw(6) << rd.Zd() << "re dAz=" << setw(6) << rd.Az() << "re" << endl; 456 */ 458 cout << " + Ratio: Zd=" << setw(6) << kGearRatio.X() << "se Az=" << setw(6) << kGearRatio.Y() << "se" << endl; 459 */ 457 460 458 461 // … … 653 656 fRaDec = dst; 654 657 655 if (!(fMac1 && fMac2 && fMac3))658 if (!(fMac1 && fMac2)) 656 659 return; 657 660 … … 855 858 fAz->SetPreset(za.Az()); 856 859 857 cout << "WM_ Polaris: done. (return 0xaffe)" << endl;860 cout << "WM_Calib: done. (return 0xaffe)" << endl; 858 861 } 859 862 return (void*)0xaffe; … … 914 917 cout << "WM_LoadBending: done. (return 0xbe0d)" << endl; 915 918 return (void*)0xbe0d; 919 920 case WM_RESETBENDING: 921 cout << "WM_ResetBending: START" << endl; 922 fBending.Reset(); 923 cout << "WM_ResetBending: done. (return 0xbe0e)" << endl; 924 return (void*)0xbe0e; 916 925 917 926 case WM_CALCALTAZ: … … 995 1004 resseaz = env.GetValue("Az_ResSE[se/U_mot]", 16384); 996 1005 1006 /* WORKAROUND !!!!!!!!!!!!! FIXME !!!!!!!!!!! */ 1007 resrezd = 500; 1008 resreaz = 500; 1009 997 1010 kGearRatio.Set (gzd*resrezd/ressezd, gaz*resreaz/resseaz); //[re/se] 998 1011 kGearRatio2.Set(gzd*resrezd/360.0, gaz*resreaz/360.0); //[re/deg] 999 1012 cout << "done." << endl; 1013 1014 cout << "Setting Gear Ratios:" << endl; 1015 cout << "--------------------" << endl; 1016 cout << " X: " << gzd << "*" << resrezd << "/" << ressezd << "=" << kGearRatio.X() << endl; 1017 cout << " Y: " << gaz << "*" << resreaz << "/" << resseaz << "=" << kGearRatio.Y() << endl; 1000 1018 } 1001 1019 1002 1020 void MCosy::TalkThread() 1003 1021 { 1004 if (!(fMac1 && fMac2 && fMac3))1022 if (!(fMac1 && fMac2)) 1005 1023 return; 1006 1024 1007 1025 fMac1->ReqPos(); 1008 1026 fMac2->ReqPos(); 1027 1028 if (fMac3) 1029 { 1030 const int res = fMac3->GetVelRes(); 1031 1032 fMac3->SetVelocity(res); 1033 fMac3->SetAcceleration(res); 1034 fMac3->SetDeceleration(res); 1035 fMac3->StartPosSync(); 1036 } 1037 1038 fMac1->EnableTimeout(kTRUE, 500); 1039 fMac2->EnableTimeout(kTRUE, 500); 1040 1041 if (!(fZd1 && fZd2 && fAz)) 1042 return; 1043 1044 /* 1045 // 1046 // Start the Network 1047 // 1048 cout << "Reading configuration file..." << flush; 1049 TEnv env(".cosyrc"); 1050 cout << "done." << endl; 1009 1051 1010 1052 const int res = fMac3->GetVelRes(); … … 1013 1055 fMac3->SetAcceleration(res); 1014 1056 fMac3->SetDeceleration(res); 1015 1016 fMac1->EnableTimeout(kTRUE, 500);1017 fMac2->EnableTimeout(kTRUE, 500);1018 1019 if (!(fZd1 && fZd2 && fAz))1020 return;1021 1022 /*1023 //1024 // Start the Network1025 //1026 cout << "Reading configuration file..." << flush;1027 TEnv env(".cosyrc");1028 cout << "done." << endl;1029 1030 const int res = fMac3->GetVelRes();1031 1032 fMac3->SetVelocity(res);1033 fMac3->SetAcceleration(res);1034 fMac3->SetDeceleration(res);1035 1036 fMac3->StartPosSync();1037 1057 1038 1058 cout << "Going Home..." << endl; … … 1224 1244 if (fAz) fAz->DisplayVal(); 1225 1245 1226 ZdAz ist = GetSePos()*(360.0/16384.0); // [se] 1227 1228 fWin->Update(ist, fTrackingError/kGearRatio2, 1246 ZdAz seist = GetSePos()*2*TMath::Pi()/16384; // [se] 1247 ZdAz bendist = fBending.CorrectBack(seist); 1248 1249 fWin->Update(bendist*(360.0/2/TMath::Pi()), fTrackingError/kGearRatio2, 1229 1250 fVelocity, fOffset/*/kGearRatio2*/, 1230 1251 fStatus); … … 1297 1318 } 1298 1319 1299 void MCosy::Constructor() 1320 // -------------------------------------------------------------------------- 1321 // 1322 // Disable the synchronization by using a negative CAN Id for id2. 1323 // 1324 void MCosy::Constructor(Int_t id1, Int_t id2, Int_t id3, 1325 Int_t id4, Int_t id5, Int_t id6) 1300 1326 { 1301 1327 // … … 1304 1330 lout << "- Setting up network." << endl; 1305 1331 1306 fMac1=new Macs(1, "Mac.1/Az", lout); 1307 fMac3=new Macs(2, "Mac.3/Az-Sync", lout); 1308 fMac2=new Macs(3, "Mac.2/Zd", lout); 1309 1310 fZd1=new ShaftEncoder(5, "SE.5/Zd1", lout); 1311 fZd2=new ShaftEncoder(6, "SE.6/Zd2", lout); 1312 fAz =new ShaftEncoder(7, "SE.7/Az", lout); 1332 fMac1=new Macs(id1, "Mac/Az", lout); 1333 fMac2=new Macs(id3, "Mac/Zd", lout); 1334 if (id2>=0) 1335 fMac3=new Macs(id2, "Mac/Az-Sync", lout); 1336 1337 fZd1=new ShaftEncoder(id4, "SE/Zd1", lout); 1338 fZd2=new ShaftEncoder(id5, "SE/Zd2", lout); 1339 fAz =new ShaftEncoder(id6, "SE/Az", lout); 1313 1340 1314 1341 lout << "- Connecting devices to network." << endl; … … 1319 1346 SetNode(fMac1); 1320 1347 SetNode(fMac2); 1321 SetNode(fMac3); 1348 if (id2>=0) 1349 SetNode(fMac3); 1322 1350 SetNode(fZd1); 1323 1351 SetNode(fZd2); … … 1340 1368 } 1341 1369 1342 void MCosy::ConstructorSE( )1370 void MCosy::ConstructorSE(Int_t id4, Int_t id5, Int_t id6) 1343 1371 { 1344 1372 // … … 1347 1375 lout << "- Setting up network." << endl; 1348 1376 1349 fZd1=new ShaftEncoder( 5, "SE.5/Zd1", lout);1350 fZd2=new ShaftEncoder( 6, "SE.6/Zd2", lout);1351 fAz =new ShaftEncoder( 7, "SE.7/Az", lout);1377 fZd1=new ShaftEncoder(id4, "SE/Zd1", lout); 1378 fZd2=new ShaftEncoder(id5, "SE/Zd2", lout); 1379 fAz =new ShaftEncoder(id6, "SE/Az", lout); 1352 1380 1353 1381 lout << "- Connecting devices to network." << endl; … … 1383 1411 lout << "- Setting up network." << endl; 1384 1412 1385 /*1386 fMac1=new Macs(1, "Mac.1/Az", lout);1387 fMac2=new Macs(2, "Mac.2/Zd", lout);1388 fMac3=new Macs(3, "Mac.3/Az-Sync", lout);1389 1390 fZd1=new ShaftEncoder(4, "SE.4/Zd1", lout);1391 fZd2=new ShaftEncoder(5, "SE.5/Zd2", lout);1392 fAz =new ShaftEncoder(6, "SE.6/Az", lout);1393 1394 lout << "- Connecting devices to network." << endl;1395 1396 //1397 // Connect the devices to the network1398 //1399 SetNode(fMac1);1400 SetNode(fMac2);1401 SetNode(fMac3);1402 SetNode(fZd1);1403 SetNode(fZd2);1404 SetNode(fAz);1405 */1406 1413 // 1407 1414 // Create Gui Event timer and Gui … … 1412 1419 lout << "- Starting GUI." << endl; 1413 1420 fWin=new MGCosy(this, gClient->GetRoot(), 1, 1); 1414 /* 1415 fAz->SetDisplay(fWin->GetLabel1()); 1416 fZd1->SetDisplay(fWin->GetLabel2()); 1417 fZd2->SetDisplay(fWin->GetLabel3()); 1418 */ 1421 1419 1422 lout.SetOutputGui(fWin->GetLog(), kTRUE); 1420 1423 } 1421 1424 1422 1425 MCosy::MCosy(int mode, const char *dev, const int baud, MLog &out) 1423 : Network(dev, baud, out), fTracking(kFALSE) 1424 { 1426 : Network(dev, baud, out), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fTracking(kFALSE) 1427 { 1428 TEnv env(".cosyrc"); 1429 const Int_t id1 = env.GetValue("Az_Id-MAC1", 1); //1 1430 const Int_t id2 = env.GetValue("Az_Id-MAC2", 2); //2 1431 const Int_t id3 = env.GetValue("Zd_Id-MAC", 3); //3 1432 const Int_t id4 = env.GetValue("Zd_Id-SE1", 4); //4 1433 const Int_t id5 = env.GetValue("Zd_Id-SE2", 5); //5 1434 const Int_t id6 = env.GetValue("Az_Id-SE", 6); //6 1435 1425 1436 lout << "- Program in "; 1426 1437 switch (mode) … … 1428 1439 case 0: 1429 1440 lout << "<<Stanard mode>>" << endl; 1430 Constructor( );1441 Constructor(id1, id2, id3, id4, id5, id6); 1431 1442 break; 1432 1443 case 1: 1433 1444 lout << "<<SE mode>>" << endl; 1434 ConstructorSE( );1445 ConstructorSE(id4, id5, id6); 1435 1446 break; 1436 1447 default: -
trunk/MagicSoft/Cosy/main/MCosy.h
r1691 r1699 10 10 #define kDEG ((char)0x9c) // Linux 'ø' 11 11 12 #define WM_WAIT WM_NULL 13 #define WM_PRESET 0x1000 14 #define WM_POSITION 0x1001 15 #define WM_TRACK 0x1002 16 #define WM_STOP 0x1003 17 #define WM_CALIB 0x1004 18 #define WM_TPOINT 0x1005 19 #define WM_NEWTRACK 0x1006 20 #define WM_LOADBENDING 0x1007 21 #define WM_CALCALTAZ 0x1008 12 #define WM_WAIT WM_NULL 13 #define WM_PRESET 0x1000 14 #define WM_POSITION 0x1001 15 #define WM_TRACK 0x1002 16 #define WM_STOP 0x1003 17 #define WM_CALIB 0x1004 18 #define WM_TPOINT 0x1005 19 #define WM_NEWTRACK 0x1006 20 #define WM_LOADBENDING 0x1007 21 #define WM_RESETBENDING 0x1008 22 #define WM_CALCALTAZ 0x1009 22 23 23 24 class ShaftEncoder; … … 125 126 void WaitForEndMovement(); 126 127 127 void Constructor( );128 void ConstructorSE( );128 void Constructor(Int_t id1, Int_t id2, Int_t id3, Int_t id4, Int_t id5, Int_t id6); 129 void ConstructorSE(Int_t id1, Int_t id2, Int_t id3); 129 130 void ConstructorDemo(); 130 131
Note:
See TracChangeset
for help on using the changeset viewer.