Changeset 8863


Ignore:
Timestamp:
02/15/08 21:42:55 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r8862 r8863  
    11                                                                  -*-*- END -*-*-
    22
    3  2008/02/13 Thomas Bretz (La Palma)
     3 2008/02/15 Thomas Bretz (La Palma)
     4
     5   * candrv/network.cc, candrv/nodedrv.h:
     6     - changed arguments and contents of HandleSDOError
     7
     8   * devdrv/macs.[h,cc]:
     9     - added status/error handling for DKC status
     10
     11   * devdrv/shaftencoder.cc:
     12     - changed some output
     13     - handle all four bytes in case of the position
     14
     15   * gui/MGCosy.cc:
     16     - increased width of shaftencoder labels
     17
     18
     19
     20 2008/02/15 Thomas Bretz (La Palma)
    421
    522   * cosy.cc:
  • trunk/MagicSoft/Cosy/candrv/network.cc

    r8862 r8863  
    111111
    112112        case kSDO_TX_ERROR:  // error message (instead of 0x60)
    113             fNodes[node]->HandleSDOError(data);
     113            fNodes[node]->HandleSDOError(idx, subidx);
    114114            return;
    115115        }
  • trunk/MagicSoft/Cosy/candrv/nodedrv.cc

    r8843 r8863  
    167167// Print an error message with the corresponding data from this device.
    168168//
    169 void NodeDrv::HandleSDOError(LWORD_t data)
    170 {
    171     gLog << warn << "WARNING - Nodedrv::HandleSDOError: Entry not found in dictionary (data=0x";
    172     gLog << hex << setfill('0') << setw(4) << data << ")";
     169void NodeDrv::HandleSDOError(WORD_t idx, BYTE_t subidx)
     170{
     171    gLog << warn << "WARNING - Nodedrv::HandleSDOError: Node #" << dec << (int)fId << ": Entry not found in dictionary (idx=0x";
     172    gLog << hex << setfill('0') << setw(4) << idx << "/" << (int)subidx << dec << ")";
    173173    gLog << endl;
    174174}
  • trunk/MagicSoft/Cosy/candrv/nodedrv.h

    r8835 r8863  
    6767    virtual void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv);
    6868    virtual void HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, const timeval_t &tv);
    69     virtual void HandleSDOError(LWORD_t data);
     69    virtual void HandleSDOError(WORD_t idx, BYTE_t subidx);
    7070
    7171    virtual void HandlePDO1(const BYTE_t *data, const timeval_t &tv) {}
  • trunk/MagicSoft/Cosy/devdrv/macs.cc

    r8835 r8863  
    44
    55#include "network.h"
     6
    67#include "MLogManip.h"
     8
     9#include "MString.h"
    710
    811ClassImp(Macs);
     
    4245}
    4346
     47TString Macs::EvalStatusDKC(UInt_t stat) const
     48{
     49    switch (stat)
     50    {
     51    case 0: return "offline";
     52    case 0xa000:
     53    case 0xa001:
     54    case 0xa002:
     55    case 0xa003: return MString::Format("Communication phase %d", stat&0xf);
     56    case 0xa010: return "Drive HALT";
     57    case 0xa012: return "Control and power section ready for operation";
     58    case 0xa013: return "Ready for power on";
     59    case 0xa100: return "Drive in Torque mode";
     60    case 0xa101: return "Drive in Velocity mode";
     61    case 0xa102: return "Position control mode with encoder 1";
     62    case 0xa103: return "Position control mode with encoder 2";
     63    case 0xa104: return "Lagless position control mode with encoder 1";
     64    case 0xa105: return "Lagless position control mode with encoder 2";
     65    case 0xa106: return "Drive controlled interpolated positioning with encoder 1";
     66    case 0xa107: return "Drive controlled interpolated positioning with encoder 2";
     67    case 0xa108: return "Drive controlled interpolated absolute positioning lagless with encoder 1";
     68    case 0xa109: return "Drive controlled interpolated absolute positioning lagless with encoder 2";
     69    case 0xa146: return "Drive controlled interpolated relative positioning with encoder 1";
     70    case 0xa147: return "Drive controlled interpolated relative positioning with encoder 2";
     71    case 0xa148: return "Drive controlled interpolated relative positioning lagless with encoder 1";
     72    case 0xa149: return "Drive controlled interpolated relative positioning lagless with encoder 2";
     73    case 0xa208: return "Jog mode positive";
     74    case 0xa218: return "Jog mode negative";
     75    case 0xa400: return "Automatic drive check and adjustment";
     76    case 0xa401: return "Drive decelerating to standstill";
     77    case 0xa800: return "Unknown operation mode";
     78    case 0xc217: return "Motor encoder reading error";
     79    case 0xc218: return "Shaft encoder reading error";
     80    case 0xc220: return "Motor encoder initialization error";
     81    case 0xc221: return "Shaft encoder initialization error";
     82    case 0xc400: return "Switching to parameter mode";
     83    case 0xc500: return "Error reset";
     84    case 0xe225: return "Motor overload";
     85    case 0xe250: return "Drive overtemp warning";
     86    case 0xe251: return "Motor overtemp warning";
     87    case 0xe252: return "Bleeder overtemp warning";
     88    case 0xe834: return "Emergency-Stop";
     89    case 0xe843: return "Positive end-switch activated";
     90    case 0xe844: return "Negative end-switch activated";
     91    case 0xf218: return "Amplifier overtemp shutdown";
     92    case 0xf219: return "Motor overtemp shutdown";
     93    case 0xf220: return "Bleeder overload shutdown";
     94    case 0xf221: return "Motor temperature surveillance defective";
     95    case 0xf224: return "Maximum breaking time exceeded";
     96    case 0xf228: return "Excessive control deviation";
     97    case 0xf269: return "Error during release of the motor holding brake";
     98    case 0xf276: return "Absolute encoder out of allowed window";
     99    case 0xf409: return "Bus error on Profibus interface";
     100    case 0xf434: return "Emergency-Stop";
     101    case 0xf629: return "Positive sw end-switch";
     102    case 0xf630: return "Negative sw end-switch";
     103    case 0xf634: return "Emergency-Stop";
     104    case 0xf643: return "Positive hw end-switch";
     105    case 0xf644: return "Negative hw end-switch";
     106    case 0xf870: return "24V DC error.";
     107    case 0xf878: return "Velocity loop error";
     108    }
     109    return "unknown";
     110}
     111
     112Bool_t Macs::EvalStatus(LWORD_t val) const
     113{
     114    const Int_t errnum = val&0xffff;
     115    const Int_t errinf = val>>16;
     116
     117    if (errnum!=0xff)
     118        return errnum==0;
     119
     120    const Int_t type = errinf&0xf000;
     121
     122    gLog << all << "DKC reports: ";
     123
     124    switch (type)
     125    {
     126    case 0xf000: gLog << "ERROR"; break;
     127    case 0xe000: gLog << "WARNING"; break;
     128    case 0xa000: gLog << "Status"; break;
     129    default:     gLog << "Unknown"; break;
     130    }
     131
     132    gLog << " (" << MString::Format("%X", errinf) << "): " << EvalStatusDKC(errinf);
     133
     134    gLog << (type==0xf000 || type==0xe000 ? "!" : ".") << endl;
     135
     136    return type==0xa000;
     137}
     138
    44139void Macs::HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv)
    45140{
     
    52147        if (subidx!=2)
    53148            return;
    54         gLog << inf2 << "- " << GetNodeName() << ": Error[0]=" << dec << val << endl;
    55         SetError(val);
     149        gLog << inf2 << "- " << GetNodeName() << ": Error[0]=" << hex << val << dec << endl;
     150        SetError(EvalStatus(val) ? 0 : val);
    56151        return;
    57152
     
    122217
    123218    case 0x6002:
    124         gLog << inf2 << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl;
     219        gLog << inf2 << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " (100%)" << endl;
    125220        fVelRes = val;
    126221        return;
    127222
    128223    case 0x6501:
    129         gLog << inf2 << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks/min" << endl;
     224        gLog << inf2 << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks" << endl;
    130225        fRes = val;
    131226        return;
     
    362457    if (fSoftVersion<0x00000045) // 00.69
    363458    {
    364         gLog << err << GetNodeName() << " - Software Version too old!" << endl;
     459        gLog << err << GetNodeName() << " - Software Version " << 0.01*fSoftVersion << " too old!" << endl;
    365460        SetZombie();
    366461        return;
     
    471566    SendSDO(0x2002, vel);     // velocity
    472567    WaitForSdo(0x2002, 0);
     568    cout << "SET VEL: " << vel << endl;
    473569}
    474570
     
    477573    SendSDO(0x2003, 0, acc);  // acceleration
    478574    WaitForSdo(0x2003, 0);
     575    cout << "SET ACC: " << acc << endl;
    479576}
    480577
     
    483580    SendSDO(0x2003, 1, dec);  // acceleration
    484581    WaitForSdo(0x2003, 1);
     582    cout << "SET DEC: " << dec << endl;
    485583}
    486584
     
    503601{
    504602    SendSDO(0x6004, 1, (LWORD_t)pos);
     603    cout << "REL POS: " << (LWORD_t)pos << endl;
    505604}
    506605
     
    508607{
    509608    SendSDO(0x6004, 0, (LWORD_t)pos);
     609    cout << "ABS POS: " << (LWORD_t)pos << endl;
    510610}
    511611
     
    585685    LWORDS_t errinf = (data[4]<<24) | (data[5]<<16) | (data[6]<<8) | data[7];
    586686
    587     //
     687    // Check if the DKC changed its status message
     688    if (errnum==0xff && (errinf&0xf000)<=0xe000)
     689    {
     690        EvalStatus(errnum, errinf);
     691        SetError(0);
     692        return;
     693    }
     694
     695    // Check if MACS report error occursion.
    588696    // errnum==0 gives a sudden information that something happened. Now the
    589697    // microcontroller is running inside its interrupt procedure which
     
    606714    if (GetError()>0)
    607715    {
    608         gLog << warn << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl;
     716        gLog << warn << GetNodeName() << ": WARNING! Previous error #" << GetError() << " unhandled (not cleared) by software." << endl;
    609717
    610718        //
     
    724832        return;
    725833
     834    case 0xff:
     835        EvalStatus(errnum, errinf);
     836        return;
     837
    726838    default:
    727         gLog << "Error Nr. " << errnum << ", " << errinf << endl;
     839        gLog << "Error Nr. " << dec << errnum << ", " << errinf << endl;
    728840    }
    729841}
     
    800912        DelError();
    801913        return;
     914
     915    case 0xff:
     916        gLog << err << "DKC error! Go and check what is going on!" << endl;
     917        DelError();
     918        return;
    802919/*
    803920    case 101:
     
    870987    gLog << inf2 << "- " << GetNodeName() << ": Hostguarding stopped." << endl;
    871988}
    872 
  • trunk/MagicSoft/Cosy/devdrv/macs.h

    r8835 r8863  
    3737    void Init();
    3838    void StopDevice();
     39
     40    TString EvalStatusDKC(UInt_t stat) const;
     41    Bool_t  EvalStatus(LWORD_t val) const;
     42    Bool_t  EvalStatus(UInt_t errnum, UInt_t errinf) const
     43    {
     44        return EvalStatus(errnum|(errinf<<16));
     45    }
    3946
    4047    void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv);
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r8862 r8863  
    9292
    9393    case 0x6004:
    94         gLog << inf2 << "- Position: " << dec << val << endl;
     94        gLog << inf2 << "- Reported position: " << dec << (Int_t)val << endl;
    9595        fPos  = val;
    9696        fTurn = 0;
     
    237237    // Decode information, we have a 14bit only
    238238    //
    239     LWORDS_t pos  = data[0] | (data[1]<<8) | (data[2]<<16); // | (data[3]<<24);
     239    LWORDS_t pos  = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
    240240    BYTE_t   flag = data[4];
    241241
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r8856 r8863  
    165165    fList->Add(fWeather);
    166166
    167     fLabel1 = new TGLabel(f, "00000"); // Max: 16384
    168     fLabel2 = new TGLabel(f, "00000");
    169     fLabel3 = new TGLabel(f, "00000");
     167    fLabel1 = new TGLabel(f, "00000000"); // Max: 16384
     168    fLabel2 = new TGLabel(f, "00000000");
     169    fLabel3 = new TGLabel(f, "00000000");
    170170    fLabel1->SetTextJustify(kTextRight);
    171171    fLabel2->SetTextJustify(kTextRight);
Note: See TracChangeset for help on using the changeset viewer.