Changeset 1111 for trunk/MagicSoft/Cosy
- Timestamp:
- 12/12/01 13:26:34 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 1 added
- 1 deleted
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r926 r1111 1 1 -*-*- END -*-*- 2 3 2001/12/12 - Thomas Bretz: 4 5 * base/coord.h: 6 - added constants for unit transformations 7 8 * base/msgqueue.h: 9 - replaced pthread.h by thread.h 10 11 * base/timer.h: 12 - removed unistd.h 13 - added forward declaration for timeval 14 15 * candrv/CandrvLinkDef.h: 16 - added VmodIcan 17 - added CanOpen 18 - added Network 19 - added NodeDrv 20 - added PendingSDO 21 - added PendingSDOList 22 23 * candrv/nodedrv.h, candrv/sdolist.h, candrv/vmodican.h, 24 videodev/Camera.h, videodev/Writer.h: 25 - added ClassDef 26 - added some declarations for __CINT__ case 27 28 * base/MThread.h: 29 - added some declarations for __CINT__ case 30 31 * base/threads.h: 32 - added 33 34 * catalog/CatalogLinkDef.h: 35 - added Slalib+ 36 - added SlaStars+ 37 - added SlaPlanets+ 38 - added SaoFile+ 39 - added StarCatalog+ 40 41 * catalog/SlaStars.h: 42 - added ClassDef 43 - included coord.h for coordation tranformations 44 45 * catalog/SlaStars.cc, catalog/Slalib.cc, gui/MGSkyPosition.cc: 46 - added ClassImp 47 - changed slalib macros to coord.h constants 48 49 * catalog/StarCatalog.h: 50 - added ClassDef 51 - changed slalib macros to coord.h constants 52 53 * devdrv/DevdrvLinkDef.h: 54 - added Macs+; 55 - added ShaftEncoder+; 56 57 * gui/GuiIncl.h: 58 - added coord.h 59 60 * gui/GuiLinkDef.h: 61 - added MGAccuracy+; 62 - added MGCoordinate+; 63 - added MGCoordinates+; 64 - added MGEmbeddedCanvas+; 65 - added MGImage+; 66 - added MGSkyPosition+; 67 - added MGVelocity+; 68 - added MGCosy+; 69 - added MGStarguider+; 70 71 * gui/MGCoordinate.[h,cc]: 72 - changed Flist to pointer type 73 74 * gui/MGCosy.cc: 75 - added ClassImp 76 - fixed a bug which causes 'Exit' not to work 77 - changed slalib macros to coord.h constants 78 79 * gui/MGCosy.h: 80 - added ClassDef 81 82 * gui/MGEmbeddedCanvas.h: 83 - added ClassImp 84 - removed consts 85 86 * gui/MGStarguider.[h,cc]: 87 - added ClassImp/Def 88 - change fList to pointer type 89 - change fRaDec to pinter type 90 - changed fSao to pointer type 91 92 * main/MCosy.[h,cc]: 93 - added ClassImp 94 - changed order 95 - added comments 96 - changed slalib macros to coord.h constants 97 - changed defines to enums 98 99 * main/MainCint.h: 100 - removed 101 102 * main/MainLinkDef.h: 103 - added MCosy 104 105 * devdrv/Makefile, candrv/Makefile, catalog/Makefile, gui/Makefile, 106 main/Makefile, videodev/Makefile: 107 - added CINTHEADERS 108 109 * candrv/canopen.cc, candrv/network.cc,candrv/nodedrv.cc, candrv/sdolist.cc 110 candrv/vmodican.cc, catalog/SaoFile.cc, catalog/SlaPlanets.cc, 111 catalog/StarCatalog.cc, devdrv/macs.cc, devdrv/shaftencoder.cc, 112 gui/MGAccuracy.cc, gui/MGCoordinate.cc, gui/MGCoordinates.cc, 113 gui/MGEmbeddedCanvas.cc, gui/MGImage.cc, gui/MGVelocity.cc, 114 videodev/Camera.cc, videodev/Filter.cc, videodev/Writer.cc: 115 - added ClassImp 116 117 * candrv/network.h, catalog/SaoFile.h, catalog/SlaPlanets.h, 118 catalog/Slalib.h, devdrv/macs.h, devdrv/shaftencoder.h, 119 gui/MGAccuracy.h, gui/MGCoordinate.h, gui/MGCoordinates.h, 120 gui/MGImage.h, gui/MGSkyPosition.h, gui/MGVelocity.h, 121 videodev/Filter.h: 122 - added ClassDef 123 124 * videodev/VideodevLinkDef.h: 125 - added Writer+; 126 - added Filter+; 127 - added Camera+; 128 129 2 130 3 131 2001/09/10 - Thomas Bretz: … … 28 156 29 157 30 158 31 159 2001/09/07 - Thomas Bretz: 32 160 -
trunk/MagicSoft/Cosy/base/MThread.h
r910 r1111 2 2 #define MTHREAD_H 3 3 4 #ifdef __CINT__ 5 typedef unsigned long int pthread_t; 6 #else 4 7 #include <pthread.h> 8 #endif 5 9 6 class MThread 10 class MThread 7 11 { 8 12 private: -
trunk/MagicSoft/Cosy/catalog/StarCatalog.h
r912 r1111 73 73 const AltAz &altaz); 74 74 75 const AltAz GetAltAz() const { return fAltAz* 360/D2PI; }76 const ZdAz GetZdAz() const { return ZdAz( DPI/2-fAltAz.Alt(), fAltAz.Az())*360/D2PI; }77 const RaDec GetRaDec() const { return fRaDec* 360/D2PI; }75 const AltAz GetAltAz() const { return fAltAz*kRad2Deg; } 76 const ZdAz GetZdAz() const { return ZdAz(kPiDiv2-fAltAz.Alt(), fAltAz.Az())*kRad2Deg; } 77 const RaDec GetRaDec() const { return fRaDec*kRad2Deg; } 78 78 79 79 void SetPixSize(const double pixsize); 80 80 void SetLimitMag(const float mag) { fLimitMag = mag; }; 81 82 ClassDef(StarCatalog, 0) 81 83 }; 82 84 -
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r921 r1111 18 18 19 19 #include "coord.h" 20 21 ClassImp(MGAccuracy); 20 22 21 23 void MGAccuracy::DrawCoordinateSystem() -
trunk/MagicSoft/Cosy/gui/MGAccuracy.h
r918 r1111 12 12 #endif 13 13 14 class TList;15 14 class TLine; 16 15 class TText; 17 class TCanvas;18 16 19 17 class ZdAz; 20 class SlaPlanets;21 18 22 19 class MGAccuracy : public MGEmbeddedCanvas … … 40 37 41 38 void Update(ZdAz &pos, ZdAz &acc); 39 40 ClassDef(MGAccuracy, 0) 42 41 }; 43 42 -
trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
r921 r1111 17 17 #include "slamac.h" 18 18 19 ClassImp(MGCoordinate); 20 19 21 enum { 20 22 IDM_kDeg, … … 28 30 : TGFrame(p, 119, flag?76:46, kSunkenFrame|kFixedSize), fDeg(deg), fMin(min), fSec(sec) 29 31 { 32 fList = new MGList; 33 30 34 // p = pointer to MainFrame (not owner) 31 35 if (flag) … … 43 47 fTextEntryMin->MapWindow(); 44 48 fTextEntrySec->MapWindow(); 45 fList .Add(fTextEntrySec);46 fList .Add(fTextEntryMin);47 fList .Add(fTextEntryDeg);49 fList->Add(fTextEntrySec); 50 fList->Add(fTextEntryMin); 51 fList->Add(fTextEntryDeg); 48 52 49 53 Set(fTextEntryDeg, fDeg); … … 66 70 fLabelMin->MapWindow(); 67 71 fLabelSec->MapWindow(); 68 fList .Add(fLabelSec);69 fList .Add(fLabelDeg);70 fList .Add(fLabelMin);72 fList->Add(fLabelSec); 73 fList->Add(fLabelDeg); 74 fList->Add(fLabelMin); 71 75 72 76 Set(fLabelDeg, fDeg); … … 78 82 fLabel->Move(4, 4); 79 83 fLabel->MapWindow(); 80 fList .Add(fLabel);84 fList->Add(fLabel); 81 85 82 86 TGLabel *label; … … 92 96 label->Move(39, 26); 93 97 label->MapWindow(); 94 fList .Add(label);98 fList->Add(label); 95 99 96 100 label = new TGLabel(this, min); … … 98 102 label->Move(73, 26); 99 103 label->MapWindow(); 100 fList .Add(label);104 fList->Add(label); 101 105 102 106 label = new TGLabel(this, sec); … … 104 108 label->Move(107, 26); 105 109 label->MapWindow(); 106 fList .Add(label);110 fList->Add(label); 107 111 } 108 112 … … 111 115 label->Move(39, ypos); 112 116 label->MapWindow(); 113 fList .Add(label);117 fList->Add(label); 114 118 115 119 label = new TGLabel(this, min); … … 117 121 label->Move(73, ypos); 118 122 label->MapWindow(); 119 fList .Add(label);123 fList->Add(label); 120 124 121 125 label = new TGLabel(this, sec); … … 123 127 label->Move(107, ypos); 124 128 label->MapWindow(); 125 fList .Add(label);129 fList->Add(label); 126 130 127 131 MapWindow(); … … 130 134 MGCoordinate::~MGCoordinate() 131 135 { 132 // cout << "MGCoordinate destroyed." << endl;136 delete fList; 133 137 } 134 138 -
trunk/MagicSoft/Cosy/gui/MGCoordinate.h
r921 r1111 29 29 Int_t fSec; 30 30 31 MGList fList;31 MGList *fList; 32 32 33 33 TGTextEntry *fTextEntryDeg; … … 57 57 58 58 void Print(); 59 60 ClassDef(MGCoordinate, 0) 59 61 }; 60 62 -
trunk/MagicSoft/Cosy/gui/MGCoordinates.cc
r921 r1111 10 10 11 11 #include "MGCoordinate.h" 12 #include "coord.h" 13 14 ClassImp(MGCoordinates); 12 15 13 16 MGCoordinates::MGCoordinates(const TGWindow* p, -
trunk/MagicSoft/Cosy/gui/MGCoordinates.h
r921 r1111 11 11 #include <TGFrame.h> 12 12 #endif 13 #ifndef COORD_H 14 #include "coord.h" 15 #endif 13 14 class XY; 16 15 17 16 enum { … … 38 37 39 38 void Print(); 39 40 ClassDef(MGCoordinates, 0) 40 41 }; 41 42 -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r926 r1111 4 4 5 5 #include "msgqueue.h" 6 #include "coord.h" 6 7 7 8 #include <TROOT.h> … … 28 29 #include "SlaStars.h" 29 30 31 ClassImp(MGCosy); 32 30 33 #define IDM_EXIT 1 31 34 #define IDM_TEXT 2 … … 50 53 // 51 54 TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot()); 52 fFileMenu->AddEntry ("Exit", IDM_EXIT);53 //fFileMenu->Associate(this);55 fFileMenu->AddEntry("Exit", IDM_EXIT); 56 fFileMenu->Associate(this); 54 57 fList->Add(fFileMenu); 55 58 … … 516 519 517 520 cout << "Ra/Dec: " << rd.Ra() << kDEG << " " << rd.Dec() << kDEG << endl; 518 ZdAz aa=sla.CalcZdAz(rd* D2PI/360.0)*360.0/D2PI;521 ZdAz aa=sla.CalcZdAz(rd*kDeg2Rad)*kRad2Deg; 519 522 cout << "Zd/Az: " << aa.Zd() << kDEG << " " << aa.Az() << kDEG << endl; 520 523 } -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r921 r1111 6 6 #endif 7 7 8 //#ifndef ROOT_TOrdCollection 9 //#include <TOrdCollection.h> 10 //#endif 11 12 #ifndef ROOT_TGWidget 13 #include <TGWidget.h> 14 #endif 15 16 #include <iostream.h> 17 18 #include "coord.h" 8 class TIterator; 19 9 20 10 class TGLabel; … … 23 13 class TGHorizontal3DLine; 24 14 class TGLayoutHints; 15 class TGCompositeFrame; 16 class TGTab; 17 class TGListBox; 18 19 class ZdAz; 20 class RaDec; 25 21 class MsgQueue; 26 class TIterator; 22 27 23 class MGImage; 28 24 class MGList; … … 31 27 class MGAccuracy; 32 28 class MGVelocity; 33 class TGCompositeFrame;34 class TGTab;35 class TGListBox;36 29 37 30 class MGCosy : public TGMainFrame … … 99 92 100 93 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2); 94 95 ClassDef(MGCosy, 0) 101 96 }; 102 97 -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
r920 r1111 9 9 #include <TList.h> 10 10 #include <TCanvas.h> 11 12 ClassImp(MGEmbeddedCanvas); 11 13 12 14 MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p, -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h
r913 r1111 26 26 TList *fList; 27 27 28 const UInt_t fWidth;29 const Float_t fRange;30 const Float_t fPix;28 UInt_t fWidth; // const: rootcint/TMemberInspector 29 Float_t fRange; // const: rootcint/TMemberInspector 30 Float_t fPix; // const: rootcint/TMemberInspector 31 31 32 32 void InitCanvas(); … … 40 40 41 41 void SetModified() { fModified = kTRUE; } 42 43 ClassDef(MGEmbeddedCanvas, 0) 42 44 }; 43 45 -
trunk/MagicSoft/Cosy/gui/MGImage.cc
r808 r1111 11 11 #include <iostream.h> 12 12 #include <pthread.h> 13 14 ClassImp(MGImage); 13 15 14 16 MGImage::MGImage(const TGWindow* p, UInt_t w, UInt_t h, UInt_t options, ULong_t back) -
trunk/MagicSoft/Cosy/gui/MGImage.h
r808 r1111 42 42 void DrawImg(const byte *buffer); 43 43 void DrawColImg(const byte *gbuf, const byte *cbuf); 44 45 ClassDef(MGImage, 0) 44 46 }; 45 47 -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r921 r1111 17 17 #include "coord.h" 18 18 #include "SlaPlanets.h" 19 20 ClassImp(MGSkyPosition); 19 21 20 22 void MGSkyPosition::InitPlanets() … … 208 210 static int Ry=~0; 209 211 210 const float rad = D2PI*az/360.0;212 const float rad = az*kDeg2Rad; 211 213 212 214 const float s = sin(rad); … … 306 308 const float c = cos(zdaz.Az()); 307 309 308 const float deg = 360.0/D2PI*zdaz.Zd();310 const float deg = zdaz.Zd()*kRad2Deg; 309 311 310 312 const float x = s*deg; -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
r913 r1111 58 58 59 59 void Update(ZdAz &pos); 60 61 ClassDef(MGSkyPosition, 0) 60 62 }; 61 63 -
trunk/MagicSoft/Cosy/gui/MGStarguider.cc
r924 r1111 10 10 #include "MGCoordinates.h" 11 11 12 #include "coord.h" 13 14 #include "StarCatalog.h" 15 12 16 #include "Filter.h" 13 17 #include "Writer.h" 14 18 #include "base/timer.h" 19 20 ClassImp(MGStarguider); 15 21 16 22 enum { … … 42 48 43 49 MGStarguider::MGStarguider() 44 : Camera(), TGMainFrame(gClient->GetRoot(), 768, 700), fRaDec(180, 40) 45 { 50 : Camera(), TGMainFrame(gClient->GetRoot(), 768, 700) 51 { 52 fList = new MGList; 53 54 fSao = new StarCatalog; 55 fRaDec = new RaDec(180, 40); 56 46 57 // p = pointer to MainFrame (not owner) 47 58 … … 55 66 fDisplay->AddEntry("Sao &Catalog", IDM_kCatalog); 56 67 fDisplay->Associate(this); 57 fList .Add(fDisplay);68 fList->Add(fDisplay); 58 69 59 70 fFileType = new TGPopupMenu(p); … … 62 73 fFileType->CheckEntry(IDM_kPNG); 63 74 fFileType->Associate(this); 64 fList .Add(fFileType);75 fList->Add(fFileType); 65 76 66 77 fWriteType = new TGPopupMenu(p); … … 69 80 fWriteType->CheckEntry(IDM_kOnce); 70 81 fWriteType->Associate(this); 71 fList .Add(fWriteType);82 fList->Add(fWriteType); 72 83 73 84 fWriteRate = new TGPopupMenu(p); … … 81 92 fWriteRate->CheckEntry(IDM_kRate1m); 82 93 fWriteRate->Associate(this); 83 fList .Add(fWriteRate);94 fList->Add(fWriteRate); 84 95 85 96 fWrtRate = 25*60; … … 94 105 fWrite->DisableEntry(IDM_kStop); 95 106 fWrite->Associate(this); 96 fList .Add(fWrite);107 fList->Add(fWrite); 97 108 98 109 fLimMag = new TGPopupMenu(p); … … 106 117 fLimMag->CheckEntry(IDM_kLimMag8); 107 118 fLimMag->Associate(this); 108 fList .Add(fLimMag);109 110 fSao .SetLimitMag(8.0);119 fList->Add(fLimMag); 120 121 fSao->SetLimitMag(8.0); 111 122 112 123 fSetup = new TGPopupMenu(p); 113 124 fSetup->AddPopup("Lim. &Magnitude", fLimMag); 114 125 fSetup->Associate(this); 115 fList .Add(fSetup);126 fList->Add(fSetup); 116 127 117 128 fMenu = new TGMenuBar(this, 0, 0, kHorizontalFrame); … … 121 132 fMenu->Resize(fMenu->GetDefaultSize()); 122 133 AddFrame(fMenu); //, new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0)); 123 fList .Add(fMenu);134 fList->Add(fMenu); 124 135 125 136 fCRaDec = new MGCoordinates(this, kETypeRaDec); 126 137 fCRaDec->Move(1, fMenu->GetDefaultHeight()+584); 127 138 AddFrame(fCRaDec); 128 fList .Add(fCRaDec);139 fList->Add(fCRaDec); 129 140 130 141 fCZdAz = new MGCoordinates(this, kETypeZdAz); 131 142 fCZdAz->Move(240+12, fMenu->GetDefaultHeight()+584); 132 143 AddFrame(fCZdAz); 133 fList .Add(fCZdAz);144 fList->Add(fCZdAz); 134 145 135 146 // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this); 136 147 // AddFrame(fLineSep, new TGLayoutHints (kLHintsNormal | kLHintsExpandX)); 137 // fList .Add(fLineSep);148 // fList->Add(fLineSep); 138 149 139 150 // … … 143 154 fImage->Move(0, fMenu->GetDefaultHeight()); 144 155 AddFrame(fImage); 145 fList .Add(fImage);156 fList->Add(fImage); 146 157 147 158 // … … 154 165 MapWindow(); 155 166 156 fSao .SetPixSize(0.006);167 fSao->SetPixSize(0.006); 157 168 } 158 169 159 170 MGStarguider::~MGStarguider() 160 171 { 172 delete fSao; 173 delete fRaDec; 174 175 delete fList; 161 176 cout << "Camera Display destroyed." << endl; 162 177 } … … 281 296 fLimMag->UnCheckEntry(i); 282 297 283 fSao .SetLimitMag(mp1-IDM_kLimMag3+3);298 fSao->SetLimitMag(mp1-IDM_kLimMag3+3); 284 299 return kTRUE; 285 300 } … … 331 346 XY xy = fCRaDec->GetCoordinates(); 332 347 333 fRaDec .Set(xy.X(), xy.Y());348 fRaDec->Set(xy.X(), xy.Y()); 334 349 335 350 Timer time(tm); 336 fSao .GetImg(img, cimg, time.CalcMjd(),fRaDec);351 fSao->GetImg(img, cimg, time.CalcMjd(), *fRaDec); 337 352 fImage->DrawColImg(img, cimg); 338 353 339 fCZdAz->SetCoordinates(fSao .GetZdAz());354 fCZdAz->SetCoordinates(fSao->GetZdAz()); 340 355 } 341 356 else -
trunk/MagicSoft/Cosy/gui/MGStarguider.h
r924 r1111 11 11 #include "MGList.h" 12 12 #include "MGImage.h" 13 #include "StarCatalog.h" 13 14 class RaDec; 14 15 15 16 class TGMenuBar; … … 19 20 class MGCoordinates; 20 21 22 class StarCatalog; 23 21 24 class MGStarguider : public Camera, public TGMainFrame 22 25 { 23 26 private: 24 MGList 27 MGList *fList; 25 28 26 29 TGMenuBar *fMenu; … … 38 41 MGCoordinates *fCZdAz; 39 42 40 StarCatalog 43 StarCatalog *fSao; 41 44 42 RaDec fRaDec;45 RaDec *fRaDec; 43 46 44 47 int fWrtRate; … … 50 53 virtual ~MGStarguider(); 51 54 52 void Update();55 //void Update(); 53 56 54 57 void Layout(); … … 61 64 // 62 65 void ProcessFrame(const unsigned long n, byte *img, struct timeval *tm); 66 67 ClassDef(MGStarguider, 0) 63 68 }; 64 69 -
trunk/MagicSoft/Cosy/gui/MGVelocity.cc
r921 r1111 20 20 #include "coord.h" 21 21 22 ClassImp(MGVelocity); 23 22 24 void MGVelocity::DrawCoordinateSystem() 23 25 { -
trunk/MagicSoft/Cosy/gui/MGVelocity.h
r921 r1111 51 51 52 52 void Update(ZdAz &pos); 53 54 ClassDef(MGVelocity, 0) 53 55 }; 54 56 -
trunk/MagicSoft/Cosy/main/MCosy.cc
r926 r1111 22 22 //#include <sys/resource.h> // PRIO_PROCESS 23 23 24 ClassImp(MCosy); 25 24 26 typedef struct tm tm_t; 25 27 … … 32 34 double Rad2SE(double rad) 33 35 { 34 return 16384.0/ D2PI*rad;36 return 16384.0/k2Pi*rad; 35 37 } 36 38 37 39 double Rad2ZdRE(double rad) 38 40 { 39 return 16384.0/ D2PI*rad*kGearRatio.X();41 return 16384.0/k2Pi*rad*kGearRatio.X(); 40 42 } 41 43 42 44 double Rad2AzRE(double rad) 43 45 { 44 return 16384.0/ D2PI*rad*kGearRatio.Y();46 return 16384.0/k2Pi*rad*kGearRatio.Y(); 45 47 } 46 48 … … 68 70 69 71 ZdAz source = src * 360.0/16384.0; 70 ZdAz dest = dst * 360.0/D2PI;72 ZdAz dest = dst * kRad2Deg; 71 73 72 74 if (dest.Zd()>-1e-6 && dest.Zd()<1e-6) 73 return dst*(16384.0/ D2PI);75 return dst*(16384.0/k2Pi); 74 76 75 77 const float fZdMin = -67; … … 122 124 } 123 125 124 126 // -------------------------------------------------------------------------- 127 // 128 // GetSePos, reads the Shaftencoder positions from the Can-drivers 129 // for the shaftencoders. The two shaft encoders at the elevation axis 130 // are avaraged. The values are returned as a ZdAz object. 131 // 132 // The positions are alway up-to-date because the shaftencoders are 133 // sending all changes immediatly. 134 // 125 135 ZdAz MCosy::GetSePos() 126 136 { 137 // 138 // Get the values 139 // 127 140 const int p0 = fZd1->GetPos(); 128 141 const int p1 = fZd2->GetPos(); … … 144 157 } 145 158 159 // -------------------------------------------------------------------------- 160 // 161 // request the current positions from the rotary encoders. 162 // use GetRePos to get the psotions. If the request fails the function 163 // returns kFALSE, otherwise kTRUE 164 // 165 Bool_t MCosy::RequestRePos() 166 { 167 // 168 // Send request 169 // 170 fMac2->RequestSDO(0x6004); 171 fMac1->RequestSDO(0x6004); 172 173 // 174 // Wait until the objects are received. 175 // 176 WaitForSdos(); 177 178 // 179 // If waitng was not interrupted everything is ok. return. 180 // 181 if (!StopWaitingForSDO()) 182 return kTRUE; 183 184 // 185 // If the waiting was interrupted due to a network error, 186 // print some logging message. 187 // 188 if (HasError()) 189 lout << "Error #6004 (requesting re pos from Macs) happened." << endl; 190 191 return kFALSE; 192 } 193 194 // -------------------------------------------------------------------------- 195 // 196 // reads the Rotary encoder positions from the last request of the Macs. 197 // 198 // The positions are returned as a ZdAz object. Use RequestRePos to request 199 // the current positions first. 200 // 146 201 ZdAz MCosy::GetRePos() 147 202 { … … 149 204 } 150 205 206 // -------------------------------------------------------------------------- 207 // 208 // reads the Rotary encoder positions from the Macs. 209 // 210 // The positions are returned as a ZdAz object. The positions are the ones 211 // which are send as PDOs to the computer. This is done at a given 212 // frequency. Which means, that this positions are not ought to be 213 // up-to-date. 214 // 151 215 ZdAz MCosy::GetRePosPdo() 152 216 { … … 154 218 } 155 219 220 // -------------------------------------------------------------------------- 221 // 222 // set the velocity and accelerations for position maneuvers. 223 // 224 // The acceleratin is set as given (in percent of maximum). 225 // The velocity is given in percent, depending on the ratio (<1 or >1) 226 // one of the axis becomes a slower velocity. This is used for maneuvers 227 // in which both axis are moved synchromously and should reach their 228 // target position at the same time. 229 // 156 230 void MCosy::SetPosVelocity(const Float_t ratio, Float_t vel, Float_t acc) 157 231 { … … 186 260 } 187 261 262 // -------------------------------------------------------------------------- 263 // 264 // Does a relative positioning. 265 // 266 // The steps to move are given in a ZdAz object relative to the current 267 // position. The coordinates are given in Roteryencoder steps. 268 // Axis 1 is moved only if axe1==kTRUE, Axis 2 is moved only 269 // if Axis 2==kTRUE. The function waits for the movement to be finished. 270 // 188 271 void MCosy::DoRelPos(const ZdAz &rd, const Bool_t axe1, const Bool_t axe2) 189 272 { 190 SetStatus( kMoving);273 SetStatus(MCosy::kMoving); 191 274 192 275 if (axe1) fMac2->StartRelPos(rd.Zd()); … … 200 283 } 201 284 285 // -------------------------------------------------------------------------- 286 // 287 // check for a break-signal (from the msgqueue) and errors. 288 // 289 int MCosy::StopWaitingForSDO() const 290 { 291 return Break() || HasError(); 292 } 293 294 // -------------------------------------------------------------------------- 295 // 296 // Waits for a movement to become finished. 297 // 298 // First waits for all peding Sdos, then waits until both motors are stopped 299 // or waiting for SDOs was stopped (either by an error or by Break) 300 // 301 void MCosy::WaitForEndMovement() 302 { 303 WaitForSdos(); 304 305 while ((fMac1->IsPositioning() || fMac2->IsPositioning()) && !StopWaitingForSDO()) 306 usleep(1); 307 } 308 309 // -------------------------------------------------------------------------- 310 // 311 // Check for an error... 312 // 313 // This is ment for usage after the Action: All Motors Stop. 314 // 202 315 void MCosy::CheckForError() 203 316 { 317 // 318 // Check all Can-Nodes for an Error. If there is no error the motor 319 // status is set to stopped. 320 // 204 321 if (!HasError()) 205 322 { 206 SetStatus( kStopped);323 SetStatus(MCosy::kStopped); 207 324 return; 208 325 } 209 326 210 SetStatus(kError); 327 // 328 // If there is an error, the error status is set to Error. 329 // 330 SetStatus(MCosy::kError); 331 332 // 333 // No try to handle the error. 334 // 211 335 fMac1->HandleError(); 212 336 fMac2->HandleError(); 337 338 // 339 // If the error couldn't get solved return 340 // 213 341 if (HasError()) 214 342 return; 215 343 216 SetStatus(kStopped); 217 } 218 344 // 345 // Set motor status to stopped 346 // 347 SetStatus(MCosy::kStopped); 348 } 349 350 // -------------------------------------------------------------------------- 351 // 352 // Move the telescope to the given position. The position must be given in 353 // a ZdAz object in rad. 354 // 355 // The first positioning is done absolutely. If we didn't reach the 356 // correct psotion we try to correct for this by 10 relative position 357 // maneuvers. If this doesn't help positioning failed. 358 // 359 // As a reference the shaftencoder values are used. 360 // 219 361 int MCosy::SetPosition(const ZdAz &dst) // [rad] 220 362 { … … 296 438 } 297 439 298 Bool_t MCosy::RequestRePos() 299 { 300 301 fMac2->RequestSDO(0x6004); 302 fMac1->RequestSDO(0x6004); 440 // -------------------------------------------------------------------------- 441 // 442 // Sets the tracking velocity 443 // 444 // The velocities are given in a ZdAz object in re/min. Return kTRUE 445 // in case of success, kFALSE in case of failure. 446 // 447 Bool_t MCosy::SetVelocity(ZdAz v) 448 { 449 // 450 // Send the new velocities for both axes. 451 // 452 fMac2->SendSDO(0x3006, 1, (LWORD_t)v.Zd()); // SetRpmVelocity [re/min] 453 fMac1->SendSDO(0x3006, 1, (LWORD_t)v.Az()); // SetRpmVelocity [re/min] 454 455 // 456 // Wait for the objects to be OKed. 457 // 303 458 WaitForSdos(); 459 460 // 461 // If the waiting for the objects wasn't interrupted return kTRUE 462 // 304 463 if (!StopWaitingForSDO()) 305 464 return kTRUE; 306 465 307 if (HasError()) 308 lout << "Error #6004 (requesting re pos from Macs) happened." << endl; 309 310 return kFALSE; 311 } 312 313 Bool_t MCosy::SetVelocity(ZdAz v) 314 { 315 fMac2->SendSDO(0x3006, 1, (LWORD_t)v.Zd()); // SetRpmVelocity [re/min] 316 fMac1->SendSDO(0x3006, 1, (LWORD_t)v.Az()); // SetRpmVelocity [re/min] 317 WaitForSdos(); 318 if (!StopWaitingForSDO()) 319 return kTRUE; 320 466 // 467 // print a message if the interruption was due to a Can-node Error 468 // 321 469 if (HasError()) 322 470 lout << "Error #3006 (setting velocity of Macs) happened." << endl; … … 325 473 } 326 474 475 // -------------------------------------------------------------------------- 476 // 477 // Initializes Tracking mode 478 // 479 // Initializes the accelerations of both axes with 90% of the maximum 480 // acceleration. Set the status for moving and tracking and starts thr 481 // revolution mode. 482 // 327 483 void MCosy::InitTracking() 328 484 { … … 336 492 fMac1->SetDeceleration(0.90*fMac1->GetVelRes()); 337 493 338 SetStatus( kMoving |kTracking);494 SetStatus(MCosy::kMoving | MCosy::kTracking); 339 495 340 496 fMac2->SetRpmMode(TRUE); … … 342 498 } 343 499 500 // -------------------------------------------------------------------------- 501 // 502 // Limits the speed. 503 // 504 // This function should work as a limiter. If a tracking error is too large 505 // to be corrected fast enough we would get enormous velocities. These 506 // velocities are limited to the maximum velocity. 507 // 344 508 void MCosy::LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const 345 509 { … … 527 691 } 528 692 529 int MCosy::IsPositioning() const 530 { 531 return (fMac1->IsPositioning() || fMac2->IsPositioning()) && !StopWaitingForSDO(); 532 } 533 534 void MCosy::WaitForEndMovement() 535 { 536 WaitForSdos(); 537 538 while (IsPositioning()) 539 usleep(1); 540 } 541 693 // -------------------------------------------------------------------------- 694 // 695 // Stops the movement of both motors. 696 // 697 // Sets the status to stopping. Sets the deceleration to 50% of the maximum. 698 // stops. Quits the revolution mode and wait for the end of the movement. 699 // 542 700 void MCosy::StopMovement() 543 701 { 544 SetStatus(kStopping); 545 702 // 703 // Set status to stopped 704 // 705 SetStatus(MCosy::kStopping); 706 707 // 708 // set deceleration to 50% 709 // 546 710 cout << "Stopping positioning..." << endl; 547 711 fMac1->SetDeceleration(0.5*fMac1->GetVelRes()); 548 712 fMac2->SetDeceleration(0.5*fMac2->GetVelRes()); 549 713 550 cout << "Stoping possible RPM mode..." << endl; 714 // 715 // Stop revolution mode (movement) 716 // 717 cout << "Stoping possibleRPM mode..." << endl; 551 718 fMac1->SetRpmMode(FALSE); 552 719 fMac2->SetRpmMode(FALSE); 553 720 721 // 722 // Wait for the movement to really be finished. 723 // 554 724 cout << "Waiting for silence..." << endl; 555 725 WaitForEndMovement(); 556 726 727 // 728 // Check whether everything works fine. 729 // 557 730 CheckForError(); 558 559 731 cout << "Movement stopped." << endl; 560 732 } … … 587 759 588 760 RaDec rd(37.94, 89.2644); 589 ZdAz za=sla.CalcZdAz(rd* D2PI/360.0)*16384.0/D2PI;761 ZdAz za=sla.CalcZdAz(rd*kDeg2Rad)*16384.0/k2Pi; 590 762 591 763 cout << "Calc Zd: " << za.Zd() << " Az: " << za.Az() << endl; … … 607 779 ZdAz dest = *((ZdAz*)mp); 608 780 609 SetPosition(dest* D2PI/360.0);781 SetPosition(dest*kDeg2Rad); 610 782 } 611 783 cout << "WM_Position: done. (return 0x7777)" << endl; … … 616 788 { 617 789 RaDec dest = *((RaDec*)mp); 618 TrackPosition(dest* D2PI/360.0);790 TrackPosition(dest*kDeg2Rad); 619 791 } 620 792 cout << "WM_Track: done. (return 0x8888)" << endl; … … 843 1015 844 1016 845 int MCosy::StopWaitingForSDO() const 846 { 847 return Break() || HasError(); 848 } 849 1017 // -------------------------------------------------------------------------- 1018 // 1019 // Start the work of the application: 1020 // 1021 // Start the Can-Network. 1022 // Start the MCosy::TalkThread thread. 1023 // turn on the gui update 1024 // 850 1025 void MCosy::Start() 851 1026 { … … 861 1036 } 862 1037 1038 // -------------------------------------------------------------------------- 1039 // 1040 // Start the work of the application: 1041 // 1042 // Turn of the gui update 1043 // stop the MCosy::TalkThread thread. 1044 // Stop the network 1045 // 863 1046 void MCosy::Stop() 864 1047 { -
trunk/MagicSoft/Cosy/main/MCosy.h
r926 r1111 37 37 }; 38 38 39 #define kError 0x0140 #define kMoving 0x0241 #define kTracking 0x0442 #define kStopping 0x0843 #define kStopped 0x1044 39 45 40 class TTimer; … … 50 45 51 46 private: 47 enum 48 { 49 kError = 0x01, 50 kMoving = 0x02, 51 kTracking = 0x04, 52 kStopping = 0x08, 53 kStopped = 0x10 54 }; 55 52 56 ShaftEncoder *fZd1; 53 57 ShaftEncoder *fZd2; … … 99 103 100 104 int StopWaitingForSDO() const; 101 int IsPositioning() const;102 105 void CheckForError(); 103 106 … … 117 120 118 121 static ZdAz CorrectTarget(const ZdAz &src, const ZdAz &dst); 119 // static ZdAz RaDec2ZdAz(const double mjd, const RaDec &pos, const RaDec &pm=RaDec(0,0));122 // static ZdAz RaDec2ZdAz(const double mjd, const RaDec &pos, const RaDec &pm=RaDec(0,0)); 120 123 124 ClassDef(MCosy, 0) 121 125 }; 122 126 -
trunk/MagicSoft/Cosy/main/MainLinkDef.h
r924 r1111 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MCosy; 8 7 9 #endif -
trunk/MagicSoft/Cosy/main/Makefile
r924 r1111 35 35 MStarguider.cc 36 36 37 SRCS = $(SRCFILES) 38 HEADERS = $(SRCFILES:.cc=.h) 39 OBJS = $(SRCFILES:.cc=.o) 37 SRCS = $(SRCFILES) 38 HEADERS = $(SRCFILES:.cc=.h) 39 OBJS = $(SRCFILES:.cc=.o) 40 CINTHEADERS = $(HEADERS) 40 41 41 42 ############################################################ -
trunk/MagicSoft/Cosy/videodev/Camera.cc
r910 r1111 21 21 #include <sys/resource.h> 22 22 23 ClassImp(Camera); 24 23 25 inline int Camera::Ioctl(int req, void *opt, const char *str) 24 26 { -
trunk/MagicSoft/Cosy/videodev/Camera.h
r910 r1111 2 2 #define CAMERA_H 3 3 4 #ifdef __CINT__ 5 typedef unsigned long int pthread_t; 6 struct pthread_mutex_t; 7 struct pthread_cond_t; 8 struct timeval; 9 #else 10 #include <TROOT.h> 4 11 #include <pthread.h> 5 12 #include <sys/time.h> 13 #endif 14 6 15 7 16 typedef unsigned char byte; … … 95 104 void GetPicPar(int *bright, int *hue, int *contrast); 96 105 106 ClassDef(Camera, 0) 97 107 }; 98 108 -
trunk/MagicSoft/Cosy/videodev/Filter.cc
r808 r1111 3 3 #include <memory.h> // memset 4 4 #include <iostream.h> // cout 5 6 ClassImp(Filter); 5 7 6 8 void Filter::DrawBox(const int x1, const int y1, -
trunk/MagicSoft/Cosy/videodev/Filter.h
r808 r1111 1 1 #ifndef FILTER_H 2 2 #define FILTER_H 3 4 #ifndef __CINT__ 5 #include <TROOT.h> 6 #endif 3 7 4 8 typedef unsigned char byte; … … 25 29 public: 26 30 static void Execute(byte *img); 31 32 ClassDef(Filter, 0) 27 33 }; 28 34 -
trunk/MagicSoft/Cosy/videodev/Makefile
r911 r1111 35 35 Writer.cc 36 36 37 SRCS = $(SRCFILES) 38 HEADERS = $(SRCFILES:.cc=.h) 39 OBJS = $(SRCFILES:.cc=.o) 37 SRCS = $(SRCFILES) 38 HEADERS = $(SRCFILES:.cc=.h) 39 OBJS = $(SRCFILES:.cc=.o) 40 CINTHEADERS = $(HEADERS) 40 41 41 42 ############################################################ -
trunk/MagicSoft/Cosy/videodev/VideodevLinkDef.h
r920 r1111 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class Writer+; 8 #pragma link C++ class Filter+; 9 10 #pragma link C++ class Camera+; 11 7 12 #endif -
trunk/MagicSoft/Cosy/videodev/Writer.cc
r910 r1111 8 8 9 9 #include "base/timer.h" 10 11 ClassImp(Writer); 10 12 11 13 void Writer::Png(const char *fname, const byte *buf, -
trunk/MagicSoft/Cosy/videodev/Writer.h
r808 r1111 2 2 #define WRITER_H 3 3 4 #ifdef __CINT__ 5 struct timeval; 6 #else 7 #include <TROOT.h> 4 8 #include <sys/time.h> 9 #endif 5 10 6 11 typedef unsigned char byte; … … 14 19 static void Ppm(const char *fname, const byte *img); 15 20 static void Png(const char *fname, const byte *buf, struct timeval *date); 21 22 ClassDef(Writer, 0) 16 23 }; 17 24
Note:
See TracChangeset
for help on using the changeset viewer.