Ignore:
Timestamp:
02/24/08 11:26:09 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r8865 r8875  
    406406
    407407//#ifdef EXPERT
    408     //point.SetPointAccDec(0.3, 0.3);
    409     //point.SetPointVelocity(0.3);
     408//    point.SetPointAccDec(0.25, 0.25);
     409//    point.SetPointVelocity(0.4);
    410410//#else
    411411
     
    449449    track.SetPointVelocity(0.1);
    450450
    451     //    track.SetPointAccDec(0.4, 0.4);
     451    // track.SetPointAccDec(0.4, 0.4);
    452452    // track.SetPointVelocity(0.4);
    453453
     
    699699                return 0xebb0;
    700700
    701             //const bool arm = *((bool*)mp);
    702             //if (arm)
    703             //{
     701            const bool arm = mp ? *((bool*)mp) : true;
     702            if (arm)
     703            {
    704704                fMac1->Arm();
    705705                fMac2->Arm();
    706                 //cout << "ARMED" << endl;
    707             //}
    708             //else
    709             //{
    710             //    fMac1->Disarm();
    711             //    fMac2->Disarm();
    712                 //cout << "DISARMED" << endl;
    713             //}
     706            }
     707            else
     708            {
     709                fMac1->Disarm();
     710                fMac2->Disarm();
     711            }
    714712        }
    715713        //cout << "WM_Position: done. (return 0x7777)" << endl;
     
    12901288    //cout << (fStatus&MDriveCom::kTracking?"TRA: ":"POS: ") << bendist.Zd() << " " << bendist.Az() << endl;
    12911289
    1292     fCom->SendReport(fStatus, fRaDec, fZdAzSoll, bendist, fTrackingError);
     1290    fCom->SendReport(fStatus, fRaDec, fZdAzSoll, bendist, fTrackingError, armed);
    12931291
    12941292    fWin->UpdateWeather(*fCom);
     
    16141612}
    16151613
    1616 MCosy::MCosy(MEnv &env, const char *addr, const char *pointing)
     1614MCosy::MCosy(MEnv &env, MDriveCom *com, const char *pointing)
    16171615: Network(), fObservatory(MObservatory::kMagic1), fStarguider(NULL),
    16181616fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), /*fMac3(0),*/
     
    16651663    fAz->SetDisplay(fWin->GetLabel1());
    16661664
    1667     fCom = new MDriveCom(this, addr, fOutRep);
    1668 //    fCom->Start();
     1665    fCom = com;//new MDriveCom(this, addr, tx, rx, fOutRep);
     1666    fCom->SetOutRep(fOutRep);
     1667    //    fCom->Start();
    16691668}
    16701669
     
    16911690MCosy::~MCosy()
    16921691{
     1692    if(fCom)
     1693    {
     1694        fCom->SetMsgQueue(NULL);
     1695        fCom->SetOutRep(NULL);
     1696    }
     1697
    16931698    gLog << inf2 << "Deleting GUI timer." << endl;
    16941699    // FIXME: Wait until last Update was finished!!!
     
    17041709        delete fOutTp;
    17051710    }
     1711
    17061712    delete fOutRep;
    17071713
    1708     gLog << inf2 << "Deleting CC communication." << endl;
    1709     delete fCom;
     1714    //gLog << inf2 << "Deleting CC communication." << endl;
     1715    //delete fCom;
    17101716
    17111717    gLog << inf2 << "Deleting Nodes." << endl;
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r8865 r8875  
    181181
    182182public:
    183     MCosy(MEnv &env, const char *addr, const char *pointing);
     183    MCosy(MEnv &env, MDriveCom *com, const char *pointing);
    184184    ~MCosy();
    185185
     
    212212    MLog *GetOutRep() { return fOutRep; }
    213213
    214     //rwagner
    215214    MDriveCom *GetDriveCom() { return fCom; }
    216215
  • trunk/MagicSoft/Cosy/main/MSlewing.cc

    r8824 r8875  
     1#include "MSlewing.h"
    12#include "MSlewing.h"
    23
     
    78#include "MDriveCom.h"
    89
     10#include "MString.h"
    911#include "MPointing.h"
    1012
     
    165167        // Round to check whether we are as near as possible
    166168        // to the value we expect
    167         cd.Round();
    168 
     169
     170        cout << cd.Zd() << " " << cd.Az() << endl;
     171
     172        cd /= fCosy->kResSE; // Scale to Revolutions
     173
     174        gLog << inf2 << "- Shaftencoders show a residual deviation of dZd=";
     175        gLog << MString::Format("%.2f", cd.Zd()*360*60) << "' and dAz=";
     176        gLog << MString::Format("%.2f", cd.Az()*360*60) << "'" << endl;
     177
     178        cout << cd.Zd() << " " << cd.Az() << endl;
     179 
     180        cd *= 1./fMaxResidual; // Scale to units of the maximum residual
     181
     182        cout << fCosy->kResSE.X() << " " << 1./fMaxResidual << endl;
     183        cout << cd.Zd() << " " << cd.Az() << endl;
     184
     185        cd.Abs();
     186
     187        // FIXME:: Do NOT check Shaftencoder values!!!
    169188        // Check if there is a control deviation on the axis
    170         const Bool_t cdzd = (int)cd.Zd() ? kTRUE : kFALSE;
    171         const Bool_t cdaz = (int)cd.Az() ? kTRUE : kFALSE;
     189        const Bool_t cdzd = cd.Zd()>0.5 ? kTRUE : kFALSE;
     190        const Bool_t cdaz = cd.Az()>0.5 ? kTRUE : kFALSE;
     191
     192        cout << (int)cdzd << " " << (int)cdaz << endl;
    172193
    173194        // check if we reached the correct position already
     
    183204        // ==============================================
    184205        //   Estimate the noncircularity of the zd axis
    185         const ZdAz ist = dst-rd*TMath::TwoPi()/fCosy->kResSE;
    186 
    187         const double p1 = ist.Zd()-19.0605/kRad2Deg;
    188         const double p2 = dst.Zd()-19.0605/kRad2Deg;
    189 
    190         const double f1 = (-26.0101*sin(p1)+443.761*ist.Zd())*rad2se;
    191         const double f2 = (-26.0101*sin(p2)+443.761*dst.Zd())*rad2se;
    192         // ==++=========================================
     206//        const ZdAz ist = dst-rd*TMath::TwoPi()/fCosy->kResSE;
     207
     208//        const double p1 = ist.Zd()-19.0605/kRad2Deg;
     209//        const double p2 = dst.Zd()-19.0605/kRad2Deg;
     210
     211 //       const double f1 = (-26.0101*sin(p1)+443.761*ist.Zd())*rad2se;
     212 //       const double f2 = (-26.0101*sin(p2)+443.761*dst.Zd())*rad2se;
     213        // ===========================================
     214
     215        gLog << warn << "WARNING - The center of the elevation axis is taken as center of the drive bow" << endl;
     216
    193217
    194218        // change units from se to re
    195219//        rd *= fCosy->kGearTot/fCosy->kResSE; // [re]
    196220        rd *= Div(fCosy->kGearTot,fCosy->kResSE); // [re]
    197         rd.Zd(f2-f1);
     221//        rd.Zd(f2-f1);
    198222
    199223        // Initialize Velocities so that we reach both positions
     
    201225        if (i)
    202226        {
    203             //lout << "--- LO-SPEED ---" << endl;
    204             SetAccDec(fCosy->fMac1, 0.1, 0.1);
    205             SetAccDec(fCosy->fMac2, 0.1, 0.1);
     227            //cout << "--- LO-SPEED ---" << endl;
     228            SetAccDec(fCosy->fMac1, 0.05, 0.05);
     229            SetAccDec(fCosy->fMac2, 0.05, 0.05);
    206230
    207231            SetPosVelocity(1.0, 0.05);
     
    209233        else
    210234        {
     235            // 15 motor revolutions
    211236            const Double_t y = 15*fCosy->kGearTot.Y()/fCosy->kResSE.Y();
    212237
     
    215240
    216241            if (rd.Az()>-y && rd.Az()<y)
    217               {
    218                 //lout << "--- LO-SPEED Mac1 ---" << endl;
    219242                SetAccDec(fCosy->fMac1, 0.05, 0.05);
    220               }
    221243            else
    222               {
    223 
    224                 //lout << "MSlewing::SetPosition SetAccDec Mac1: " << fAcc << fDec << endl;
    225                
    226                 SetAccDec(fCosy->fMac1, fAcc, fDec);
    227                
    228               }
    229 
    230 
    231             // new 16.05.05  F.G.
    232             // SetAccDec(fCosy->fMac1, fAcc, fDec);
     244                SetAccDec(fCosy->fMac1, fAcc, fDec);
    233245
    234246            SetAccDec(fCosy->fMac2, fAcc, fDec);
     
    267279
    268280    t.Now();
    269     gLog << warn << t << " - Warning: Requested position not reached (i=" << dec << i << ")" << endl;
     281    gLog << warn << t << " - Warning: Requested position not reached (i=" << i << ")" << endl;
    270282
    271283    fCosy->fCom->SendStatus("Target position missed!");
  • trunk/MagicSoft/Cosy/main/MSlewing.h

    r8869 r8875  
    2323    Float_t fDec;
    2424
     25    Float_t fMaxResidual; // [rev] Maximum residual deviation to stop pointin
     26
    2527    void DoRelPos(const ZdAz &rd, const Bool_t axe1, const Bool_t axe2);
    2628    void SetPosVelocity(const Float_t ratio, Float_t vel);
    2729
    2830public:
    29     MSlewing(MCosy *cosy) : fCosy(cosy), fVel(0.1), fAcc(0.2), fDec(0.1) { }
     31    MSlewing(MCosy *cosy) : fCosy(cosy), fVel(0.1), fAcc(0.2), fDec(0.1), fMaxResidual(1./16384) { }
    3032
    3133    void SetPointAccDec(Float_t acc, Float_t dec) { fAcc = acc; fDec = dec; }
    3234    void SetPointVelocity(Float_t vel) { fVel = vel; }
    3335    int  SetPosition(const ZdAz &dst, Bool_t track=kFALSE);
     36    void SetMaxResidual(Float_t ac) { fMaxResidual = ac; }
    3437
    3538    ClassDef(MSlewing, 0)
Note: See TracChangeset for help on using the changeset viewer.