Changeset 695 for BAORadio


Ignore:
Timestamp:
Sep 28, 2012, 2:14:03 PM (12 years ago)
Author:
frichard
Message:
 
Location:
BAORadio/libindi/libindi
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • BAORadio/libindi/libindi/.directory

    r502 r695  
    11[Dolphin]
    2 Timestamp=2010,11,5,21,27,5
     2Timestamp=2012,9,13,22,1,51
    33
    44[Settings]
     5HiddenFilesShown=true
    56ShowDotFiles=false
  • BAORadio/libindi/libindi/BAOTest/BAOtest_main.cpp

    r691 r695  
    1818#include <netinet/in.h>
    1919
     20//#define POSITIONS_DIRECT 
     21
    2022using namespace std;
     23
    2124
    2225
     
    7477        result.y=atoi(str.substr(7, 4).c_str());
    7578
    76         if (str[1]=='f') result.x=-result.x;
     79        if (str[1]=='f') result.x=-result.x;
    7780
    7881        if (str[6]=='f') result.y=-result.y;
     
    129132int main ( int argc, char *argv[] )
    130133{
    131     Position Pos, NouvPos;
     134    Position Pos, Pos2, NouvPos;
    132135    char cIP;
    133136    char IP[20];
     
    188191                strcpy(chaine, "");
    189192
    190 
     193#ifndef POSITIONS_DIRECT
    191194                if (abs(Pos.x - NouvPos.x) < 5 )
    192195                {
     
    208211                    Pos.y -= (NouvPos.y - Pos.y) / 6.0;
    209212                }
     213#endif
     214               
    210215
    211216                if (ErreursAleatoires) Aleat=rand()%ERREURS != 1;
     
    235240                if (asks.find("G")!=string::npos)
    236241                {
    237 
    238                     NouvPos = ExtractPosition2(asks);
     242#ifndef POSITIONS_DIRECT
     243                 NouvPos = ExtractPosition2(asks);
    239244
    240245                        NouvPos.x += Pos.x;
    241246                        NouvPos.y += Pos.y;
    242                    
    243 
     247#else
     248               
     249               Pos2 = ExtractPosition2(asks);
     250               Pos.x-=Pos2.x;
     251               Pos.y-=Pos2.y;
     252#endif
    244253                    strcpy(chaine,"ACK/GOTO/\n");
    245254                    client_socket << chaine;
  • BAORadio/libindi/libindi/BAOcontrol/BAOcontrol.pro

    r693 r695  
    11######################################################################
    2 # Automatically generated by qmake (2.01a) Thu Sep 13 21:57:57 2012
     2# Automatically generated by qmake (2.01a) Thu Sep 27 14:47:45 2012
    33######################################################################
    44
  • BAORadio/libindi/libindi/BAOcontrol/Makefile

    r693 r695  
    11#############################################################################
    22# Makefile for building: BAOcontrol
    3 # Generated by qmake (2.01a) (Qt 4.8.1) on: Thu Sep 13 21:57:57 2012
     3# Generated by qmake (2.01a) (Qt 4.8.1) on: Thu Sep 27 14:47:45 2012
    44# Project:  BAOcontrol.pro
    55# Template: app
  • BAORadio/libindi/libindi/BAOcontrol/baocontrol.cpp

    r693 r695  
    2020{
    2121    float a1, a2, a3;
    22    
     22
    2323    char *Version;
    2424
     
    2929
    3030    // Affichage de la version du programme
    31    
     31
    3232    Version = new char[1000];
    3333
     
    4040 *        franckrichard033@gmail.com      *\n \
    4141 ******************************************\n\n\n", VERSION, VERSION_DATE);
    42    
     42
    4343    AfficherLog(Version, true);
    44    
     44
    4545    delete [] Version;
    4646
     
    145145
    146146
    147 
    148147    // Transfert de la latitude, longitude, pression, température à la classe Astro
    149148
     
    154153
    155154
    156 
    157       //DefinirDateHeure(2012.0, 6.0, 29.0, 21.0, 56.0, 48.0);
    158 
     155    //DefinirDateHeure(2012.0, 6.0, 29.0, 22.0, 39.0, 40.0);
     156    //DefinirDateHeure(2012.0, 6.0, 29.0, 22.0, 49.0, 18.0);
     157    //DefinirDateHeure(2012.0, 6.0, 29.0, 22.0, 57.0, 52.0);
     158    //DefinirDateHeure(2012.0, 6.0, 29.0, 20.0, 59.0, 8.0);
     159    //DefinirDateHeure(2012.0, 6.0, 29.0, 21.0, 55.0, 57.0);
    159160
    160161
     
    164165    CalculTSL();
    165166
    166 
    167       /*double c,d;
    168       double e,f;
    169       stringstream os;
    170 
    171       os << "tsl=" << DHMS(GetTSL()*N180divPi, true)<< "  " << GetTSL() << "\n";
    172 
    173       AfficherLog(os.str(), true);
    174       os.str("");
    175 
    176       // double a=15.0*(5.0+55.0/60.0+10.3/3600.0)*Pidiv180;
    177       // double b=(7.0+24.0/60.0+25.0/3600.0)*Pidiv180;
    178 
    179       //  double a=15.0*(6.0+45.0/60.0+8.7/3600.0)*Pidiv180;
    180       //double b=-(16.0+43.0/60.0+0.3/3600.0)*Pidiv180;
    181 
    182       //double a=15.0*(5.0+55.0/60.0+50.0/3600.0)*Pidiv180;
    183       //double b=(7.0+24.0/60.0+30.0/3600.0)*Pidiv180;
    184 
    185       //  double a=15.0*(23.0+7.0/60.0+8.0/3600.0)*Pidiv180;
    186       // double b=(59.0+29.0/60.0+12.0/3600.0)*Pidiv180;
    187 
    188       double a=15.0*(14.0+15.0/60.0+39.5/3600.0)*Pidiv180;
    189       double b=(19.0+10.0/60.0+46.7/3600.0)*Pidiv180;
    190 
    191       //CoordonneesHorairesDouble Soleil;
    192 
    193       //CalculARDecSoleil(&Soleil);
    194 
    195       //a=Soleil.ar;
    196       //b=Soleil.dec;
    197       // Precession(&a, &b);
    198       // NutationEtoile(&a, &b);
    199 
    200       //  AberrationAnnuelle(&a, &b);
    201      
    202       os << "ad=" << a << "   de=" << b  << "\n";
    203 
    204       Azimut(a,b,&c,&d);
    205      
    206       c += 2.91488 * Pidiv180;
    207       d -= 8.08241 * Pidiv180;
    208      
    209       AzHa2ADDe(c, d, &a, &b);
    210      
    211       os << "ad=" << DHMS(a*N180divPi, true) << "   de=" << DHMS(b*N180divPi, false) << "\n";
    212       os << "ad=" << a << "   de=" << b  << "\n";
    213 
    214       AfficherLog(os.str(), true);
    215 
    216       Azimut(a,b,&c,&d);
    217      
    218       os.str("");
    219 
    220       os << "az=" << DHMS(c*N180divPi, false)<< "   ha=" << DHMS(d*N180divPi, false) << "\n";
    221 
    222       AfficherLog(os.str(), true);*/
    223 
    224    
     167    /*
     168    double a, b, c,d, a22, b22, c22, d22;
     169    double e,f;
     170    stringstream os;
     171
     172    os << "tsl=" << DHMS(GetTSL()*N180divPi, true)<< "  " << GetTSL() << "\n";
     173
     174    AfficherLog(os.str(), true);
     175    os.str("");
     176
     177    a=15.0*(18.0+36.0/60.0+56.3/3600.0)*Pidiv180;
     178    b=(38.0+47.0/60.0+3.1/3600.0)*Pidiv180;
     179   
     180    a= 3.61082;
     181    b=0.860677;
     182    a22=3.39278;
     183    b22=0.844504;
     184
     185    a= 4.87356;
     186    b=0.676912;
     187    a22=4.94645;
     188    b22=0.577727;
     189
     190    a= 5.41677;
     191    b=0.790291;
     192    a22=5.55106;
     193    b22=0.699053;
     194   
     195    a=4.87356;
     196    b=0.676912;
     197    a22=4.97375;
     198    b22=0.579795;
     199
     200   
     201    a=3.73351;
     202    b=0.334748;
     203    a22=3.61661;
     204    b22=0.241758;
     205   
     206
     207    //a=15.0*(18.0+37.0/60.0+22.0/3600.0)*Pidiv180;
     208    //b=(38.0+47.0/60.0+43.0/3600.0)*Pidiv180;
     209
     210    //CoordonneesHorairesDouble Soleil;
     211
     212    //CalculARDecSoleil(&Soleil);
     213
     214    //a=Soleil.ar;
     215    //b=Soleil.dec;
     216    //Precession(&a, &b);
     217    //NutationEtoile(&a, &b);
     218
     219    //AberrationAnnuelle(&a, &b);
     220
     221    os << "ad=" << DHMS(a*N180divPi, true) << "   de=" << DHMS(b*N180divPi, false) << "\n";
     222    os << "ad=" << a << "   de=" << b  << "\n";
     223
     224    Alignement *al;
     225
     226    al=new Alignement();
     227
     228    Azimut(a, b, &c, &d);
     229    Azimut(a22, b22, &c22, &d22);
     230
     231    double ec1 = (c-c22)/PasDeltaAz;
     232    double ec2=  (d-d22)/PasDeltaHa;
     233
     234    os << "nb de pas   az=" << ec1 << "  ha=" << ec2 << "\n";
     235
     236    double c3= VerifAngle((c * N180divPi * 4000.0/360.0 + ec1) * (360.0 / 4000.0) * Pidiv180 );
     237
     238    double   d3 = al->Motor2Alt(al->Alt2Motor(d * N180divPi) + ec2) * Pidiv180;
     239
     240    double sp=DistanceAngulaireEntre2Points(c, d, c3, d3) *N180divPi;
     241
     242    os << "sep=" << sp << "°    dist haut=" << (d-d3)*N180divPi <<"\n";
     243
     244    AzHa2ADDe(c3, d3, &a, &b);
     245
     246    os << "ad=" << DHMS(a*N180divPi, true) << "   de=" << DHMS(b*N180divPi, false) << "\n";
     247    os << "ad=" << a << "   de=" << b  << "\n";
     248
     249    AfficherLog(os.str(), true);
     250
     251    Azimut(a,b,&c,&d);
     252
     253    os.str("");
     254
     255    os << "az=" << DHMS(c*N180divPi, false)<< "   ha=" << DHMS(d*N180divPi, false) << "\n";
     256
     257    delete al;
     258
     259    AfficherLog(os.str(), true);
     260    */
     261   
    225262
    226263
     
    244281
    245282    Connect(true);
    246    
     283
    247284}
    248285
     
    535572    struct tm date;
    536573    struct timeval tv;
    537  
     574
    538575    // On récupÚre la date et l'heure depuis l'horloge du systÚme
    539576
     
    556593    // On lance les calculs (Temps sidéral local etc...)
    557594
    558     CalculTSL(); 
     595    CalculTSL();
    559596}
    560597
     
    10121049            return true;
    10131050        }
     1051       
     1052        if (commande == "R")
     1053        {
     1054            if (!VerifReponse("Reinitialisation de la matrice de correction", Message))
     1055            {
     1056                ErreurLog("Pas de réponse de l'antenne à la requête R.\n\n");
     1057
     1058                return false;
     1059            }
     1060
     1061            return true;
     1062        }
    10141063
    10151064        if (!VerifReponse("name=\"COMMAND_SET\" state=\"Ok\"", NULL))
     
    16551704            // et donc la magnitude < MAGNITUDEMAXETOILESCALIBRATION
    16561705
    1657             if ( Etoiles[i].selectionnee = ((Etoiles[i].ha > (HAUTMIN + 5.0) * Pidiv180) && (Etoiles[i].mag < MAGNITUDEMAXETOILESCALIBRATION)) )
     1706            if ( Etoiles[i].selectionnee = ((Etoiles[i].ha > (HAUTMIN + 5.0 ) * Pidiv180) && (Etoiles[i].mag < MAGNITUDEMAXETOILESCALIBRATION)) )
    16581707            {
    16591708                os.width(20);
     
    21142163            case 'o' :
    21152164                commande[0]='O';
     2165                break;
     2166            case 'r' :
     2167                commande[0]='R';
    21162168                break;
    21172169            }
  • BAORadio/libindi/libindi/BAOcontrol/baoqt.cpp

    r693 r695  
    1010    ui(new Ui::BAOqt)
    1111{
    12  
    13   QPoint pointPos;
     12
     13    QPoint pointPos;
    1414
    1515    RechercheOptimisation = false;
     
    9595
    9696#ifdef JOYSTICK
    97    
     97
    9898    joystick = new Joystick();
    9999
    100100    if (joystick)
    101101    {
    102       if (!joystick->init())
    103       {
    104         delete joystick;
    105        
    106         joystick = NULL;
    107        
    108         QMessageBox::information(this, tr("Jostick"), tr("Joystick inaccessible. Verifiez que le recepteur est bien branche sur un port USB."));
    109       }
    110     }
    111    
     102        if (!joystick->init())
     103        {
     104            delete joystick;
     105
     106            joystick = NULL;
     107
     108            QMessageBox::information(this, tr("Jostick"), tr("Joystick inaccessible. Verifiez que le recepteur est bien branche sur un port USB."));
     109        }
     110    }
     111
    112112#endif
    113113
    114     //ui->lineEditIP->setText("127.0.0.1");
    115     ui->lineEditIP->setText("134.158.88.199");
    116    
     114    ui->lineEditIP->setText("127.0.0.1");
     115    //ui->lineEditIP->setText("134.158.88.199");
     116
    117117    ui->lineEdit_2->setText((QString("BAORadio, LAL, version ").append(VERSION)).toStdString().c_str());
    118118
     
    126126
    127127    ui->pushButton1x->setDown(false);
    128    
     128
    129129    ui->pushButton10x->setDown(true);
    130130
     
    292292
    293293#ifdef JOYSTICK
    294    
     294
    295295    joy++;
    296296
     
    576576void BAOqt::on_pushButton1pt_clicked()
    577577{
    578     static int etape = 1;
    579 
    580     RechercheOptimisation = false;
    581 
    582     switch (etape)
    583     {
    584     case 1:
    585     {
    586         etape=2;
    587 
    588         QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Choisissez un objet facile a pointer"));
    589 
    590         on_pushButtonGoto_clicked();
    591 
    592         QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du pointage. Centrez l'objet dans le viseur et rappuyez sur le bouton 'alignement 1pt' pour terminer."));
    593 
    594     };
    595     break;
    596 
    597     case 2:
    598     {
    599         etape=1;
    600 
    601         QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Annulation du mouvement en cours."));
    602 
    603         bao->Abort();
    604 
    605         sleep(1);
    606 
    607         string str = bao->DecodageEntreesUtilisateur("send X");
    608 
    609         string str2;
    610 
    611         int x = 0;
    612         int y = 0;
    613 
    614         char a1='b';
    615         char a2='b';
    616 
    617         size_t pos = str.find("/");
    618 
    619         if (pos != string::npos)
    620         {
    621             str2 = str.substr(pos + 1);
    622 
    623             pos = str2.find("/");
    624 
    625             if (pos != string::npos)
    626             {
    627                 x = atol( str2.substr(0, pos).c_str() );
    628 
    629                 y = atol( str2.substr(pos + 1).c_str() );
    630             }
    631         }
    632 
    633         sleep(1);
    634 
    635         str = bao->DecodageEntreesUtilisateur("send D");
    636 
    637         int dx = 0;
    638         int dy = 0;
    639 
    640         pos = str.find("/");
    641 
    642         if (pos != string::npos)
    643         {
    644             str2 = str.substr(pos + 1);
    645 
    646             pos = str2.find("/");
    647 
    648             if (pos != string::npos)
    649             {
    650                 dx = atol( str2.substr(0, pos).c_str() );
    651 
    652                 x -= dx;
    653 
    654                 dy = atol( str2.substr(pos + 1).c_str() );
    655 
    656                 y -= dy;
    657 
    658                 if ( x < 0 ) {
    659                     a1 = 'f';
    660                     x = -x;
    661                 }
    662 
    663                 if ( y < 0 ) {
    664                     a2 = 'f';
    665                     y = -y;
    666                 }
    667 
    668                 char chaine[100];
    669 
    670                 sprintf(chaine, "send g%c%04df0000", a1, x);
    671 
    672                 str = bao->DecodageEntreesUtilisateur(string(chaine));
    673 
    674                 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du mouvement avant de cliquer sur OK."));
    675 
    676 
    677                 sprintf(chaine, "send gf0000%c%04d", a2, y);
    678 
    679                 str = bao->DecodageEntreesUtilisateur(string(chaine));
    680                 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Appuyez sur les deux boutons places dans la boite de l'antenne."));
    681 
    682                 QMessageBox::StandardButton reply;
    683 
    684                 reply = QMessageBox::question(this, tr("Alignement 1pt de l antenne"),
    685                                               "Voulez-vous reinitialiser les codeurs de l'antenne en envoyant la c ommande Park ?",
    686                                               QMessageBox::Yes | QMessageBox::No );
    687 
    688                 if (reply == QMessageBox::Yes)
    689                 {
    690 
    691                     str = bao->DecodageEntreesUtilisateur("send z");
    692 
    693                     sleep(1);
    694 
    695                     str = bao->DecodageEntreesUtilisateur("send p");
    696                 }
    697                 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Fin de la procedure."));
    698             }
    699         }
    700     }
    701     break;
    702     }
     578    RechercheOptimisation = false;
     579
     580    bao->DecodageEntreesUtilisateur("send r");
     581   
     582   
     583    /*
     584      static int etape = 1;
     585
     586     RechercheOptimisation = false;
     587
     588     switch (etape)
     589     {
     590     case 1:
     591     {
     592         etape=2;
     593
     594         QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Choisissez un objet facile a pointer"));
     595
     596         on_pushButtonGoto_clicked();
     597
     598         QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du pointage. Centrez l'objet dans le viseur et rappuyez sur le bouton 'alignement 1pt' pour terminer."));
     599
     600     };
     601     break;
     602
     603     case 2:
     604     {
     605         etape=1;
     606
     607         QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Annulation du mouvement en cours."));
     608
     609         bao->Abort();
     610
     611         sleep(1);
     612
     613         string str = bao->DecodageEntreesUtilisateur("send X");
     614
     615         string str2;
     616
     617         int x = 0;
     618         int y = 0;
     619
     620         char a1='b';
     621         char a2='b';
     622
     623         size_t pos = str.find("/");
     624
     625         if (pos != string::npos)
     626         {
     627             str2 = str.substr(pos + 1);
     628
     629             pos = str2.find("/");
     630
     631             if (pos != string::npos)
     632             {
     633                 x = atol( str2.substr(0, pos).c_str() );
     634
     635                 y = atol( str2.substr(pos + 1).c_str() );
     636             }
     637         }
     638
     639         sleep(1);
     640
     641         str = bao->DecodageEntreesUtilisateur("send D");
     642
     643         int dx = 0;
     644         int dy = 0;
     645
     646         pos = str.find("/");
     647
     648         if (pos != string::npos)
     649         {
     650             str2 = str.substr(pos + 1);
     651
     652             pos = str2.find("/");
     653
     654             if (pos != string::npos)
     655             {
     656                 dx = atol( str2.substr(0, pos).c_str() );
     657
     658                 x -= dx;
     659
     660                 dy = atol( str2.substr(pos + 1).c_str() );
     661
     662                 y -= dy;
     663
     664                 if ( x < 0 ) {
     665                     a1 = 'f';
     666                     x = -x;
     667                 }
     668
     669                 if ( y < 0 ) {
     670                     a2 = 'f';
     671                     y = -y;
     672                 }
     673
     674                 char chaine[100];
     675
     676                 sprintf(chaine, "send g%c%04df0000", a1, x);
     677
     678                 str = bao->DecodageEntreesUtilisateur(string(chaine));
     679
     680                 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Attendez la fin du mouvement avant de cliquer sur OK."));
     681
     682
     683                 sprintf(chaine, "send gf0000%c%04d", a2, y);
     684
     685                 str = bao->DecodageEntreesUtilisateur(string(chaine));
     686                 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Appuyez sur les deux boutons places dans la boite de l'antenne."));
     687
     688                 QMessageBox::StandardButton reply;
     689
     690                 reply = QMessageBox::question(this, tr("Alignement 1pt de l antenne"),
     691                                               "Voulez-vous reinitialiser les codeurs de l'antenne en envoyant la c ommande Park ?",
     692                                               QMessageBox::Yes | QMessageBox::No );
     693
     694                 if (reply == QMessageBox::Yes)
     695                 {
     696
     697                     str = bao->DecodageEntreesUtilisateur("send z");
     698
     699                     sleep(1);
     700
     701                     str = bao->DecodageEntreesUtilisateur("send p");
     702                 }
     703                 QMessageBox::information(this, tr("Alignement 1pt de l antenne"), tr("Fin de la procedure."));
     704             }
     705         }
     706     }
     707     break;
     708     }
     709
     710
     711     */
    703712}
    704713
     
    786795void BAOqt::on_pushButtonRetryGoto_clicked()
    787796{
    788     RechercheOptimisation = true;
    789 
    790797    RechercheOptimisation = false;
    791798
  • BAORadio/libindi/libindi/BAOcontrol/baoqt.ui

    r691 r695  
    117117    </property>
    118118    <property name="text">
    119      <string>10x</string>
     119     <string>3x</string>
    120120    </property>
    121121   </widget>
     
    166166    </property>
    167167    <property name="text">
     168     <string>Reset codeurs</string>
     169    </property>
     170   </widget>
     171   <widget class="QPushButton" name="pushButtonTo00">
     172    <property name="geometry">
     173     <rect>
     174      <x>10</x>
     175      <y>60</y>
     176      <width>85</width>
     177      <height>27</height>
     178     </rect>
     179    </property>
     180    <property name="text">
    168181     <string>Park</string>
    169     </property>
    170    </widget>
    171    <widget class="QPushButton" name="pushButtonTo00">
    172     <property name="geometry">
    173      <rect>
    174       <x>10</x>
    175       <y>60</y>
    176       <width>85</width>
    177       <height>27</height>
    178      </rect>
    179     </property>
    180     <property name="text">
    181      <string>(0,0) codeurs</string>
    182182    </property>
    183183   </widget>
     
    344344    </property>
    345345    <property name="text">
    346      <string>Align. 1 pt</string>
     346     <string>Reset matrice</string>
    347347    </property>
    348348   </widget>
     
    472472    <rect>
    473473     <x>20</x>
    474      <y>38</y>
     474     <y>32</y>
    475475     <width>511</width>
    476      <height>115</height>
     476     <height>121</height>
    477477    </rect>
    478478   </property>
  • BAORadio/libindi/libindi/LancementBAOcontrol.sh

    r693 r695  
    33echo "Lancement du serveur indiserver indi_BAO..."
    44
    5 xterm -ge 150x40 -e indiserver indi_BAO&
     5xterm -sb -rightbar -sl 3000 -ge 150x40 -e indiserver indi_BAO&
    66
    77sleep 1
  • BAORadio/libindi/libindi/communs/alignement.cpp

    r693 r695  
    2121
    2222    InitAlignement();
    23 
    24 
     23   
     24    AlignementEnCours = 0;
     25 
    2526    // initialisation des paramÚtres géométriques de l'antenne
    2627
     
    8081    // Est-ce que l'antenne est en cours d'alignement ?
    8182
    82     AlignementEnCours = 0;
     83//    AlignementEnCours = 0;
    8384
    8485    // La matrice de correction a-t-elle été calculée ?
  • BAORadio/libindi/libindi/communs/astro.cpp

    r693 r695  
    690690    }
    691691
    692     *azmin = min - 200;
    693 
    694     *azmax = max + 200;
     692    *azmin = min - 300;
     693
     694    *azmax = max + 300;
    695695
    696696    CalculTSL();
  • BAORadio/libindi/libindi/communs/const.h

    r693 r695  
    88//////////////////////////////////////////
    99
    10 #define VERSION "0.62"
    11 #define VERSION_DATE "14/09/12"
     10#define VERSION "0.63"
     11#define VERSION_DATE "28/09/12"
    1212
    1313//#define ET_UT 0.0
  • BAORadio/libindi/libindi/drivers/telescope/BAO.cpp

    r693 r695  
    127127    delta_az              = 0;
    128128    delta_ha              = 0;
    129     VitesseRaquette       = 10;
     129    VitesseRaquette       = 3;
    130130    targetAlignmentIP     = -1;
    131131
     
    568568            // est-ce que l'adresse ip correspond à l'adresse d'une antenne connectée ?
    569569
    570             for ( i=1; i<SocketsNumber; i++) if (Sockets[i].Connected)
     570            for ( i=1; i<SocketsNumber; i++) if ( Sockets[i].Connected )
    571571                {
    572572                    if (Sockets[i].IP == ip) {
     
    657657                {
    658658                    Sockets[targetAlignmentIP].AlignementAntenne->AlignementEnCours = 0;
     659                   
     660                    Sockets[targetAlignmentIP].AlignementAntenne->InitParametresInstrument();
     661                   
    659662                    Sockets[targetAlignmentIP].AlignementAntenne->CalculerMatriceCorrection(targetRA, targetDEC);
     663                   
     664                     Sockets[targetAlignmentIP].AlignementAntenne->EnregistrementParametresAlignement(
     665                        Sockets[targetAlignmentIP].IP,
     666                        "/home/" + (string)getenv("USER") + "/AlignementAntennes.cfg");
    660667                }
    661668                else
     
    666673                }
    667674            }
     675            else if (chaine[0] == 'R')
     676            {
     677                IDSetText(&CommandTP, "Reinitialisation de la matrice de correction\n" );
     678
     679                 Sockets[targetAlignmentIP].AlignementAntenne->InitParametresInstrument();
     680                 
     681                 Sockets[targetAlignmentIP].AlignementAntenne->Identity();
     682
     683                Sockets[targetAlignmentIP].AlignementAntenne->Matrice_ok = false;
     684               
     685                 Sockets[targetAlignmentIP].AlignementAntenne->EnregistrementParametresAlignement(
     686                        Sockets[targetAlignmentIP].IP,
     687                        "/home/" + (string)getenv("USER") + "/AlignementAntennes.cfg");
     688            }
    668689            else if (chaine[0] == 'O')
    669690            {
     
    13151336        case 1 :
    13161337            IUResetSwitch(&RaquetteNP);
    1317             IDSetSwitch(&RaquetteNP, "La vitesse de la raquette est fixee a 10x");
    1318             VitesseRaquette = 10;
     1338            IDSetSwitch(&RaquetteNP, "La vitesse de la raquette est fixee a 3x");
     1339            VitesseRaquette = 3;
    13191340            break;
    13201341        }
     
    14741495            double az, ha, ad, de, ad2, de2;
    14751496
    1476             int num;
    1477 
    1478             num = Sockets[targetAlignmentIP].AlignementAntenne->nbrcorrections;
    1479 
    1480             ad = targetRA * 15.0 * Pidiv180;
    1481 
    1482             Sockets[targetAlignmentIP].AlignementAntenne->ad[num] = ad;
    1483 
    1484             de = targetDEC * Pidiv180;
    1485 
    1486             Sockets[targetAlignmentIP].AlignementAntenne->de[num] = de;
    1487 
    1488             CalculTSL();
    1489 
    1490             Sockets[targetAlignmentIP].AlignementAntenne->tsl[num] = GetTSL();
    1491 
    1492             Azimut(ad, de, &az, &ha);
    1493 
    1494             //ha = RefractionAtmospherique(ha) ;
    1495 
    1496             az  = VerifAngle(az + (double)delta_az * PasDeltaAz);
    1497 
    1498             ha += (double)delta_ha * PasDeltaHa;
    1499 
    1500             AzHa2ADDe(az, ha, &ad2, &de2);
    1501 
    1502 
    1503             Sockets[targetAlignmentIP].AlignementAntenne->delta_ad[num] = ad2;
    1504 
    1505             Sockets[targetAlignmentIP].AlignementAntenne->delta_de[num] = de2;
     1497            int num = Sockets[targetAlignmentIP].AlignementAntenne->nbrcorrections;
     1498
     1499
    15061500
    15071501            stringstream os;
     
    15131507
    15141508            AfficherLog("(ad1=%s de1=%s) -> (ad2=%s de2=%s)\n",
    1515                         DHMS(ad  * N180divPi, true ).c_str(),
    1516                         DHMS(de  * N180divPi, false).c_str(),
    1517                         DHMS(ad2 * N180divPi, true ).c_str(),
    1518                         DHMS(de2 * N180divPi, false).c_str());
    1519 
    1520             AfficherLog("delta_az=%s delta_ha=%s\n",
    1521                         DHMS(delta_az * PasDeltaAz, false).c_str(),
    1522                         DHMS(delta_ha * PasDeltaHa, false).c_str());
     1509                        DHMS(Sockets[targetAlignmentIP].AlignementAntenne->ad[num]  * N180divPi, true ).c_str(),
     1510                        DHMS(Sockets[targetAlignmentIP].AlignementAntenne->de[num]  * N180divPi, false).c_str(),
     1511                        DHMS(Sockets[targetAlignmentIP].AlignementAntenne->delta_ad[num] * N180divPi, true ).c_str(),
     1512                        DHMS(Sockets[targetAlignmentIP].AlignementAntenne->delta_de[num] * N180divPi, false).c_str());
     1513
     1514            AfficherLog("delta_az=%i delta_ha=%i\n", delta_az, delta_ha);
    15231515
    15241516            Sockets[targetAlignmentIP].AlignementAntenne->nbrcorrections++;
     
    15361528        case 1 :
    15371529        {
    1538             if  (Sockets[targetAlignmentIP].AlignementAntenne->nbrcorrections >=3 )
     1530            /*if  (Sockets[targetAlignmentIP].AlignementAntenne->nbrcorrections >=3 )
    15391531            {
    15401532                // IDLog("Calcul matrice\n", true);
     
    15471539
    15481540                Sockets[targetAlignmentIP].AlignementAntenne->Matrice_ok = false;
    1549             }
     1541            }*/
    15501542
    15511543            IDSetSwitch(&AlignementOkP, "Les parametres de l alignement ont ete sauvegardes");
     
    17271719    double newRA2  = newRA * 15.0 * Pidiv180;
    17281720    double newDEC2 = newDEC * Pidiv180;
     1721    double hautmin = HAUTMIN;
    17291722    char AzStr[32];
    17301723    char AltStr[32];
    17311724    Coord result, vect;
    17321725
    1733    
     1726
    17341727    // Pour toutes les antennes connectées
    17351728
     
    17921785                                 DHMS(newDEC*N180divPi, false ).c_str());
    17931786                 }*/
     1787
    17941788            }
    17951789            else
     
    18031797                    // entre les deux programmes
    18041798
    1805                     newRA  = Sockets[i].AlignementAntenne->delta_ad[Sockets[i].AlignementAntenne->nbrcorrections];
    1806                     newDEC = Sockets[i].AlignementAntenne->delta_de[Sockets[i].AlignementAntenne->nbrcorrections];
     1799                    double az, ha, ad, de;
    18071800                   
    1808                     // if newRA et newDEC = 0 -> on sort
    1809    
     1801                    int num = Sockets[i].AlignementAntenne->nbrcorrections;
     1802
     1803                    Sockets[i].AlignementAntenne->ad[num] = newRA2;
     1804
     1805                    Sockets[i].AlignementAntenne->de[num] = newDEC2;
     1806
     1807                    //CalculTSL();
     1808
     1809                    Sockets[i].AlignementAntenne->tsl[num] = GetTSL();
     1810
     1811                    Azimut(newRA2, newDEC2, &az, &ha);
     1812
     1813                    //ha = RefractionAtmospherique(ha) ;
     1814
     1815                    az  = VerifAngle(az + (double)delta_az * PasDeltaAz);
     1816
     1817                    ha += (double)delta_ha * PasDeltaHa;
     1818
     1819                    AzHa2ADDe( az, ha, &ad, &de );
     1820
     1821                    Sockets[i].AlignementAntenne->delta_ad[num] = ad;
     1822
     1823                    Sockets[i].AlignementAntenne->delta_de[num] = de;
     1824
     1825                    newRA  = ad;
     1826                    newDEC = de;
     1827
     1828                    // if newRA et newDEC = 0 -> on sort
     1829
    18101830                    if ( newRA == 0 && newDEC == 0) return;
    18111831
     
    18451865                    //TODO :: à vérifier en détails
    18461866
     1867                    // Calcul de la hauteur minimale accessible par l'inbstrument lorsque la matrice de correction est activée
     1868
     1869                    double targetAltL = Sockets[i].AlignementAntenne->Motor2Alt(Sockets[i].AlignementAntenne->Alt2Motor2(HAUTMIN)) * Pidiv180;
     1870
     1871                    vect.x = cos(targetAltL);
     1872                    vect.y = 0.0;
     1873                    vect.z = sin(targetAltL);
     1874
     1875                    Sockets[i].AlignementAntenne->AppliquerMatriceCorrectionSimple(&result, vect);
     1876
     1877                    hautmin = asin(result.z) * N180divPi;
     1878
     1879                    AfficherLog("Hauteur  %5.0f\n", hautmin);
     1880
     1881                    // Calcul de la hauteur de l'objet suivi aprÚs application de la matrice de correction
     1882
    18471883                    double targetAltC = Sockets[i].AlignementAntenne->Motor2Alt(Sockets[i].AlignementAntenne->Alt2Motor2(targetAlt * N180divPi)) * Pidiv180;
    18481884
     
    19181954            // Conversion des deux angles en pas codeurs
    19191955
    1920             if ( targetAlt < HAUTMIN )
     1956            if ( targetAlt < hautmin )
    19211957            {
    19221958                // L'objet est trop bas ( < 30°). On annule le suivi...
     
    19431979                }
    19441980
    1945                 if ( targetAlt < HAUTMIN ) targetAlt = HAUTMIN;
     1981                if ( targetAlt < hautmin ) targetAlt = hautmin;
    19461982
    19471983                // On applique la formule de Marc pour convertir la hauteur en nombre de pas codeur alt
     
    19551991                // On ajoute les deltas en AZ et en HA pour la raquette hors procédure d'alignement
    19561992
    1957                 Sockets[i].TargetPosition.x += delta_az;
    1958 
    1959                 Sockets[i].TargetPosition.y += delta_ha;
    1960 
    1961                 //TODO : solution à trouver pour maintenir efficacement l'antenne dans l'intervalle
     1993
     1994                if (Sockets[i].AlignementAntenne->AlignementEnCours == 0)
     1995                {
     1996                    Sockets[i].TargetPosition.x += delta_az;
     1997
     1998                    Sockets[i].TargetPosition.y += delta_ha;
     1999
     2000                    //Sockets[i].TargetPosition.x = (int) Arrondi( VerifAngle( targetAz * Pidiv180 + (double)delta_az * PasDeltaAz ) * N180divPi * (double)NBREPASCODEURSAZ / 360.0);
     2001
     2002                    //Sockets[i].TargetPosition.y = (int) Arrondi( Sockets[i].AlignementAntenne->Alt2Motor( targetAlt + (double)delta_ha * PasDeltaHa * N180divPi) );
     2003                }
     2004
     2005
     2006                //TODO : à vérifier
    19622007
    19632008                // est-ce que le transit de l'objet suivi va nous emmener à sortir de l'intervalle [MINAZCODEURS..MAXAZCODEURS] ?
Note: See TracChangeset for help on using the changeset viewer.