Changeset 122 in flair-src for trunk/lib/FlairMeta/src/Uav.cpp


Ignore:
Timestamp:
Jan 6, 2017, 1:56:26 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

modifs uav vrpn i686

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairMeta/src/Uav.cpp

    r121 r122  
    3838using namespace flair::actuator;
    3939
     40namespace {
     41  flair::meta::Uav *uavSingleton = NULL;
     42}
     43
    4044namespace flair {
    4145namespace meta {
    4246
    43 Uav::Uav(FrameworkManager *parent, string name, UavMultiplex *multiplex)
    44     : Object(parent, name) {
    45   vrpnclient = NULL;
    46   uav_vrpn = NULL;
     47Uav *GetUav(void) { return uavSingleton; }
     48       
     49Uav::Uav(string name, UavMultiplex *multiplex)
     50    : Object(getFrameworkManager(), name) {
     51        if (uavSingleton != NULL) {
     52    Err("Uav must be instanced only one time\n");
     53    return;
     54  }
     55
     56  uavSingleton = this;
    4757  verticalCamera = NULL;
    4858  horizontalCamera = NULL;
     
    8292  horizontalCamera = (Camera *)inHorizontalCamera;
    8393}
    84 /*
    85 void Uav::SetupVRPNSerial(SerialPort *vrpn_port,string name,int
    86 VRPNSerialObjectId) {
    87     vrpnclient=new VrpnClient(getFrameworkManager(),"vrpn",vrpn_port,10000,80);
    88     uav_vrpn=new MetaVrpnObject(vrpnclient,name,VRPNSerialObjectId);
    8994
    90     getFrameworkManager()->AddDeviceToLog(uav_vrpn);
    91 }
    92 */
    93 void Uav::SetupVRPNAutoIP(string name) {
    94   SetupVRPN("192.168.147.197:3883", name);
    95 }
    96 
    97 void Uav::SetupVRPN(string optitrack_address, string name) {
    98   vrpnclient = new VrpnClient(getFrameworkManager(), "vrpn", optitrack_address,
    99                               10000, 80);
    100   uav_vrpn = new MetaVrpnObject(vrpnclient, name);
    101 
    102   getFrameworkManager()->AddDeviceToLog(uav_vrpn);
    103 
    104   GetAhrs()->YawPlot()->AddCurve(uav_vrpn->State()->Element(2),
    105                                  DataPlot::Green);
    106   // GetAhrs()->RollPlot()->AddCurve(uav_vrpn->State()->Element(0),DataPlot::Green);
    107   // GetAhrs()->PitchPlot()->AddCurve(uav_vrpn->State()->Element(1),DataPlot::Green);
    108 }
    109 
    110 void Uav::StartSensors(void) {
    111   if (vrpnclient != NULL) {
    112     vrpnclient->Start();
    113   }
    114 }
    11595void Uav::UseDefaultPlot(void) {
    11696  multiplex->UseDefaultPlot();
     
    184164BatteryMonitor *Uav::GetBatteryMonitor(void) const { return battery; }
    185165
    186 VrpnClient *Uav::GetVrpnClient(void) const {
    187   if (vrpnclient == NULL)
    188     Err("vrpn is not setup, call SetupVRPN before\n");
    189   return vrpnclient;
    190 }
    191 
    192 MetaVrpnObject *Uav::GetVrpnObject(void) const { return uav_vrpn; }
    193 
    194166Camera *Uav::GetVerticalCamera(void) const { return verticalCamera; }
    195167
Note: See TracChangeset for help on using the changeset viewer.