Changeset 294 in flair-src for trunk/lib/FlairSensorActuator


Ignore:
Timestamp:
01/09/19 15:38:32 (5 years ago)
Author:
Sanahuja Guillaume
Message:

vrpn modifs

Location:
trunk/lib/FlairSensorActuator/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/VrpnClient.cpp

    r232 r294  
    3939    : Thread(getFrameworkManager(), name, priority) {
    4040        if (singleton != NULL) {
    41     Err("VrpnClient must be instanced only one time\n");
    42     return;
     41    SimpleWarn("VrpnClient should be instanced only one time!\n");
     42    SimpleWarn("Next calls to GetVrpnClient() will return the first created VrpnClient (%s)\n",singleton->ObjectName().c_str());
     43  } else {
     44    singleton = this;
    4345  }
    4446
    45   singleton = this;
    4647  pimpl_ = new VrpnClient_impl(this, name, address);
    4748}
     
    5253    : Thread(getFrameworkManager(), name, priority) {
    5354        if (singleton != NULL) {
    54     Err("VrpnClient must be instanced only one time\n");
    55     return;
     55    SimpleWarn("VrpnClient should be instanced only one time!\n");
     56    SimpleWarn("Next calls to GetVrpnClient() will return the first created VrpnClient (%s)\n",singleton->ObjectName().c_str());
     57  } else {
     58    singleton = this;
    5659  }
    57 
    58   singleton = this;
     60 
    5961  pimpl_ = new VrpnClient_impl(this, name, serialport, us_period);
    6062}
  • trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp

    r232 r294  
    4141                                 std::string address) {
    4242  this->self = self;
     43  this->address = address;
    4344  serialport = NULL;
    4445        isConnected=false;
     
    5556  rotation_1 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 1",OneAxisRotation::PreRotation);
    5657  rotation_2 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 2",OneAxisRotation::PreRotation);
     58 
     59  Printf("Connecting to VRPN server on %s\n",address.c_str());
    5760}
    5861
     
    7578  rotation_1 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 1",OneAxisRotation::PreRotation);
    7679  rotation_2 = new OneAxisRotation(setup_tab->NewRow(), "post rotation 2",OneAxisRotation::PreRotation);
     80 
     81  Printf("Connecting to VRPN server on %s\n",serialport->ObjectName().c_str());
    7782}
    7883
     
    172177        // self->Warn("erreur rt_dev_read (%s)\n",strerror(-read));
    173178      } else if (read != sizeof(response)) {
    174         self->Warn("erreur rt_dev_read %i/%i\n", read, sizeof(response));
     179        self->Warn("serial read error %i/%i\n", read, sizeof(response));
    175180      } else {
    176181        // for(ssize_t i=0;i<read;i++) printf("%x ",response[i]);
     
    209214        if(connection->connected()==vrpn_true && !isConnected) {
    210215            isConnected=true;
    211             Printf("VRPN connected\n");
     216            Printf("VRPN connected to %s\n",address.c_str());
    212217        }
    213218        if(connection->connected()==vrpn_false && isConnected) {
    214219            isConnected=false;
    215             Printf("VRPN disconnected\n");
     220            Printf("VRPN disconnected to %s\n",address.c_str());
    216221        }
    217222        //timeout in mainloop is not well handled if not connected...
     
    219224            //this is when trackables callbacks are called:
    220225            if(connection->mainloop(&timeout)!=0) {
    221                 self->Warn("connection dropped\n");
     226                self->Warn("connection dropped from\n",address.c_str());
    222227            }
    223228            //printf("%lld\n",GetTime()/(1000*1000));
  • trunk/lib/FlairSensorActuator/src/unexported/VrpnClient_impl.h

    r167 r294  
    7777  flair::core::SerialPort *serialport;
    7878        bool isConnected;//only for ip connection, not for xbee
     79  std::string address;
    7980};
    8081
Note: See TracChangeset for help on using the changeset viewer.