Changeset 294 in flair-src


Ignore:
Timestamp:
Jan 9, 2019, 3:38:32 PM (22 months ago)
Author:
Sanahuja Guillaume
Message:

vrpn modifs

Location:
trunk/lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/Object.cpp

    r15 r294  
    9191  if (rt_task_self() != NULL) {
    9292    rt_fprintf(stderr, "\033[%dm", color);
    93     if (line) {
    94       rt_fprintf(stderr, "%s - line %d, %s: ", function, line,
    95                  pimpl_->name.c_str());
    96     } else {
    97       rt_fprintf(stderr, "%s, %s: ", function, pimpl_->name.c_str());
     93    if(function) {
     94      if (line) {
     95        rt_fprintf(stderr, "%s - line %d, %s: ", function, line,
     96                   pimpl_->name.c_str());
     97      } else {
     98        rt_fprintf(stderr, "%s, %s: ", function, pimpl_->name.c_str());
     99      }
    98100    }
    99101    rt_vfprintf(stderr, format, *args);
     
    103105  {
    104106    fprintf(stderr, "\033[%dm", color);
    105     if (line) {
    106       fprintf(stderr, "%s - line %d, %s: ", function, line,
    107               pimpl_->name.c_str());
    108     } else {
    109       fprintf(stderr, "%s, %s: ", function, pimpl_->name.c_str());
     107    if(function) {
     108      if (line) {
     109        fprintf(stderr, "%s - line %d, %s: ", function, line,
     110                pimpl_->name.c_str());
     111      } else {
     112        fprintf(stderr, "%s, %s: ", function, pimpl_->name.c_str());
     113      }
    110114    }
    111115    vfprintf(stderr, format, *args);
  • trunk/lib/FlairCore/src/Object.h

    r15 r294  
    1818#include <stdarg.h>
    1919
     20//orange printf, with function call and object name display
    2021#define Warn(...) Warning(__PRETTY_FUNCTION__, __VA_ARGS__)
     22//red printf, with function call and object name display
    2123#define Err(...) Error(__PRETTY_FUNCTION__, __VA_ARGS__)
     24//green printf, with function call and object name display
    2225#define Info(...) Information(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
     26
     27//orange printf
     28#define SimpleWarn(...) Warning(NULL, __VA_ARGS__)
    2329
    2430#define TIME_INFINITE 0
     
    140146  * Green colored Printf(). \n
    141147  * Note that it is better to call Info macro, which automatically fills
    142   *function parameter.
     148  * calling function parameter.
    143149  *
    144150  * \param function name of calling function
     
    154160  * Orange colored Printf(). \n
    155161  * Note that it is better to call Warn macro, which automatically fills
    156   *function parameter.
     162  * calling function parameter.
    157163  *
    158164  * \param function name of calling function
     
    166172  * Red colored Printf(). \n
    167173  * Note that it is better to call Err macro, which automatically fills function
    168   *parameter. \n
     174  * calling parameter. \n
    169175  * After calling this method, ErrorOccured() will always return true.
    170176  *
  • trunk/lib/FlairCore/src/Unix_SerialPort.h

    r15 r294  
    3535  * \param parent parent
    3636  * \param name name
    37   * \param device serial device (ex rtser1)
     37  * \param device serial device (ex /dev/ttyS0)
    3838  */
    3939  Unix_SerialPort(const Object *parent, std::string port_name,
  • 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
  • trunk/lib/FlairSimulator/src/Gui_impl.cpp

    r288 r294  
    378378  std::ostringstream text;
    379379
    380   text << "Cam: " << cameras.at(cam_id)->getName().c_str()
     380  text << getSimulator()->ObjectName().c_str()  << ", active cam: " << cameras.at(cam_id)->getName().c_str()
    381381     << ", FPS: " << fps;
    382382
  • trunk/lib/FlairSimulator/src/Simulator_impl.cpp

    r286 r294  
    3636  this->optitrack_mstime = optitrack_mstime;
    3737  yaw_rad = Euler::ToRadian(yaw_deg);
     38  Printf("Starting VRPN server on port %i\n",port);
    3839}
    3940
Note: See TracChangeset for help on using the changeset viewer.