Changeset 1701 for trunk/MagicSoft/Cosy
- Timestamp:
- 01/10/03 15:38:47 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r1700 r1701 23 23 - implemented WM_HOME 24 24 - fixed workaround for the encoder resolutions of the MACS 25 26 * base/MGLIst.h 27 - removed (use the one from Mars) 25 28 26 29 -
trunk/MagicSoft/Cosy/candrv/network.cc
r1690 r1701 235 235 if (fNodes[i]) 236 236 { 237 lout << "- Setting up Node #" << dec << i << endl; 237 lout << "- Setting up Node #" << dec << i << " ("; 238 lout << fNodes[i]->GetNodeName() << ")" << endl; 238 239 fNodes[i]->InitDevice(this); 239 240 if (!fNodes[i]->IsZombieNode()) -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1699 r1701 110 110 111 111 case 0x6002: 112 lout << "- Velocity resolution " << GetNodeName() << ":" << dec << val << " ticks/min" << endl;112 lout << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl; 113 113 fVelRes = val; 114 114 return; 115 115 116 116 case 0x6501: 117 lout << "- Encoder resolution " << GetNodeName() << ":" << dec << val << " ticks/min" << endl;117 lout << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks/min" << endl; 118 118 fRes = val; 119 119 return; … … 132 132 case 0: 133 133 lout << ddev(MLog::eGui); 134 lout << "- Velocity set (" << GetNodeName() << ")" << endl;134 lout << "- " << GetNodeName() << ": Velocity set." << endl; 135 135 lout << edev(MLog::eGui); 136 136 return; … … 142 142 case 0: 143 143 lout << ddev(MLog::eGui); 144 lout << "- Acceleration set (" << GetNodeName() << ")" << endl;144 lout << "- " << GetNodeName() << ": Acceleration set." << endl; 145 145 lout << edev(MLog::eGui); 146 146 return; 147 147 case 1: 148 148 lout << ddev(MLog::eGui); 149 lout << "- Deceleration set (" << GetNodeName() << ")" << endl;149 lout << "- " << GetNodeName() << ": Decceleration set." << endl; 150 150 lout << edev(MLog::eGui); 151 151 return; … … 157 157 case 0: 158 158 lout << ddev(MLog::eGui); 159 lout << "- RPM mode switched (" << GetNodeName() << ")" << endl;159 lout << "- " << GetNodeName() << ": RPM mode switched." << endl; 160 160 lout << edev(MLog::eGui); 161 161 return; … … 182 182 case 0: 183 183 lout << ddev(MLog::eGui); 184 lout << "- Absolute positioning started (" << GetNodeName() << ")" << endl;184 lout << "- " << GetNodeName() << ": Absolute positioning started." << endl; 185 185 lout << edev(MLog::eGui); 186 186 return; … … 188 188 case 1: 189 189 lout << ddev(MLog::eGui); 190 lout << "- Relative positioning started (" << GetNodeName() << ")" << endl;190 lout << "- " << GetNodeName() << ": Relative positioning started." << endl; 191 191 lout << edev(MLog::eGui); 192 192 return; … … 202 202 void Macs::ReqVelRes() 203 203 { 204 lout << "- Requesting velocity resolution (velres, 0x6002) of " << GetNodeName()<< endl;204 lout << "- " << GetNodeName() << ": Requesting velocity resolution (velres, 0x6002)." << endl; 205 205 RequestSDO(0x6002); 206 206 WaitForSdo(0x6002); 207 207 } 208 208 209 void Macs::ReqRes() 210 { 211 lout << "- " << GetNodeName() << ": Requesting encoder resolution (res, 0x6501)." << endl; 212 RequestSDO(0x6501); 213 WaitForSdo(0x6501); 214 } 215 209 216 void Macs::SetPDO1On(BYTE_t flag) 210 217 { 211 lout << "- " << (flag?"Enable":"Disable") << " PDO1 of " << GetNodeName()<< endl;218 lout << "- " << GetNodeName() << ": " << (flag?"Enable":"Disable") << " PDO1." << endl; 212 219 SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31); 213 220 WaitForSdo(0x1800, 1); … … 216 223 void Macs::InitDevice(Network *net) 217 224 { 218 lout << "- MAC Init device." << endl;225 lout << "- " << GetNodeName() << ": MAC Init device." << endl; 219 226 NodeDrv::InitDevice(net); 220 lout << "- MAC Init device...done." << endl;227 lout << "- " << GetNodeName() << ": MAC Init device...done." << endl; 221 228 222 229 // SendSDO(0x4003, (LWORD_t)('E'<<24 | 'X'<<16 | 'I'<<8 'T')); … … 238 245 EnableTimeout(kFALSE); 239 246 240 lout << "- Requesting Mac Software Version of " << GetNodeName()<< endl;247 lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl; 241 248 RequestSDO(0x100a); 242 249 WaitForSdo(0x100a); … … 244 251 SetRpmMode(FALSE); 245 252 253 ReqRes(); // Init fRes 246 254 ReqVelRes(); // Init fVelRes 247 255 248 lout << "- Motor on of " << GetNodeName()<< endl;256 lout << "- " << GetNodeName() << ": Motor on." << endl; 249 257 SendSDO(0x3000, string('o', 'n')); 250 258 WaitForSdo(0x3000); … … 286 294 SetPDO1On(FALSE); 287 295 288 lout << "- Motor off of " << GetNodeName()<< endl;296 lout << "- " << GetNodeName() << ": Motor off." << endl; 289 297 SendSDO(0x3000, string('o', 'f', 'f')); 290 298 WaitForSdo(0x3000); … … 299 307 void Macs::ReqPos() 300 308 { 301 lout << "- Requesting Position of " << GetNodeName()<< endl;309 lout << "- " << GetNodeName() << ": Requesting Position." << endl; 302 310 RequestSDO(0x6004); 303 311 WaitForSdo(0x6004); 304 312 } 305 313 306 void Macs::ReqRes()307 {308 lout << "- Requesting Encoder Resolution of " << GetNodeName() << endl;309 RequestSDO(0x6501);310 WaitForSdo(0x6501);311 }312 313 314 void Macs::ReqVel() 314 315 { 315 lout << "- Requesting Velocity of " << GetNodeName()<< endl;316 lout << "- " << GetNodeName() << ": Requesting Velocity." << endl; 316 317 RequestSDO(0x2002); 317 318 WaitForSdo(0x2002); … … 320 321 void Macs::SetHome(LWORDS_t pos, WORD_t maxtime) 321 322 { 322 lout << "- Driving " << GetNodeName() << " to home position, Offset=" << dec << pos << endl; 323 /* 324 Bool_t to = fTimerOn; 325 326 if (to) 327 EnableTimeout(kFALSE); 328 */ 329 lout << "- " << GetNodeName() << ": Driving to home position, Offset=" << dec << pos << endl; 323 330 SendSDO(0x6003, 2, (LWORD_t)pos); // home 324 331 WaitForSdo(0x6003, 2); … … 328 335 SendSDO(0x3001, string('h','o','m','e')); // home 329 336 WaitForSdo(0x3001, 0, maxtime*1000); 330 lout << "- Home position of " << GetNodeName() << "reached. " << endl;337 lout << "- " << GetNodeName() << ": Home position reached. " << endl; 331 338 332 339 SendSDO(0x6003, 0, string('s','e','t')); // home 333 340 WaitForSdo(0x6003, 0); 341 342 //if (to) 343 // EnableTimeout(kTRUE); 334 344 } 335 345 … … 379 389 void Macs::SetNoWait(BYTE_t flag) 380 390 { 381 lout << "- Setting NOWAIT " << (flag?"ON ":"OFF ") << GetNodeName()<< endl;391 lout << "- " << GetNodeName() << ": Setting NOWAIT " << (flag?"ON":"OFF") << "." << endl; 382 392 SendSDO(0x3008, flag ? string('o', 'n') : string('o', 'f', 'f')); 383 393 WaitForSdo(0x3008); … … 390 400 // or by a positioning command (POSA, ...) 391 401 // 392 lout << "- Setting Vel Sync Mode of " << GetNodeName()<< endl;402 lout << "- " << GetNodeName() << ": Starting RPM Sync Mode." << endl; 393 403 SendSDO(0x3007, 0, string('s', 'y', 'n', 'c')); 394 404 WaitForSdo(0x3007, 0); … … 401 411 // or by a positioning command (POSA, ...) 402 412 // 403 lout << "- Setting Pos Sync Mode of " << GetNodeName()<< endl;413 lout << "- " << GetNodeName() << ": Starting Posistion Sync Mode." << endl; 404 414 SendSDO(0x3007, 1, string('s', 'y', 'n', 'c')); 405 415 WaitForSdo(0x3007, 1); … … 446 456 if (!errnum) 447 457 { 448 lout << " Mac " << GetNodeName() << "reports Error occursion." << endl;458 lout << "- " << GetNodeName() << ": reports Error occursion." << endl; 449 459 SetError(-1); 450 460 return; … … 456 466 // 457 467 if (GetError()>0) 458 lout << GetNodeName() << " WARNING! Error #" << GetError() << " unhandled by software." << endl; 468 { 469 lout << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl; 470 471 // 472 // If the error is unhadled and/or not cleared, don't try it again. 473 // 474 if (GetError()==errnum) 475 return; 476 } 459 477 460 478 SetError(errnum); … … 464 482 { 465 483 case 6: 484 // 485 // Report the error to the user. All possible movements should have 486 // been stopped anyhow. Now delete the error to prevent the system 487 // from reporting this error a thousands of times. 488 // 466 489 lout << "Home position not the first positioning command." << endl; 490 SetError(0); 467 491 return; 468 492 … … 607 631 void Macs::EnableTimeout(bool enable, LWORDS_t ms) 608 632 { 609 lout << "- MAC" << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl;633 lout << "- " << GetNodeName() << ": " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl; 610 634 if (!enable) 611 635 { … … 613 637 WaitForSdo(0x4000, 1); 614 638 615 lout << "- Stopping handshake (PC)." << endl;639 lout << "- " << GetNodeName() << ": Stopping handshake (PC)." << endl; 616 640 617 641 fTimeout->Stop(); //kTRUE); … … 634 658 // any reason 635 659 // 636 lout << "- MACstarting handshake." << endl;660 lout << "- " << GetNodeName() << ": starting handshake." << endl; 637 661 SendSDO(0x4000, 1, string('o', 'n')); 638 662 WaitForSdo(0x4000, 1); 639 663 } 640 lout << "- Timeout timer of " << GetNodeName() << "turned "664 lout << "- " << GetNodeName() << ": Timeout timer turned " 641 665 << (enable?"on.":"off.") << endl; 642 666 } -
trunk/MagicSoft/Cosy/devdrv/macs.h
r1690 r1701 39 39 Bool_t HandleTimer(TTimer *t); 40 40 41 void ReqRes();42 43 41 public: 44 42 Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); … … 65 63 //void ReqAxEnd(); 66 64 void ReqVelRes(); 65 void ReqRes(); 67 66 void SetHome(LWORDS_t pos=0, WORD_t maxtime=25); 68 67 void SetAcceleration(LWORD_t acc); -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1690 r1701 60 60 lout << "Scaling: " << (val&4 ?"on":"off") << " "; 61 61 lout << "Modulo: " << (val&4096?"on":"off") << endl; 62 return; 62 63 63 64 case 0x6001: … … 78 79 79 80 case 0x6502: 81 if (val==0) 82 val = 1; // Single Turn = Multiturn with one turn 80 83 lout << "- Possible Turns: " << dec << val << endl; 81 fTurns = val ? val : 1; // Single Turn = Multiturn with one turn84 fTurns = val; 82 85 return; 83 86 … … 198 201 // Requesting and checking (FIXME) type of encoder 199 202 // 200 lout << "- Requesting Hardware Type (SDO 0x1000) of " << GetNodeName()<< endl;203 lout << "- " << GetNodeName() << ": Requesting Hardware Type (0x1000)." << endl; 201 204 RequestSDO(0x1000); 202 205 if (!WaitForSdo(0x1000)) … … 210 213 // Read physical ticks per revolution 211 214 // 212 lout << "- Requesting physical ticks/revolution (SDO 0x6501) of " << GetNodeName()<< endl;215 lout << "- " << GetNodeName() << ": Requesting physical ticks/revolution (SDO 0x6501)." << endl; 213 216 RequestSDO(0x6501); 214 217 WaitForSdo(0x6501); … … 217 220 // Read number of possible ticks per revolution 218 221 // 219 lout << "- Requesting possible ticks/revolution (SDO 0x6502) of " << GetNodeName()<< endl;222 lout << "- " << GetNodeName() << ": Requesting possible ticks/revolution (SDO 0x6502)." << endl; 220 223 RequestSDO(0x6502); 221 224 WaitForSdo(0x6502); … … 224 227 // Set logic ticks/revolution = physical ticks/revolution => scale factor = 1 225 228 // 226 lout << "- Configuring SDO 0x6001 of " << GetNodeName()<< endl;229 lout << "- " << GetNodeName() << ": Configuring log. tick/rev (0x6001)." << endl; 227 230 SendSDO(0x6001, fTicks); 228 231 WaitForSdo(0x6001); … … 231 234 // Set maximum number of ticks (ticks * turns) 232 235 // 233 lout << "- Configuring SDO 0x6002 of " << GetNodeName()<< endl;236 lout << "- " << GetNodeName() << ": Configuring max number of ticks (0x6002)." << endl; 234 237 SendSDO(0x6002, (LWORD_t)(fTicks*fTurns)); 235 238 WaitForSdo(0x6002); 236 239 237 240 // 241 // Delete preset Value 242 // 243 lout << "- " << GetNodeName() << ": Delete preset value (0x6003)." << endl; 244 SendSDO(0x6003, (LWORD_t)0xffffffff); 245 WaitForSdo(0x6003); 246 247 // 238 248 // Configure PDOs 239 249 // 240 lout << "- Configuring SDO 0x1802 of " << GetNodeName()<< endl;250 lout << "- " << GetNodeName() << ": Configuring PDOs (0x1802)." << endl; 241 251 SendSDO(0x1802, 1, (LWORD_t)0x281); 242 252 WaitForSdo(0x1802, 1); 243 253 244 254 // 245 // Delete preset Value246 //247 lout << "- Configuring SDO 0x6003 of " << GetNodeName() << endl;248 SendSDO(0x6003, (LWORD_t)0xffffffff);249 WaitForSdo(0x6003);250 251 //252 255 // Request Parameter 253 256 // 254 lout << "- Requesting SDO 0x6000 of " << GetNodeName()<< endl;257 lout << "- " << GetNodeName() << ": Requesting SDO 0x6000." << endl; 255 258 RequestSDO(0x6000); 256 259 WaitForSdo(0x6000); … … 258 261 ReqPos(); 259 262 260 lout << "- Start Node " << GetNodeName()<< endl;263 lout << "- " << GetNodeName() << ": Start Node (NMT)." << endl; 261 264 SendNMT(kNMT_START); 262 265 } … … 267 270 // Request Position 268 271 // 269 lout << "- Requesting Position of " << GetNodeName()<< endl;272 lout << "- " << GetNodeName() << ": Requesting Position." << endl; 270 273 RequestSDO(0x6004); 271 274 WaitForSdo(0x6004); … … 277 280 fTurn = pre/16384; 278 281 279 lout << " - Setting Preset " << GetNodeName()<< endl;282 lout << "- " << GetNodeName() << ": Setting Preset." << endl; 280 283 SendSDO(0x6003, (LWORD_t)fPos); 281 284 WaitForSdo(0x6003); … … 284 287 void ShaftEncoder::StopDevice() 285 288 { 286 lout << "- Stop Node " << GetNodeName()<< endl;289 lout << "- " << GetNodeName() << ": Stop Node (NMT)." << endl; 287 290 SendNMT(kNMT_STOP); 288 291 } -
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r1111 r1701 72 72 axe = new TGaxis( 0, -60*4, 0, 60*4, -4, 4, 304, "+-N"); 73 73 axe->SetTitle("Zd"); // \xb0 74 axe->SetLabelOffset(-0.02); 74 75 axe->SetBit(kCanDelete); 75 76 axe->Draw(); -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1699 r1701 43 43 kPB_TRACK, 44 44 kPB_STOP, 45 kPB_HOME, 45 46 kPB_CALCALTAZ, 46 47 kPB_TPOINT, … … 98 99 99 100 l = new TGLabel(f, "Mjd:"); 100 l->Move(x-60, y+ 20);101 l->Move(x-60, y+17); 101 102 fList->Add(l); 102 103 … … 104 105 fMjd = new TGLabel(f, "00000.000000"); 105 106 fUtc->Move(x-25, y); 106 fMjd->Move(x-25, y+ 20);107 fMjd->Move(x-25, y+17); 107 108 fList->Add(fUtc); 108 109 fList->Add(fMjd); 109 110 110 111 l = new TGLabel(f, "SE-Az:"); 111 l->Move(x-60, y+ 60);112 l->Move(x-60, y+40); 112 113 fList->Add(l); 113 114 114 115 l = new TGLabel(f, "SE-Zd1:"); 115 l->Move(x-60, y+ 80);116 l->Move(x-60, y+57); 116 117 fList->Add(l); 117 118 118 119 l = new TGLabel(f, "SE-Zd2:"); 119 l->Move(x-60, y+ 100);120 l->Move(x-60, y+74); 120 121 fList->Add(l); 121 122 … … 127 128 fLabel1[1]->SetTextJustify(kTextRight); 128 129 fLabel1[2]->SetTextJustify(kTextRight); 129 fLabel1[0]->Move(x, y+ 60);130 fLabel1[1]->Move(x+43, y+ 60);131 fLabel1[2]->Move(x+70, y+ 60);130 fLabel1[0]->Move(x, y+40); 131 fLabel1[1]->Move(x+43, y+40); 132 fLabel1[2]->Move(x+70, y+40); 132 133 fList->Add(fLabel1[0]); 133 134 fList->Add(fLabel1[1]); … … 144 145 fLabel2[1]->SetTextJustify(kTextRight); 145 146 fLabel2[2]->SetTextJustify(kTextRight); 146 fLabel2[0]->Move(x, y+ 80);147 fLabel2[1]->Move(x+43, y+ 80);148 fLabel2[2]->Move(x+70, y+ 80);147 fLabel2[0]->Move(x, y+57); 148 fLabel2[1]->Move(x+43, y+57); 149 fLabel2[2]->Move(x+70, y+57); 149 150 fList->Add(fLabel2[0]); 150 151 fList->Add(fLabel2[1]); … … 161 162 fLabel3[1]->SetTextJustify(kTextRight); 162 163 fLabel3[2]->SetTextJustify(kTextRight); 163 fLabel3[0]->Move(x, y+ 100);164 fLabel3[1]->Move(x+43, y+ 100);165 fLabel3[2]->Move(x+70, y+ 100);164 fLabel3[0]->Move(x, y+74); 165 fLabel3[1]->Move(x+43, y+74); 166 fLabel3[2]->Move(x+70, y+74); 166 167 fList->Add(fLabel3[0]); 167 168 fList->Add(fLabel3[1]); … … 172 173 173 174 l = new TGLabel(f, "Offset-Zd:"); 174 l->Move(x-60, y+1 40);175 l->Move(x-60, y+102); 175 176 fList->Add(l); 176 177 177 178 l = new TGLabel(f, "Offset-Az:"); 178 l->Move(x-60, y+1 60);179 l->Move(x-60, y+119); 179 180 fList->Add(l); 180 181 … … 183 184 fOffsetZd->SetTextJustify(kTextRight); 184 185 fOffsetAz->SetTextJustify(kTextRight); 185 fOffsetZd->Move(x, y+1 40);186 fOffsetAz->Move(x, y+1 60);186 fOffsetZd->Move(x, y+102); 187 fOffsetAz->Move(x, y+119); 187 188 fList->Add(fOffsetZd); 188 189 fList->Add(fOffsetAz); 190 191 l = new TGLabel(f, "Ra (estimated):"); 192 l->Move(x-60, y+142); 193 fList->Add(l); 194 195 l = new TGLabel(f, "Ra (soll):"); 196 l->Move(x-60, y+159); 197 fList->Add(l); 198 199 l = new TGLabel(f, "Dec (estimated):"); 200 l->Move(x-60, y+182); 201 fList->Add(l); 202 203 l = new TGLabel(f, "Dec (soll):"); 204 l->Move(x-60, y+199); 205 fList->Add(l); 206 207 l = new TGLabel(f, "Zd (soll):"); 208 l->Move(x-60, y+222); 209 fList->Add(l); 210 211 l = new TGLabel(f, "Az (soll):"); 212 l->Move(x-60, y+239); 213 fList->Add(l); 214 215 fRaEst = new TGLabel(f, "+000h 00.0m"); 216 fDecEst = new TGLabel(f, "+000h 00.0m"); 217 fRaSoll = new TGLabel(f, "+000h 00.0m"); 218 fDecSoll = new TGLabel(f, "+000h 00.0m"); 219 fZdSoll = new TGLabel(f, "+000h 00.0m"); 220 fAzSoll = new TGLabel(f, "+000h 00.0m"); 221 fRaEst->SetTextJustify(kTextRight); 222 fDecEst->SetTextJustify(kTextRight); 223 fRaSoll->SetTextJustify(kTextRight); 224 fDecSoll->SetTextJustify(kTextRight); 225 fZdSoll->SetTextJustify(kTextRight); 226 fAzSoll->SetTextJustify(kTextRight); 227 fRaEst->Move(x+30, y+142); 228 fRaSoll->Move(x+30, y+159); 229 fDecEst->Move(x+30, y+182); 230 fDecSoll->Move(x+30, y+199); 231 fZdSoll->Move(x+30, y+222); 232 fAzSoll->Move(x+30, y+239); 233 fList->Add(fRaEst); 234 fList->Add(fDecEst); 235 fList->Add(fRaSoll); 236 fList->Add(fDecSoll); 237 fList->Add(fZdSoll); 238 fList->Add(fAzSoll); 189 239 190 240 … … 329 379 fList->Add(but); 330 380 381 but = new TGTextButton(tf1, "Home", kPB_HOME); 382 but->Resize(80, 25); 383 but->Move(160, 197); 384 but->SetToolTipText("Initiate Home Drive."); 385 but->Associate(this); 386 fList->Add(but); 387 331 388 but= new TGTextButton(tf2, "Calc Zd/Az", kPB_CALCALTAZ); 332 389 but->Resize(80, 25); … … 637 694 } 638 695 696 void MGCosy::UpdateRaDec(ZdAz &pos, double mjd, RaDec &radec) 697 { 698 static Int_t rai=~0; 699 static Int_t deci=~0; 700 static Int_t ras=~0; 701 static Int_t decs=~0; 702 703 static SlaStars sla; 704 sla.SetMjd(mjd); 705 706 RaDec rd = sla.CalcRaDec(pos*2*TMath::Pi()/360); 707 708 char text[64]; 709 710 rd.Ra(rd.Ra() * 24/2/TMath::Pi()); 711 rd.Dec(rd.Dec()*360/2/TMath::Pi()); 712 713 radec.Ra(radec.Ra() * 24/2/TMath::Pi()); 714 radec.Dec(radec.Dec()*360/2/TMath::Pi()); 715 716 RaDec test = rd*600; 717 718 if (rai!=(int)test.Ra()) 719 { 720 rai = (int)test.Ra(); 721 sprintf(text, "%c%dh %.1fm", rd.Ra()<0?'-':'+', abs((int)rd.Ra()), 0.1*(abs((int)test.Ra())%600)); 722 fRaEst->SetText(new TGString(text)); 723 } 724 if (deci!=(int)test.Dec()) 725 { 726 deci = (int)test.Dec(); 727 sprintf(text, "%c%dd %.1fm", rd.Dec()<0?'-':'+' , abs((int)rd.Dec()), 0.1*(abs((int)test.Dec())%600)); 728 fDecEst->SetText(new TGString(text)); 729 } 730 731 if (radec.Dec()>90|| radec.Dec()<-90) 732 { 733 radec.Ra(radec.Ra()+12); 734 radec.Dec(180-radec.Dec()); 735 } 736 radec.Ra(fmod((radec.Ra()+48), 24)); 737 738 test = radec*600; 739 740 if (ras!=(int)test.Ra()) 741 { 742 ras = (int)test.Ra(); 743 sprintf(text, "%c%dh %.1fm", radec.Ra()<0?'-':'+', abs((int)radec.Ra()), 0.1*(abs((int)test.Ra())%600)); 744 fRaSoll->SetText(new TGString(text)); 745 } 746 if (decs!=(int)test.Dec()) 747 { 748 decs = (int)test.Dec(); 749 sprintf(text, "%c%dd %.1fm", radec.Dec()<0?'-':'+' , abs((int)radec.Dec()), 0.1*(abs((int)test.Dec())%600)); 750 fDecSoll->SetText(new TGString(text)); 751 } 752 } 753 639 754 void MGCosy::UpdateOffset(ZdAz &off) 640 755 { … … 647 762 { 648 763 zd = (Int_t)off.Zd(); 649 sprintf(text, "%d ", zd);764 sprintf(text, "%dre", zd); 650 765 fOffsetZd->SetText(new TGString(text)); 651 766 } … … 653 768 { 654 769 az = (Int_t)off.Az(); 655 sprintf(text, "%d ", az);770 sprintf(text, "%dre", az); 656 771 fOffsetAz->SetText(new TGString(text)); 657 772 } 658 773 } 659 774 775 void MGCosy::UpdateZdAz(ZdAz &soll) 776 { 777 soll *= 360/2/TMath::Pi(); 778 779 static Int_t zd=~0; 780 static Int_t az=~0; 781 782 char text[21]; 783 784 ZdAz test = soll*600; 785 786 if (zd!=(int)test.Zd()) 787 { 788 zd = (int)test.Zd(); 789 sprintf(text, "%c%dh %.1fm", soll.Zd()<0?'-':'+', abs((int)soll.Zd()), 0.1*(abs((int)test.Zd())%600)); 790 fZdSoll->SetText(new TGString(text)); 791 } 792 if (az!=(int)test.Az()) 793 { 794 az = (int)test.Az(); 795 sprintf(text, "%c%dd %.1fm", soll.Az()<0?'-':'+' , abs((int)soll.Az()), 0.1*(abs((int)test.Az())%600)); 796 fAzSoll->SetText(new TGString(text)); 797 } 798 } 799 660 800 double MGCosy::UpdateTime() 661 801 { … … 682 822 } 683 823 684 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat) 824 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, 825 ZdAz soll, UInt_t stat) 685 826 { 686 827 double mjd = UpdateTime(); … … 689 830 fVelocity->Update(vel); 690 831 UpdateOffset(off); 832 UpdateRaDec(pos, mjd, radec); 833 UpdateZdAz(soll); 691 834 692 835 #define kError 0x01 … … 701 844 EnableLabel(fStopping, stat&kStopping); 702 845 EnableLabel(fStopped, stat&kStopped); 846 EnableLabel(fRaSoll, stat&kTracking); 847 EnableLabel(fDecSoll, stat&kTracking); 848 EnableLabel(fZdSoll, stat&kMoving); 849 EnableLabel(fAzSoll, stat&kMoving); 703 850 704 851 stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow(); … … 706 853 // stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow(); 707 854 708 if ( !fLog->TestBit(kHasChanged))709 return;710 711 fLog->MapSubwindows();712 fLog->Layout();713 fLog->ResetBit(kHasChanged);855 if (fLog->TestBit(kHasChanged)) 856 { 857 fLog->MapSubwindows(); 858 fLog->Layout(); 859 fLog->ResetBit(kHasChanged); 860 } 714 861 } 715 862 // ====================================================================== … … 919 1066 StopDemo(); 920 1067 fQueue->PostMsg(WM_STOP, 0, 0); 921 922 1068 cout << "PostMsg (WM_Stop) returned." << endl; 923 1069 return kTRUE; … … 972 1118 fQueue->Proc(WM_RESETBENDING, NULL); 973 1119 return kTRUE; 1120 case kPB_HOME: 1121 fQueue->PostMsg(WM_HOME, 0, 0); 1122 return kTRUE; 974 1123 975 1124 default: -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r1531 r1701 47 47 TGLabel *fOffsetAz; 48 48 49 TGLabel *fRaEst; 50 TGLabel *fDecEst; 51 52 TGLabel *fRaSoll; 53 TGLabel *fDecSoll; 54 55 TGLabel *fZdSoll; 56 TGLabel *fAzSoll; 57 49 58 TGLabel *fUtc; 50 59 TGLabel *fMjd; … … 83 92 void EnableLabel(TGLabel *label, Bool_t stat); 84 93 void UpdateOffset(ZdAz &off); 94 void UpdateZdAz(ZdAz &off); 95 void UpdateRaDec(ZdAz &pos, double mjd, RaDec &radec); 85 96 double UpdateTime(); 86 97 … … 97 108 TGListBox *GetLog() const { return fLog; } 98 109 99 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat);110 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, ZdAz soll, UInt_t stat); 100 111 101 112 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2); -
trunk/MagicSoft/Cosy/gui/MGVelocity.cc
r1690 r1701 123 123 axe = new TGaxis(0, -60*2, 0, 60*2, -2, 2, 304, "+-N"); 124 124 axe->SetTitle("Zd"); // \xb0 125 axe->SetLabelOffset(-0.02); 125 126 axe->SetBit(kCanDelete); 126 127 axe->Draw(); -
trunk/MagicSoft/Cosy/main/MCosy.cc
r1699 r1701 395 395 // const ZdAz dest = CorrectTarget(src, dst); 396 396 // 397 const ZdAz bend= fBending(dst);398 const ZdAz dest = bend*16384/2/TMath::Pi();397 fZdAzSoll = fBending(dst); 398 const ZdAz dest = fZdAzSoll*16384/2/TMath::Pi(); 399 399 400 400 lout << "Positioning to Target..." << endl; 401 401 cout << "Source Zd: " << src.Zd() << "se Az:" << src.Az() << "se" << endl; 402 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;403 cout << "Bend'd Dest Zd: " << Rad2SE(fZdAzSoll.Zd()) << "se Az:" << Rad2SE(fZdAzSoll.Az()) << "se" << endl; 404 404 cout << "Shortest Dest Zd: " << dest.Zd() << "se Az:" << dest.Az() << "se" << endl; 405 405 … … 674 674 { 675 675 // 676 // The loop should not be executed faster than the ramp of677 // a change in the velocity can be followed.678 // (This is important on fast machines >500MHz)679 //680 //usleep(100000000);681 682 //683 676 // Request Target position for this moment 684 677 // … … 759 752 // update time 760 753 // 754 // 755 // The loop should not be executed faster than the ramp of 756 // a change in the velocity can be followed. 757 // (This is important on fast machines >500MHz) 758 // 761 759 usleep(50000); // 0.05s 762 760 } … … 779 777 return; 780 778 // 781 // Set status to stopped779 // Set status to Stopping 782 780 // 783 781 SetStatus(MCosy::kStopping); … … 812 810 void *MCosy::Proc(int msg, void *mp) 813 811 { 814 cout << "MCosy::Proc: 0x" << msg << endl;815 812 switch (msg) 816 813 { … … 820 817 821 818 case WM_STOP: 819 cout << "MCosy::Proc: Stop." << endl; 822 820 StopMovement(); 823 821 return NULL; … … 923 921 cout << "WM_ResetBending: done. (return 0xbe0e)" << endl; 924 922 return (void*)0xbe0e; 923 924 case WM_HOME: 925 cout << "WM_Home: START" << endl; 926 if (fMac1 && fMac2) 927 { 928 cout << "Going Home..." << endl; 929 fMac1->SetHome(250000, 100); 930 fMac2->SetHome(250000, 100); 931 932 fAz->SetPreset(); 933 fZd1->SetPreset(); 934 fZd2->SetPreset(); 935 936 fMac1->ReqPos(); 937 fMac2->ReqPos(); 938 } 939 cout << "WM_Home: done. (return 0x403e)" << endl; 940 return (void*)0x403e; 925 941 926 942 case WM_CALCALTAZ: … … 954 970 return (void*)0xaaaa; 955 971 } 956 cout << " Unknown Msg"<< endl;972 cout << "MCosy::Proc: Unknown message 0x" << msg << endl; 957 973 return (void*)0xffffffff; 958 974 } … … 988 1004 else 989 1005 resrezd = env.GetValue("Zd_ResRE[re/U_mot]", 1500); 990 1006 991 1007 Double_t ressezd = 0; 992 1008 if (fZd1) … … 1004 1020 resseaz = env.GetValue("Az_ResSE[se/U_mot]", 16384); 1005 1021 1006 /* WORKAROUND !!!!!!!!!!!!! FIXME !!!!!!!!!!! */1007 resrezd = 500;1008 resreaz = 500;1009 1010 1022 kGearRatio.Set (gzd*resrezd/ressezd, gaz*resreaz/resseaz); //[re/se] 1011 1023 kGearRatio2.Set(gzd*resrezd/360.0, gaz*resreaz/360.0); //[re/deg] … … 1036 1048 } 1037 1049 1038 fMac1->EnableTimeout(kTRUE, 500);1039 fMac2->EnableTimeout(kTRUE, 500);1050 //fMac1->EnableTimeout(kTRUE, 500); 1051 //fMac2->EnableTimeout(kTRUE, 500); 1040 1052 1041 1053 if (!(fZd1 && fZd2 && fAz)) 1042 1054 return; 1043 1055 1044 /* 1056 1045 1057 // 1046 1058 // Start the Network … … 1049 1061 TEnv env(".cosyrc"); 1050 1062 cout << "done." << endl; 1051 1063 /* 1052 1064 const int res = fMac3->GetVelRes(); 1053 1065 … … 1222 1234 } 1223 1235 1236 fZdAzSoll.Set(sollzd.Zd(), sollaz.Az()); 1237 fZdAzSoll *= 2*TMath::Pi()/16384; 1238 1224 1239 fTrackingError.Set((ist.Zd()-sollzd.Zd())*kGearRatio.X(), 1225 1240 (ist.Az()-sollaz.Az())*kGearRatio.Y()); … … 1248 1263 1249 1264 fWin->Update(bendist*(360.0/2/TMath::Pi()), fTrackingError/kGearRatio2, 1250 fVelocity, fOffset/*/kGearRatio2*/, 1265 fVelocity, fOffset/*/kGearRatio2*/, fRaDec, fZdAzSoll, 1251 1266 fStatus); 1252 1267 … … 1291 1306 lout << "- Starting TX Thread." << endl; 1292 1307 fTTalk = new MTTalk(this); 1308 // fTGui = new MTGui(this); 1293 1309 1294 1310 lout << "- Starting GUI update." << endl; 1295 1311 fUpdateGui->TurnOn(); 1296 // fTGui = new MTGui(this);1297 1312 } 1298 1313 -
trunk/MagicSoft/Cosy/main/MCosy.h
r1699 r1701 21 21 #define WM_RESETBENDING 0x1008 22 22 #define WM_CALCALTAZ 0x1009 23 #define WM_HOME 0x100a 24 23 25 24 26 class ShaftEncoder; … … 76 78 ZdAz fTrackingError; // Tracking Offset between SE and calc-pos [re] 77 79 ZdAz fOffset; // Offset between se and re coordinate system [re] 80 ZdAz fZdAzSoll; // Soll position when moving 78 81 RaDec fRaDec; // Position to track 79 82 int fTracking; // Flag for present tracking action
Note:
See TracChangeset
for help on using the changeset viewer.