- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Rtapi/ME/Stub/meRtapiTest.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 //#include "livapi_rt.h"
    00015 #include <Mers/Executives/DeductiveController/Rtapi/ME/ME_rtapi.h>
    00016 #include <Mers/Estimation/Discrete/Stub/ME_stub.h>
    00017 #include <Mers/Utils/Lang/Sleep.h>
    00018 #include "ME_callback_stub.h"
    00019
    00020 //#include "userfcns_debug.h"
    00021
    00022 #include <cstdio>
    00023
    00025
    00026 using namespace Mers::Executives::DeductiveController::Rtapi::ME::Stub;
    00027 using Mers::Executives::DeductiveController::Rtapi::ME::ME_rtapi;
    00028 using Mers::Estimation::Discrete::Stub::MEStub;
    00029 using Mers::Utils::Lang::sleep;
    00030
    00032
    00033 void test_ME(ME_rtapi &rtapi)
    00034 {
    00035   // queue_command
    00036   // queue_observation
    00037   // queue_observations
    00038   // queue_find_candidates
    00039   // queue_start_command_and_time
    00040   // queue_observations_and_time
    00041   // queue_abort_command
    00042   // queue_report_full_state
    00043   printf("Starting Simulation\n");
    00044   rtapi.queue_command(0, 0);
    00045   rtapi.queue_abort_command();
    00046   rtapi.queue_observation(1, 1);
    00047   rtapi.queue_observation(2, 2);
    00048   sleep(1);
    00049   printf("Adding observe (2, 3)\n");
    00050   rtapi.queue_observation(2, 3);
    00051   sleep(1);
    00052   printf("Adding start command and time (5, 4)\n");
    00053   rtapi.queue_start_command_and_time(5, 4);
    00054   printf("Adding observ (2, 5)\n");
    00055   rtapi.queue_observation(2, 5);
    00056   sleep(5);
    00057   rtapi.queue_observations_and_time(3, 6);
    00058   rtapi.queue_observation(2, 7);
    00059   rtapi.queue_report_full_state();
    00060   sleep(5);
    00061   rtapi.queue_command(3, 8);
    00062   rtapi.queue_observation(7, 9);
    00063   rtapi.queue_find_mode_estimate();
    00064   sleep(3);
    00065   printf("Simulation complete\n");
    00066   return;
    00067 }
    00068
    00075 int main()
    00076 {
    00077   MEStub *me;
    00078   ME_callback_stub *me_cbs;
    00079   ME_rtapi *me_rtapi;
    00080
    00081   me = new MEStub();
    00082   me_cbs = new ME_callback_stub();
    00083   me_rtapi = new ME_rtapi(me,me_cbs);
    00084
    00085   test_ME(*me_rtapi);
    00086
    00087   delete me_rtapi; // this will wait for the dispatcher thread to exit
    00088   delete me;
    00089   delete me_cbs;
    00090
    00091
    00092 /*
    00093   Tracker * syst;
    00094   ReportTransitionsDebug * rtd;
    00095   L2_rtapi * rtapi;
    00096
    00097   syst = new Tracker();
    00098
    00099   if(!syst)
    00100   {
    00101     perror("failed to create a Tracker object\n");
    00102     return 1;
    00103   }
    00104
    00105   rtd = new ReportTransitionsDebug(syst);
    00106   if(!rtd)
    00107   {
    00108     delete syst;
    00109     perror("failed to create a reporter object\n");
    00110     return 1;
    00111   }
    00112   rtapi = new L2_rtapi(mr, syst, *rtd);
    00113   if(!rtapi)
    00114   {
    00115     delete syst;
    00116     delete rtd;
    00117     perror("failed to create a real time interface\n");
    00118     return 1;
    00119   }
    00120   testAPI(*rtapi);
    00121   delete rtapi;
    00122   delete rtd;
    00123   delete syst;
    00124 */
    00125   return 0;
    00126 }