kinect受信用ライブラリ

kinectRX.cpp

Committer:
skouki
Date:
2018-08-28
Revision:
0:cb6fcdae7ecf

File content as of revision 0:cb6fcdae7ecf:

#include "kinectRX.h"
KinectRX::KinectRX():
    fep(FEP_TX,FEP_RX,FEP_NUM)
{
}


void KinectRX::receive_data(){
  len = 5;
  while(true){
    count ++;
    temp = fep.read(data,len);
    if(temp == 0) {
      count = 0;
      break;
    }
    if(count > 10){
        count = 0;
        break;
    }    
  }
}

int KinectRX::get_mode(){
  return(data[4]);
}

int KinectRX::get_distance(){
  return(data[0] * 1000 + data[1] * 100 + data[2] * 10 + data[3]);
}