- Timestamp:
- 08/17/01 15:12:57 (23 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 6 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r911 r912 1 1 -*-*- END -*-*- 2 3 2001/08/17 - Thomas Bretz: 4 5 * Added: 6 - catalog/SlaStars.cc 7 - catalog/SlaStars.h 8 - catalog/SlaPlanets.cc 9 - catalog/SlaPlanets.h 10 - gui/MGAccuracy.cc 11 - gui/MGAccuracy.h 12 13 * MCosy.[h,cc]: 14 - removed dependance from MGSkyPosition 15 - changed Timer function names 16 - moved timer calls into Slalib calls 17 - changed Slalib to SlaStars 18 - added fAccuracy 19 - added accuracy display to MTGui 20 21 * Makefile: 22 - changed order of libraries 23 24 * Starguider.cc: 25 - changed Timer function names 26 27 * base/timer.[h,cc] 28 - changed GetTime -> Now 29 - changed GetMjd -> CalcMjd 30 31 * catalog/Makefile: 32 - added new file SlaStars.cc 33 - added new file SlaPlanets.cc 34 35 * catalog/Slalib.[h,cc]: 36 - moved star dependent functions to derived class SlaStars 37 - changed name of Set to SetMjd 38 - made SetMjd virtual 39 - derives from Timer now 40 - added conversion function for XYZ->ZdAz 41 42 * catalog/StarCatalog.cc: 43 - moved timer calls into Slalib calls 44 - changed Slalib to SlaStars 45 46 * devdrv/macs.cc: 47 - changed names of timer function calls 48 49 * devdrv/shaftencoder.cc: 50 - changed names of timer function calls 51 - changed some cout's to lout's 52 53 * gui/MGCosy.[h,cc]: 54 - added fAccuracy 55 - moved timer calls into Slalib calls 56 - changed Slalib to SlaStars 57 58 * gui/MGSkyPosition.[h,cc]: 59 - added display of planet positions 60 61 * slalib/Makefile: 62 - added missing files 63 64 65 66 2 67 2001/08/15 - Thomas Bretz: 3 68 4 * Added:5 - Makefile.conf.general6 - gui/Makefile7 - base/Makefile8 - candrv/Makefile9 - catalog/Makefile10 - slalib/Makefile11 - videodev/Makefile12 - devdrv/Makefile13 - base/MThread.[h,cc]14 - base/MTimeout.[h, cc]15 - mgui/MGSkyPosition.[h, cc]16 - catalog/Slalib.[h,cc]69 * Added: 70 - Makefile.conf.general 71 - gui/Makefile 72 - base/Makefile 73 - candrv/Makefile 74 - catalog/Makefile 75 - slalib/Makefile 76 - videodev/Makefile 77 - devdrv/Makefile 78 - base/MThread.[h,cc] 79 - base/MTimeout.[h, cc] 80 - mgui/MGSkyPosition.[h, cc] 81 - catalog/Slalib.[h,cc] 17 82 18 * .cosyrc:19 - changed names20 - added HomeTime21 22 * MCosy.[h,cc]:23 - added home time24 - added MTGui, MTTalk25 - added reading environment26 27 * Makefile, Makefile.conf.linux-gnu, Makefile.rules28 - changed to Mars style29 30 * Starguider.cc:31 - changed include timer.g to base/timer.h32 33 * Starguider.[h,cc]:34 - renamed Execute to ProcessFrame83 * .cosyrc: 84 - changed names 85 - added HomeTime 86 87 * MCosy.[h,cc]: 88 - added home time 89 - added MTGui, MTTalk 90 - added reading environment 91 92 * Makefile, Makefile.conf.linux-gnu, Makefile.rules 93 - changed to Mars style 94 95 * Starguider.cc: 96 - changed include timer.g to base/timer.h 97 98 * Starguider.[h,cc]: 99 - renamed Execute to ProcessFrame 35 100 36 * cosy.cc:37 - removed unnecessary includes38 39 * base/MGList.h:40 - added debug output41 42 * base/msgqueue.cc:43 - added comments44 45 * base/msgqueue.h:46 - made Break const47 48 * candrv/canopen.[h,cc]:49 - made CobId const50 51 * candrv/network.[h,cc]:52 - fixed typo53 - StopReceiver -> VmodIcan::Stop54 - made HasError const55 56 * candrv/nodedrv.[h,cc]:57 - added timeout to WaitForSdo58 59 * candrv/sdolist.[h,cc]:60 - made IsPending const101 * cosy.cc: 102 - removed unnecessary includes 103 104 * base/MGList.h: 105 - added debug output 106 107 * base/msgqueue.cc: 108 - added comments 109 110 * base/msgqueue.h: 111 - made Break const 112 113 * candrv/canopen.[h,cc]: 114 - made CobId const 115 116 * candrv/network.[h,cc]: 117 - fixed typo 118 - StopReceiver -> VmodIcan::Stop 119 - made HasError const 120 121 * candrv/nodedrv.[h,cc]: 122 - added timeout to WaitForSdo 123 124 * candrv/sdolist.[h,cc]: 125 - made IsPending const 61 126 62 * candrv/vmodican.[h,cc]:63 - changed ReceiveThread to new stylish MThread64 65 * devdrv/macs.[h,cc]:66 - changed SetHome to use a maximum positioning time67 - added comments68 - replaces SetSyncMode by StartPosSync and StartVelSync69 70 * devdrv/shaftencoder.[h,cc]:71 - removed gui thread (the update is done by MTGui now)72 73 * gui/MGCosy.[h,cc]:74 - some small changed75 - removed fList->Delete()76 - added MSkyPosition-Object77 - gSystem->ExitLoop() replaced by gSystem->Terminate(0)78 79 * videodev/Camera.[h,cc]:80 - renamed Execute to ProcessFrame127 * candrv/vmodican.[h,cc]: 128 - changed ReceiveThread to new stylish MThread 129 130 * devdrv/macs.[h,cc]: 131 - changed SetHome to use a maximum positioning time 132 - added comments 133 - replaces SetSyncMode by StartPosSync and StartVelSync 134 135 * devdrv/shaftencoder.[h,cc]: 136 - removed gui thread (the update is done by MTGui now) 137 138 * gui/MGCosy.[h,cc]: 139 - some small changed 140 - removed fList->Delete() 141 - added MSkyPosition-Object 142 - gSystem->ExitLoop() replaced by gSystem->Terminate(0) 143 144 * videodev/Camera.[h,cc]: 145 - renamed Execute to ProcessFrame 81 146 82 147 -
trunk/MagicSoft/Cosy/MCosy.cc
r909 r912 11 11 12 12 #include "MGCosy.h" 13 #include "Sla lib.h"13 #include "SlaStars.h" 14 14 15 15 #include "macs.h" 16 16 #include "base/timer.h" 17 17 #include "shaftencoder.h" 18 19 #include "MGSkyPosition.h" // FIXME!!!!!!!!!!!!!!!!!20 18 21 19 //#include <sys/resource.h> // PRIO_PROCESS … … 265 263 void MCosy::TrackPosition(const RaDec &dst) // ra, dec [rad] 266 264 { 267 Sla libsla;265 SlaStars sla; 268 266 269 267 // 270 268 // Position to actual position 271 269 // 272 Timer t; 273 t.GetTime(); 274 275 sla.Set(t.GetMjd()); 270 sla.SetMjd2Now(); 276 271 ZdAz dest = sla.CalcZdAz(dst); 277 272 … … 311 306 fMac1->SetRpmMode(TRUE); 312 307 313 /*-*/ int s = t.GetSecs();308 /*-*/ int s = sla.GetSecs(); 314 309 cout << "Start tracking: Ra: " << Rad2Deg(dst.Ra()) << kDEG << " Dec: "; 315 310 cout << Rad2Deg(dst.Dec()) << kDEG << endl; … … 333 328 // Request Real Position from Drive 334 329 // 335 Timer t; 336 t.GetTime(); 330 sla.Now(); 337 331 338 332 // 339 333 // Request theoretical Position for a time in the future (To+dt) from CPU 340 334 // 341 sla.Set (t.GetMjd()+dt/(60*60*24));335 sla.SetMjd(sla.CalcMjd()+dt/(60*60*24)); 342 336 dest = CorrectTarget(GetSePos(), sla.CalcZdAz(dst)); 343 337 … … 367 361 // correct for the duration of RaDec2AltAz 368 362 // 369 const ZdAz v = dest*60.0/(dt-(fMac2->GetTime()- t));363 const ZdAz v = dest*60.0/(dt-(fMac2->GetTime()-sla)); 370 364 371 365 // … … 404 398 { 405 399 const double mjd = fMac2->GetMjd(); 406 sla.Set (mjd);400 sla.SetMjd(mjd); 407 401 ZdAz dest0=CorrectTarget(GetSePos(), sla.CalcZdAz(dst)); 408 402 dest0 *= kGearRatio; 409 403 dest0 -= GetRePos()+offset; 410 404 dest0.Round(); 405 406 fAccuracy = dest0/kGearRatio2; // [deg] 407 411 408 //cout << "Control deviation: "; 412 409 fout << setprecision(15) << setw(15) << mjd*60.*60.*24. << " "; 413 410 fout << setw(4) << (int)fOffset.Zd() << " "; 414 411 fout << setw(4) << (int)fOffset.Az() << " "; 415 416 412 fout << setw(4) << dest0.Zd() << " "; 417 413 fout << setw(4) << dest0.Az() << " "; … … 478 474 { 479 475 cout << "WM_POLARIS: START" << endl; 480 Slalib sla; 481 482 Timer t; 483 t.GetTime(); 484 485 sla.Set(t.GetMjd()); 476 SlaStars sla; 477 sla.SetMjd2Now(); 486 478 487 479 RaDec rd(37.94, 89.2644); … … 608 600 // SetPosition(dest); 609 601 610 Sla libsla;602 SlaStars sla; 611 603 while (1) 612 604 { … … 665 657 // calculate were we should be 666 658 // 667 sla.Set (t);659 sla.SetMjd(t); 668 660 sollalt = CorrectTarget(ist, sla.CalcZdAz(fRaDec)); 669 661 … … 684 676 // calculate were we should be 685 677 // 686 sla.Set (t);678 sla.SetMjd(t); 687 679 sollaz = CorrectTarget(ist, sla.CalcZdAz(fRaDec)); 688 680 … … 695 687 void MCosy::GuiThread(MTGui *t) 696 688 { 697 MGSkyPosition *disp = fWin->GetSkyDisplay();698 689 while (!t->HasStopFlag()) 699 690 { … … 707 698 708 699 ZdAz ist = GetSePos()*(360.0/16384.0); // [se] 709 disp->DrawPosition(ist); 700 fWin->Update(ist, fAccuracy); 701 710 702 } 711 703 cout << "Not running anymore." << endl; … … 714 706 int MCosy::StopWaitingForSDO() const 715 707 { 716 return Break() || HasError(); //fMac1->HasError() || fMac2->HasError();708 return Break() || HasError(); 717 709 } 718 710 … … 773 765 { 774 766 cout << "MCosy::TerminateApp()" << endl; 767 /* 768 Int_t rc; 769 TGMessageBox msg(this, gClient->GetRoot(), 770 "Information", 771 "Cosy is shutting down the system - this may take wa while!", 772 kMBIconExclamation, 773 kMBOK, //kMBClose 774 &rc, 0); 775 */ 776 775 777 gApplication->Terminate(0); 776 778 } -
trunk/MagicSoft/Cosy/MCosy.h
r909 r912 74 74 RaDec fRaDec; // Position to track 75 75 int fTracking; // Flag for present tracking action 76 ZdAz fAccuracy; // Actual accuracy of Tracking 76 77 77 78 ZdAz GetRePos(); -
trunk/MagicSoft/Cosy/Makefile
r911 r912 38 38 # 39 39 SUBDIRS = \ 40 gui \ 40 41 candrv \ 42 devdrv \ 41 43 catalog \ 42 devdrv \43 gui \44 44 videodev \ 45 45 base \ -
trunk/MagicSoft/Cosy/Starguider.cc
r909 r912 336 336 337 337 Timer time(tm); 338 fSao.GetImg(img, cimg, time. GetMjd(), fRaDec);338 fSao.GetImg(img, cimg, time.CalcMjd(), fRaDec); 339 339 fImage->DrawColImg(img, cimg); 340 340 -
trunk/MagicSoft/Cosy/base/timer.cc
r738 r912 45 45 } 46 46 47 void Timer::SetTimer( struct timeval *tv)47 void Timer::SetTimer(const struct timeval *tv) 48 48 { 49 49 SetTimer(tv->tv_sec, (double)tv->tv_usec/1000000.0); … … 75 75 } 76 76 77 double Timer:: GetTime()77 double Timer::Now() 78 78 { 79 79 struct timeval tv; 80 80 gettimeofday(&tv, NULL); 81 81 82 SetTimer( tv.tv_sec, (double)tv.tv_usec/1000000.0);82 SetTimer(&tv); 83 83 84 84 return fMs+fSecs; 85 85 } 86 86 87 double Timer:: GetMjd()87 double Timer::CalcMjd() 88 88 { 89 89 int status; -
trunk/MagicSoft/Cosy/base/timer.h
r808 r912 27 27 28 28 void SetTimer(int tv_sec, double tv_usec); 29 void SetTimer( struct timeval *tv);29 void SetTimer(const struct timeval *tv); 30 30 31 31 32 32 int GetSecs() { return fSecs; } 33 double GetTime();34 double GetMjd();33 double Now(); 34 double CalcMjd(); 35 35 36 36 int H() const { return fHor; } -
trunk/MagicSoft/Cosy/catalog/Makefile
r911 r912 33 33 SRCFILES = SaoFile.cc \ 34 34 Slalib.cc \ 35 SlaStars.cc \ 36 SlaPlanets.cc \ 35 37 StarCatalog.cc 36 38 -
trunk/MagicSoft/Cosy/catalog/Slalib.cc
r911 r912 6 6 #include "slalib.h" 7 7 8 Slalib::Slalib() 8 Slalib::Slalib() : Timer() 9 9 { 10 10 // p = pointer to MainFrame (not owner) … … 25 25 } 26 26 27 void Slalib::Set(const AltAz &altaz) 28 { 29 fAltAz = altaz * D2PI/360.0; 30 fRaDec = CalcRaDec(fAltAz); 31 } 32 33 void Slalib::Set(const ZdAz &zdaz) 34 { 35 fAltAz = AltAz(DPI/2-zdaz.Zd(), zdaz.Az()) * D2PI/360.0; 36 fRaDec = CalcRaDec(fAltAz); 37 } 38 39 void Slalib::Set(const RaDec &radec) 40 { 41 fRaDec = radec * D2PI/360.0; 42 fAltAz = CalcAltAz(fRaDec); 43 } 44 45 void Slalib::Set(const double mjd) 27 void Slalib::SetMjd(const double mjd) 46 28 { 47 29 fMjd = mjd; 48 30 fAlpha = slaGmst(fMjd) + fElong; 31 } 32 33 void Slalib::SetMjd2Now() 34 { 35 Now(); 36 SetMjd(CalcMjd()); 37 // cout << "GetMjd: "<< (*this)() << " " << GetMjd() << endl; 38 } 39 40 void Slalib::SetMjd(const struct timeval *tm) 41 { 42 SetTimer(tm); 43 SetMjd(CalcMjd()); 44 } 45 46 47 ZdAz Slalib::XYZ2ZdAz(double coord[3]) const 48 { 49 // 50 // -- xyz to spherical coordinates -- 51 // 52 double ra, dec; 53 slaDcc2s(coord, &ra, &dec); 49 54 50 55 // 51 // ----- calculate star independent parameters ----------56 // radec[rad] -> hadec[rad] 52 57 // 53 slaMappa(2000.0, fMjd, fAmprms); 54 slaAoppa(fMjd, 0, // mjd, UT1-UTC 55 fElong, fPhi, 148, // gttingen long, lat, height 56 0, 0, // polar motion x, y-coordinate (radians) 57 273.155, 1013.25, 0.5, // temp, pressure, humidity 58 0.2, 0.0065, // wavelength, tropo lapse rate 59 fAoprms); 60 } 61 62 RaDec Slalib::CalcRaDec(const AltAz &altaz) const 63 { 64 return CalcRaDec(ZdAz(DPI/2-altaz.Alt(), altaz.Az())); 65 } 66 67 RaDec Slalib::CalcRaDec(const ZdAz &zdaz) const 68 { 69 // 70 // -- observed to apparent -- 71 // Workaraound for slalib: discard const 72 // 73 double r=0, d=0; 74 slaOapqk ("A", zdaz.Az(), zdaz.Zd(), (double*)fAoprms, &r, &d); 58 const double ha = fAlpha-ra; 75 59 76 60 // 77 // -- apparent to mean -- 78 // Workaraound for slalib: discard const 61 // hadec[rad] -> altaz[rad] 79 62 // 80 double ra, dec;81 sla Ampqk(r, d, (double*)fAmprms, &ra, &dec);63 double alt, az; 64 slaDe2h(ha, dec, fPhi, &az, &alt); 82 65 83 return RaDec(ra, dec);66 return ZdAz(DPI/2-alt, az); 84 67 } 85 86 ZdAz Slalib::CalcZdAz(const RaDec &radec) const87 {88 //89 // ---- Mean to apparent ----90 //91 92 double r=0, d=0;93 slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d);94 //95 // Doesn't work - don't know why96 //97 // slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(),98 // 0, 0, (double*)fAmprms, &r, &d);99 //100 101 //102 // -- apparent to observed --103 //104 double r1=0; // ra105 double d1=0; // dec106 double h0=0; // ha107 108 double zd;109 double az;110 slaAopqk (r, d, (double*)fAoprms,111 &az, // observed azimuth (radians: N=0,E=90)112 &zd, // observed zenith distance (radians) [-pi/2, pi/2]113 &h0, // observed hour angle (radians)114 &d1, // observed declination (radians)115 &r1); // observed right ascension (radians)116 117 return ZdAz(zd, az);118 }119 AltAz Slalib::CalcAltAz(const RaDec &radec) const120 {121 ZdAz zdaz = CalcZdAz(radec);122 return AltAz(DPI/2-zdaz.Zd(), zdaz.Az());123 }124 -
trunk/MagicSoft/Cosy/catalog/Slalib.h
r911 r912 3 3 4 4 #include "coord.h" 5 #include "base/timer.h" 5 6 6 class Slalib 7 class Slalib : public Timer 7 8 { 8 9 private: 9 double fPhi; // location of observatory10 double fElong;11 12 AltAz fAltAz; // [rad]13 RaDec fRaDec; // [rad]14 15 10 double fAlpha; 16 11 double fMjd; 17 12 18 double f Amprms[21];19 double f Aoprms[14];13 double fPhi; // location of observatory 14 double fElong; 20 15 21 16 public: … … 27 22 // const RaDec GetRaDec() const { return fRaDec*360/D2PI; } 28 23 29 void Set(const double mjd); 24 void SetMjd2Now(); 25 void SetMjd(const struct timeval *tm); 30 26 31 void Set(const AltAz &altaz); 32 void Set(const ZdAz &zdaz); 33 void Set(const RaDec &radec); 27 virtual void SetMjd(const double mjd); 34 28 35 29 double GetAlpha() const { return fAlpha; } 30 double GetMjd() const { return fMjd; } 36 31 37 32 double GetPhi() const { return fPhi; } 38 33 double GetElong() const { return fElong; } 39 34 40 RaDec CalcRaDec(const AltAz &altaz) const; 41 RaDec CalcRaDec(const ZdAz &altaz) const; 42 43 AltAz CalcAltAz(const RaDec &radec) const; 44 ZdAz CalcZdAz (const RaDec &radec) const; 45 35 ZdAz XYZ2ZdAz(double coord[3]) const; 46 36 }; 47 37 -
trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
r808 r912 9 9 #include "slamac.h" 10 10 #include "File.h" 11 #include "timer.h" 12 13 StarCatalog::StarCatalog() : fEntries(0) 11 12 StarCatalog::StarCatalog() : SlaStars(), fEntries(0) 14 13 { 15 14 // p = pointer to MainFrame (not owner) … … 68 67 cout << " Az: " << fAltAz.Az() << endl; 69 68 70 fRaDec = sla.CalcRaDec(fAltAz);69 fRaDec = CalcRaDec(fAltAz); 71 70 72 71 cout << "Ra: " << 360.0/D2PI*fRaDec.Ra(); … … 82 81 fRaDec *= D2PI/360.0; 83 82 84 fAltAz = sla.CalcAltAz(fRaDec);83 fAltAz = CalcAltAz(fRaDec); 85 84 86 85 cout << "Alt: " << 360.0/D2PI*fAltAz.Alt() << " "; … … 215 214 double de0, de1; 216 215 217 const double phi = sla.GetPhi();218 const double alpha = sla.GetAlpha();216 const double phi = GetPhi(); 217 const double alpha = GetAlpha(); 219 218 // 220 219 // scan horizontal border … … 401 400 memset(cimg, 0, 768*576); 402 401 403 sla.Set(utc);402 SetMjd(utc); 404 403 //fAlpha = sla.GetAlpha(); 405 404 SetRaDec(radec); … … 419 418 memset(cimg, 0, 768*576); 420 419 421 sla.Set(utc);420 SetMjd(utc); 422 421 //fAlpha = sla.GetAlpha(); 423 422 SetAltAz(altaz); … … 496 495 // ---- mean to observed --- 497 496 // 498 AltAz altaz= sla.CalcAltAz(sao->GetRaDec()) * 360.0/D2PI;497 AltAz altaz=CalcAltAz(sao->GetRaDec()) * 360.0/D2PI; 499 498 500 499 if (sao->MagV() > fLimitMag) … … 520 519 // radec[rad] -> hadec[rad] 521 520 // 522 const double ha = sla.GetAlpha()-ra;521 const double ha = GetAlpha()-ra; 523 522 524 523 // … … 526 525 // 527 526 double alt, az; 528 slaDe2h(ha, dec, sla.GetPhi(), &az, &alt);527 slaDe2h(ha, dec, GetPhi(), &az, &alt); 529 528 530 529 // -
trunk/MagicSoft/Cosy/catalog/StarCatalog.h
r808 r912 8 8 #include "SaoFile.h" 9 9 #endif 10 #ifndef SLA LIB_H11 #include "Sla lib.h"10 #ifndef SLASTARS_H 11 #include "SlaStars.h" 12 12 #endif 13 13 … … 16 16 typedef unsigned char byte; 17 17 18 class StarCatalog 18 class StarCatalog : public SlaStars 19 19 { 20 20 private: … … 22 22 sort_t *fSrt; 23 23 int fEntries; 24 25 Slalib sla;26 27 // double fPhi; // location of observatory28 // double fElong;29 24 30 25 double fPixSize; // [rad/pix] size of one pixel … … 46 41 int fDecMax; 47 42 48 // double fAlpha;49 // double fMjd;50 // double fAmprms[21];51 // double fAoprms[14];52 53 43 void DrawCross(byte *img, const int x, const int y); 54 44 void DrawCircle(int color, byte *img, int xx, int yy, int size); … … 65 55 void SetRaDec(const RaDec &radec); 66 56 void SetAltAz(const AltAz &altaz); 67 // void SetMjd(const double mjd);68 57 void DrawSCAltAz(byte *img, const int color); 69 58 void DrawSCRaDec(byte *img, const int color); -
trunk/MagicSoft/Cosy/cosy.cc
r909 r912 11 11 int main(int argc, char **argv) 12 12 { 13 cout << endl; 14 cout << "Starting..." << endl; 15 cout << endl; 16 13 17 // 14 18 // this must move to MGCosy !!!! (or MApplication) -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r910 r912 419 419 double Macs::GetTime() 420 420 { 421 return fPosTime. GetTime();421 return fPosTime.Now(); 422 422 } 423 423 424 424 double Macs::GetMjd() 425 425 { 426 return fPosTime. GetMjd();426 return fPosTime.CalcMjd(); 427 427 } 428 428 429 429 double Macs::GetPdoTime() 430 430 { 431 return fPdoTime. GetTime();431 return fPdoTime.Now(); 432 432 } 433 433 434 434 double Macs::GetPdoMjd() 435 435 { 436 return fPdoTime. GetMjd();436 return fPdoTime.CalcMjd(); 437 437 } 438 438 -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r910 r912 32 32 { 33 33 case 0x1000: 34 cout << "Model: ";34 lout << "- Model: "; 35 35 switch (val&0xffff) 36 36 { 37 37 case 0x0196: 38 cout << "Shaft Encoder Type: ";38 lout << "Shaft Encoder Type: "; 39 39 switch ((val>>16)&0xff) 40 40 { 41 41 case 0x01: 42 cout << "Singleturn" << endl;42 lout << "Singleturn" << endl; 43 43 return; 44 44 case 0x02: 45 cout << "Multiturn" << endl;45 lout << "Multiturn" << endl; 46 46 return; 47 47 default: 48 cout << "?" << endl;48 lout << "?" << endl; 49 49 return; 50 50 } 51 51 default: 52 cout << "???" << endl;52 lout << "???" << endl; 53 53 return; 54 54 } 55 55 case 0x100b: 56 cout << "Node ID: " << dec << val << endl;56 lout << "Node ID: " << dec << val << endl; 57 57 return; 58 58 59 59 case 0x6000: 60 60 case 0x6500: 61 cout << "Counting: " << (val&1 ?"anti-clockwise":"clockwise") << " ";62 cout << "HwTest: " << (val&2 ?"on":"off") << " ";63 cout << "Scaling: " << (val&4 ?"on":"off") << " ";64 cout << "Modulo: " << (val&4096?"on":"off") << endl;61 lout << "- Counting: " << (val&1 ?"anti-clockwise":"clockwise") << " "; 62 lout << "HwTest: " << (val&2 ?"on":"off") << " "; 63 lout << "Scaling: " << (val&4 ?"on":"off") << " "; 64 lout << "Modulo: " << (val&4096?"on":"off") << endl; 65 65 66 66 case 0x6001: 67 cout << "Logical Ticks/Turn: " << dec << val << endl;67 lout << "- Logical Ticks/Revolution: " << dec << val << endl; 68 68 return; 69 69 70 70 case 0x6004: 71 cout << "Position: " << dec << val << endl;71 lout << "- Position: " << dec << val << endl; 72 72 fPos = val; 73 73 fTurn = 0; … … 76 76 77 77 case 0x6501: 78 cout << "Phys. Ticks/Turn: " << dec << val << endl;78 lout << "- Phys. Ticks/Revolution: " << dec << val << endl; 79 79 fTicks = val; 80 80 return; 81 81 82 82 case 0x6502: 83 cout << "Possible Turns: " << dec << val << endl;83 lout << "- Possible Turns: " << dec << val << endl; 84 84 fTurns = val ? val : 1; // Single Turn = Multiturn with one turn 85 85 return; … … 209 209 double ShaftEncoder::GetTime() 210 210 { 211 return fTime. GetTime();211 return fTime.Now(); 212 212 } 213 213 214 214 double ShaftEncoder::GetMjd() 215 215 { 216 return fTime. GetMjd();216 return fTime.CalcMjd(); 217 217 } 218 218 … … 228 228 // Requesting and checking (FIXME) type of encoder 229 229 // 230 lout << "- Requesting SDO 0x1000of " << (int)GetId() << endl;230 lout << "- Requesting Hardware Type (SDO 0x1000) of " << (int)GetId() << endl; 231 231 RequestSDO(0x1000); 232 232 WaitForSdo(0x1000); 233 233 234 234 // 235 // Read physical ticks per turn236 // 237 lout << "- Requesting SDO 0x6501of " << (int)GetId() << endl;235 // Read physical ticks per revolution 236 // 237 lout << "- Requesting physical ticks/revolution (SDO 0x6501) of " << (int)GetId() << endl; 238 238 RequestSDO(0x6501); 239 239 WaitForSdo(0x6501); 240 240 241 241 // 242 // Read number of possible ticks per turn243 // 244 lout << "- Requesting SDO 0x6502of " << (int)GetId() << endl;242 // Read number of possible ticks per revolution 243 // 244 lout << "- Requesting possible ticks/revolution (SDO 0x6502) of " << (int)GetId() << endl; 245 245 RequestSDO(0x6502); 246 246 WaitForSdo(0x6502); 247 247 248 248 // 249 // Set logic ticks per turn = physical ticks per turn => scale factor = 1249 // Set logic ticks/revolution = physical ticks/revolution => scale factor = 1 250 250 // 251 251 lout << "- Configuring SDO 0x6001 of " << (int)GetId() << endl; -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r910 r912 12 12 #include <TApplication.h> // gApplication 13 13 14 #include "timer.h" // Timer14 //#include "timer.h" // Timer 15 15 16 16 #include "MCosy.h" 17 17 #include "MGList.h" 18 #include "MGAccuracy.h" 18 19 #include "MGCoordinates.h" 19 20 #include "MGSkyPosition.h" 20 21 21 #include "Sla lib.h"22 #include "SlaStars.h" 22 23 23 24 #define IDM_EXIT 1 … … 155 156 fList->Add(fCoord); 156 157 157 fSkyPosition = new MGSkyPosition(this); 158 fAccuracy = new MGAccuracy(this, 200, 200); 159 fAccuracy->Move(320, 260); 160 fList->Add(fAccuracy); 161 162 fSkyPosition = new MGSkyPosition(this, 200, 200); 158 163 fSkyPosition->Move(320, 40); 159 fSkyPosition->Resize(200, 200);160 164 fList->Add(fSkyPosition); 161 165 … … 163 167 // Map the window, set up the layout, etc. 164 168 // 165 SetWMSizeHints(550, 250, 550, 250, 10, 10); // set the smallest and biggest size of the Main frame169 SetWMSizeHints(550, 500, 550, 500, 10, 10); // set the smallest and biggest size of the Main frame 166 170 167 171 MapSubwindows(); … … 190 194 191 195 cout << "MGCosy deleted." << endl; 196 } 197 // ====================================================================== 198 void MGCosy::Update(ZdAz pos, ZdAz acc) 199 { 200 fSkyPosition->Update(pos); 201 fAccuracy->Update(acc); 192 202 } 193 203 // ====================================================================== … … 253 263 case kPB_CALCALTAZ: 254 264 { 255 Timer t; 256 t.GetTime(); 257 258 Slalib sla; 259 sla.Set(t.GetMjd()); 265 SlaStars sla; 266 sla.SetMjd2Now(); 260 267 261 268 XY xy = fCoord->GetCoordinates(); -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r910 r912 16 16 #include <iostream.h> 17 17 18 #include "coord.h" 19 18 20 class TGLabel; 19 21 class TGPopupMenu; … … 27 29 class MGCoordinates; 28 30 class MGSkyPosition; 31 class MGAccuracy; 29 32 30 33 class MGCosy : public TGMainFrame … … 46 49 MGCoordinates *fCoord; 47 50 MGSkyPosition *fSkyPosition; 51 MGAccuracy *fAccuracy; 48 52 49 53 MsgQueue *fQueue; … … 63 67 TGLabel **GetLabel3() { return fLabel3; } 64 68 65 MGSkyPosition *GetSkyDisplay() { return fSkyPosition; }69 void Update(ZdAz pos, ZdAz acc); 66 70 67 71 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2); -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r911 r912 8 8 9 9 #include <iostream.h> // cout 10 #include <TRootEmbeddedCanvas.h> 11 #include <TGWindow.h> 10 12 11 #include <TArc.h> 12 #include <TLine.h> 13 #include <TList.h> 13 14 #include <TCanvas.h> 14 #include <TH1.h>15 #include <TLine.h>16 15 17 16 #include "coord.h" 18 19 MGSkyPosition::MGSkyPosition(const TGWindow* p) 20 : TRootEmbeddedCanvas("SkyPosition", p, 50, 50, kSunkenFrame)//, 0) //234, 76, kFixedSize) 17 #include "SlaPlanets.h" 18 19 void MGSkyPosition::InitPlanets() 20 { 21 // 22 // Magnitudes: 23 // ----------- 24 // Moon -12.8 25 // Jupiter -4.6 26 // Venus -4.0 27 // Mars -2.0 28 // Merkur 0.0 29 // Saturn 0.7 30 // Uranus 5.5 31 // Neptun 7.8 32 // 33 fSlalib = new SlaPlanets; 34 35 // 36 // Colors: black .. white: 37 // 38 // 1, 12, 13, 14, 15, 16, 17, 18, 19, 10 39 // 40 fMars = new TArc(0, 0, 1); 41 fMars->SetFillStyle(1001); // solid (s. TAttFill) 42 fMars->SetFillColor(13); // light grey (s. TAttFill) 43 fMars->SetLineColor(12); 44 fMars->Draw(); 45 46 fVenus = new TArc(0, 0, 2); 47 fVenus->SetFillStyle(1001); // solid (s. TAttFill) 48 fVenus->SetFillColor(15); // light grey (s. TAttFill) 49 fVenus->SetLineColor(14); 50 fVenus->Draw(); 51 52 fJupiter = new TArc(0, 0, 2); 53 fJupiter->SetFillStyle(1001); // solid (s. TAttFill) 54 fJupiter->SetFillColor(17); // light grey (s. TAttFill) 55 fJupiter->SetLineColor(16); 56 fJupiter->Draw(); 57 58 fMoon = new TArc(0, 0, 3, 290, 70); 59 fMoon->SetFillStyle(1001); // solid (s. TAttFill) 60 fMoon->SetFillColor(19); // light grey (s. TAttFill) 61 fMoon->SetLineColor(15); 62 fMoon->Draw(); 63 64 for (int i=0; i<4; i++) 65 { 66 fSunL[i] = new TLine(0,0,0,0); 67 fSunL[i]->SetLineColor(10); // white gray 68 fSunL[i]->SetLineStyle(1); // solid (s. TAttLine) 69 fSunL[i]->Draw(); 70 71 fList->Add(fSunL[i]); 72 } 73 74 fSun = new TArc(0, 0, 2); 75 fSun->SetFillStyle(1001); // solid (s. TAttFill) 76 fSun->SetFillColor(10); // white (s. TAttFill) 77 fSun->SetLineColor(19); 78 fSun->Draw(); 79 80 fList->Add(fMars); 81 fList->Add(fVenus); 82 fList->Add(fJupiter); 83 fList->Add(fMoon); 84 fList->Add(fSun); 85 86 // 87 // Reset 'static' positions of planets 88 // 89 for (int i=0; i<9; i++) 90 { 91 fX[i] = ~0; 92 fY[i] = ~0; 93 } 94 } 95 96 void MGSkyPosition::DrawCoordinateSystem() 97 { 98 TArc arc; 99 arc.SetFillStyle(4000); // transparent 100 arc.SetLineColor(13); // dark gray 101 arc.SetLineStyle(1); // solid (s. TAttLine) 102 arc.DrawArc(0, 0, 90); 103 arc.DrawArc(0, 0, 67.5); 104 arc.DrawArc(0, 0, 45); 105 arc.DrawArc(0, 0, 22.5); 106 107 TLine line; 108 line.SetLineColor(1); // black 109 line.SetLineStyle(1); // solid (s. TAttLine) 110 line.DrawLine(-95, 0, 95, 0); 111 line.DrawLine( 0, -95, 0, 95); 112 } 113 114 void MGSkyPosition::InitPosition() 115 { 116 fLin1a = new TLine(0, 0, 0, 0); 117 fLin1b = new TLine(0, 0, 0, 0); 118 fLin2 = new TLine(0, 0, 0, 0); 119 120 fLin1a->SetLineColor(5); // yellow (s. TAttFill) 121 fLin1b->SetLineColor(5); // yellow 122 fLin2 ->SetLineColor(10); // white 123 fLin1a->SetLineStyle(1); // solid (s. TAttLine) 124 fLin1b->SetLineStyle(2); // dashed 125 126 fLin1a->Draw(); 127 fLin1b->Draw(); 128 fLin2->Draw(); 129 130 fList->Add(fLin1a); 131 fList->Add(fLin1b); 132 fList->Add(fLin2); 133 } 134 135 MGSkyPosition::MGSkyPosition(const TGWindow* p, const Int_t w, const Int_t h) 136 : TRootEmbeddedCanvas("SkyPosition", p, w-1, h-1, kRaisedFrame),//, 0) //234, 76, kFixedSize) 137 fModified(kFALSE) 21 138 { 22 139 fCanvas = GetCanvas(); 23 140 141 fCanvas->SetFillColor(39); // s. TAttFill 24 142 fCanvas->Range(-100, -100, 100, 100); 25 143 26 fArc = new TArc; 27 fArc->SetLineColor(15); 28 fArc->DrawArc(0, 0, 90); 29 fArc->DrawArc(0, 0, 67.5); 30 fArc->DrawArc(0, 0, 45); 31 fArc->DrawArc(0, 0, 22.5); 32 33 fLin1 = new TLine; 34 fLin1->DrawLine(-95, 0, 95, 0); 35 fLin1->DrawLine( 0, -95, 0, 95); 36 fLin2 = new TLine; 37 38 // fCanvas->Modified(); 39 // fCanvas->Update(); 40 144 fList = new TList; 145 fList->SetOwner(); 146 147 DrawCoordinateSystem(); 148 InitPosition(); 149 InitPlanets(); 150 151 Resize(w, h); //GetDefaultSize()); // ??? 41 152 MapSubwindows(); 42 // MapWindow();43 44 // DrawPosition(66, 25);45 // DrawPosition(22, 278);46 153 } 47 154 48 155 MGSkyPosition::~MGSkyPosition() 49 156 { 50 delete fLin1; 51 delete fLin2; 52 delete fArc; 157 delete fList; 158 delete fSlalib; 53 159 54 160 cout << "MGSkyPosition destroyed." << endl; 161 } 162 163 void MGSkyPosition::SetLin1(int x, int y) 164 { 165 fLin1a->SetX2(x); 166 fLin1a->SetY2(y); 167 fLin1b->SetX2(-x); 168 fLin1b->SetY2(-y); 169 } 170 171 void MGSkyPosition::SetLin2(int x1, int y1, int x2, int y2) 172 { 173 fLin2->SetX1(x1); 174 fLin2->SetX2(x2); 175 fLin2->SetY1(y1); 176 fLin2->SetY2(y2); 55 177 } 56 178 … … 71 193 return; 72 194 73 const int dx = (int)(s*6); 74 const int dy = (int)(c*6); 75 76 delete fArc; 77 fArc = new TArc(x, y, 2); 78 fArc->SetFillStyle(1001); 79 fArc->SetFillColor(43); 80 fArc->Draw(); 81 82 delete fLin1; 83 delete fLin2; 84 //fLin1 = new TLine(x-dx, y-dy, x+dx, y+dy); 85 fLin1 = new TLine(0, 0, s*95, c*95); 86 fLin2 = new TLine(x+dy, y-dx, x-dy, y+dx); 87 fLin1->Draw(); 88 fLin2->Draw(); 89 195 X = x; 196 Y = y; 197 198 const int dx = (int)(s*4); 199 const int dy = (int)(c*4); 200 201 SetLin1(s*95, c*95); 202 SetLin2(x+dy, y-dx, x-dy, y+dx); 203 204 fModified = kTRUE; 205 } 206 207 void MGSkyPosition::Update(ZdAz &pos) 208 { 209 // 210 // calculate actual time for planet positions 211 // 212 fSlalib->SetMjd2Now(); 213 214 DrawPlanet(kESun, fSun); 215 DrawPlanet(kEMoon, fMoon); 216 DrawPlanet(kEJupiter, fJupiter); 217 DrawPlanet(kEVenus, fVenus); 218 DrawPlanet(kEMars, fMars); 219 220 DrawPosition(pos.Zd(), pos.Az()); 221 222 if (!fModified) 223 return; 224 225 // FIXME: Sometimes (if the canvas couldn't be created correctly: 226 // X11 Pixmap error) Update hangs the Gui system. 227 228 fCanvas->Modified(); 90 229 fCanvas->Update(); 91 } 92 93 void MGSkyPosition::DrawPosition(ZdAz &pos) 94 { 95 DrawPosition(pos.Zd(), pos.Az()); 96 } 230 231 fModified = kFALSE; 232 } 233 234 void MGSkyPosition::DrawPlanet(Int_t planet, TArc *arc) 235 { 236 // 237 // calculate actual position of planet 238 // 239 fSlalib->UpdatePlanetPos((ePlanets_t)planet); 240 241 ZdAz zdaz = fSlalib->GetPlanetPos((ePlanets_t)planet); 242 243 // 244 // check whether we have to change the position where it is drawn 245 // 246 const float s = sin(zdaz.Az()); 247 const float c = cos(zdaz.Az()); 248 249 const float deg = 360.0/D2PI*zdaz.Zd(); 250 251 const int x = (int)(s*deg); 252 const int y = (int)(c*deg); 253 254 if (fX[planet]==x && fY[planet]==y) 255 return; 256 257 fX[planet] = x; 258 fY[planet] = y; 259 260 // 261 // Set new position 262 // 263 arc->SetX1(x); 264 arc->SetY1(y); 265 266 fModified = kTRUE; 267 268 if (planet!=kESun) 269 return; 270 271 cout << "Sun: x=" << x << " y=" << y; 272 cout << " Zd=" << deg << " Az=" << 360./D2PI*zdaz.Az() << endl; 273 274 fSunL[0]->SetX1(x-4); fSunL[0]->SetX2(x+4); 275 fSunL[1]->SetX1(x-3); fSunL[1]->SetX2(x+3); 276 fSunL[2]->SetX1(x-3); fSunL[2]->SetX2(x+3); 277 fSunL[3]->SetX1(x ); fSunL[3]->SetX2(x ); 278 279 fSunL[0]->SetY1(y ); fSunL[0]->SetY2(y ); 280 fSunL[1]->SetY1(y-3); fSunL[1]->SetY2(y+3); 281 fSunL[2]->SetY1(y+3); fSunL[2]->SetY2(y-3); 282 fSunL[3]->SetY1(y-4); fSunL[3]->SetY2(y+4); 283 } -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
r911 r912 13 13 #endif 14 14 15 class TArc; 16 class TList; 17 class TLine; 15 18 class TCanvas; 16 class TArc; 17 class TLine; 19 18 20 class ZdAz; 21 class SlaPlanets; 19 22 20 23 class MGSkyPosition : public TRootEmbeddedCanvas 21 24 { 22 TCanvas *fCanvas;25 TCanvas *fCanvas; 23 26 24 TArc *fArc; 25 TLine *fLin1; 26 TLine *fLin2; 27 TArc *fMoon; 28 TArc *fJupiter; 29 TArc *fVenus; 30 TArc *fMars; 31 TArc *fSun; 32 33 TLine *fLin1a; 34 TLine *fLin1b; 35 TLine *fLin2; 36 37 TLine *fSunL[4]; 38 39 SlaPlanets *fSlalib; 40 41 TList *fList; 42 43 Int_t fX[9]; 44 Int_t fY[9]; 45 46 Bool_t fModified; 47 48 void InitPlanets(); 49 void InitPosition(); 50 51 void SetLin1(int x, int y); 52 void SetLin2(int x1, int y1, int x2, int y2); 53 54 void DrawPlanet(Int_t planet, TArc *arc); 55 void DrawPosition(Float_t zd, Float_t az); 56 void DrawCoordinateSystem(); 57 58 Bool_t CheckRange(Int_t x, Int_t y) const 59 { 60 return x>-95 && x<95 && y>-95 && y<95; 61 } 27 62 28 63 public: 29 MGSkyPosition(const TGWindow* p );64 MGSkyPosition(const TGWindow* p, const Int_t w, const Int_t h); 30 65 ~MGSkyPosition(); 31 66 32 void DrawPosition(Float_t zd, Float_t az); 33 void DrawPosition(ZdAz &pos); 67 void Update(ZdAz &pos); 34 68 }; 35 69 -
trunk/MagicSoft/Cosy/gui/Makefile
r910 r912 35 35 MGCosy.cc \ 36 36 MGImage.cc \ 37 MGAccuracy.cc \ 37 38 MGSkyPosition.cc 38 39 -
trunk/MagicSoft/slalib/Makefile
r911 r912 32 32 33 33 SRCFILES = \ 34 daf2r.c gmst.c mappa.c aoppa.c oapqk.c ampqk.c mapqkz.c \ 35 dr2af.c dcs2c.c dimxv.c dvdv.c dvn.c dcc2s.c dranrm.c \ 36 geoc.c refco.c eqeqx.c aoppat.c dd2tf.c epj.c prenut.c \ 37 nutc.c dmxv.c refro.c prec.c nut.c dmxm.c evp.c \ 38 drange.c deuler.c cldj.c aopqk.c refz.c dh2e.c de2h.c 34 daf2r.c gmst.c mappa.c aoppa.c oapqk.c ampqk.c mapqkz.c \ 35 dr2af.c dcs2c.c dimxv.c dvdv.c dvn.c dcc2s.c dranrm.c \ 36 geoc.c refco.c eqeqx.c aoppat.c dd2tf.c epj.c prenut.c \ 37 nutc.c dmxv.c refro.c prec.c nut.c dmxm.c evp.c \ 38 drange.c deuler.c cldj.c aopqk.c refz.c dh2e.c de2h.c \ 39 dt.c dmoon.c planet.c planel.c el2ue.c ue2pv.c pv2ue.c 39 40 # addet.c 40 41 # afin.c airmas.c altaz.c amp.c \
Note:
See TracChangeset
for help on using the changeset viewer.