Changeset 157 in flair-src for trunk/lib/FlairCore/src


Ignore:
Timestamp:
Mar 4, 2017, 3:29:18 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

iadded isready to iodevice:
avoid problem of imu not ready in ardrone2

Location:
trunk/lib/FlairCore/src
Files:
2 added
6 edited

Legend:

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

    r15 r157  
    113113    rot2 = yaw - angle;
    114114  }
    115   if (rot2 < rot1)
    116     rot1 = -rot2;
     115 
     116  if (rot2 < rot1) rot1 = -rot2;
     117 
    117118  rot1 = -rot1; // pour avoir rot1=yaw-angle
    118119
  • trunk/lib/FlairCore/src/IODevice.cpp

    r121 r157  
    6464DataType const &IODevice::GetOutputDataType() const { return dummyType; }
    6565
     66void IODevice::SetIsReady(bool status) {
     67  pimpl_->SetIsReady(status);
     68}
     69
     70bool IODevice::IsReady(void) const {
     71  return pimpl_->IsReady();
     72}
     73
    6674} // end namespace core
    6775} // end namespace flair
  • trunk/lib/FlairCore/src/IODevice.h

    r121 r157  
    110110  */
    111111  void OutputToShMem(bool enabled);
     112 
     113  /*!
     114  * \brief is device ready
     115  *
     116  * Use it check if a device is ready or not.
     117  * See also setIsReady.
     118  *
     119  * \return true if device is ready
     120  */
     121  bool IsReady(void) const;
    112122
    113123  // TODO: these 2 method should be pure virtual
     
    115125  virtual DataType const &GetOutputDataType() const;
    116126
    117         protected:
    118             /*!
    119             * \brief Process the childs of type IODevice, and log if needed
    120             *
    121             * This method must be called after computing datas;
    122             * generally at the end of the reimplemented UpdateFrom or after acquiring datas in case of a sensor. \n
    123             * It will call UpdateFrom methods of each child of type IODevice,
    124             * and log all datas (this IODevice and its childs)
    125             * if logging is enabled (see SetDataToLog(), AddDeviceToLog(),
    126             * FrameworkManager::StartLog and FrameworkManager::AddDeviceToLog). \n
    127             * If a thread is waiting on this IODevice (see Thread::WaitUpdate), it will be resumed.
    128             *
    129             * \param data data to process
    130             */
    131             void ProcessUpdate(io_data* data);
     127  protected:
     128    /*!
     129    * \brief Process the childs of type IODevice, and log if needed
     130    *
     131    * This method must be called after computing datas;
     132    * generally at the end of the reimplemented UpdateFrom or after acquiring datas in case of a sensor. \n
     133    * It will call UpdateFrom methods of each child of type IODevice,
     134    * and log all datas (this IODevice and its childs)
     135    * if logging is enabled (see SetDataToLog(), AddDeviceToLog(),
     136    * FrameworkManager::StartLog and FrameworkManager::AddDeviceToLog). \n
     137    * If a thread is waiting on this IODevice (see Thread::WaitUpdate), it will be resumed.
     138    *
     139    * \param data data to process
     140    */
     141    void ProcessUpdate(io_data* data);
     142   
     143    /*!
     144    * \brief set is ready
     145    *
     146    * Sets if the device is ready or not. By default the IODevice is not ready.\n
     147    * See also isReady.
     148    *
     149    * \param status status
     150    */
     151    void SetIsReady(bool status);
    132152
    133153private:
  • trunk/lib/FlairCore/src/IODevice_impl.cpp

    r122 r157  
    3939  tobelogged = false;
    4040  outputtoshm = false;
     41  isReady=false;
    4142}
    4243
     
    233234  return status;
    234235}
     236
     237void IODevice_impl::SetIsReady(bool status) {
     238  isReady=status;
     239}
     240
     241bool IODevice_impl::IsReady(void) const {
     242  return isReady;
     243}
  • trunk/lib/FlairCore/src/ui_com.cpp

    r133 r157  
    278278      if (offset != 3) {
    279279        memcpy(&send_buffer[1], &resume_period, sizeof(uint16_t));
    280         // printf("send %i %i %i %x
    281         // %x\n",resume_period,offset,sizeof(uint16_t),send_buffer,&send_buffer[1]);
     280        // printf("send %i %i %i %x %x\n",resume_period,offset,sizeof(uint16_t),send_buffer,&send_buffer[1]);
    282281        // for(int i=0;i<offset;i++) printf("%x ",send_buffer[i]);
    283282        // printf("\n");
     
    292291      }
    293292      send_mutex->ReleaseMutex();
    294       // Printf("%i %lld\n",resume_period,GetTime()/1000000);
     293      //Printf("%i %lld\n",resume_period,GetTime()/1000000);
    295294    } else {
    296295      send_mutex->ReleaseMutex();
    297296      // rien a faire, suspend
    298       // Printf("rien a faire suspend\n");
     297      //Printf("rien a faire suspend\n");
    299298      Suspend();
    300       // Printf("wake\n");
     299      //Printf("wake\n");
    301300      // on planifie la prochaine execution
    302301      Time time = GetTime();
  • trunk/lib/FlairCore/src/unexported/IODevice_impl.h

    r122 r157  
    4747  void WriteToShMem(void);
    4848  void PrintLogsDescriptors(void);
     49  void SetIsReady(bool status);
     50  bool IsReady(void) const;
    4951
    5052private:
     
    5961  bool outputtoshm;
    6062  flair::core::SharedMem *shmem;
     63  bool isReady;
    6164};
    6265
Note: See TracChangeset for help on using the changeset viewer.