Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <termios.h>
  4. #include <ros/ros.h>
  5.  
  6. using namespace std;
  7.  
  8. int getch()
  9. {
  10. static struct termios oldt, newt;
  11. tcgetattr( STDIN_FILENO, &oldt); // save old settings
  12. newt = oldt;
  13. newt.c_lflag &= ~(ICANON); // disable buffering
  14. tcsetattr( STDIN_FILENO, TCSANOW, &newt); // apply new settings
  15.  
  16. int c = getchar(); // read character (non-blocking)
  17.  
  18. tcsetattr( STDIN_FILENO, TCSANOW, &oldt); // restore old settings
  19. return c;
  20. }
  21.  
  22.  
  23. int main(int argc, char** argv)
  24. {
  25. fstream plik;
  26. plik.open( "../catkin_aruco/src/aruco_test/dane.txt", ios::in );
  27. if( plik.good() )
  28. {
  29. string x,y,z,yaw,time;
  30. float x1,y1,z1,yaw1;
  31. unsigned int time1;
  32. while( !plik.eof() )
  33. {
  34. getline(plik,x,',');
  35. getline(plik,y,',');
  36. getline(plik,z,',');
  37. getline(plik,yaw,',');
  38. getline(plik,time,'\n');
  39. x1=stof(x);
  40. y1=stof(y);
  41. z1=stof(z);
  42. yaw1=stof(yaw);
  43. time1=stoi(time);
  44. cout<<x1<<" "<<y1<<" "<<z1<< " "<<yaw1<<" "<<time1<<endl;
  45. sleep(time1);
  46. }
  47.  
  48. plik.close();
  49. } else cout << "Error! Nie udalo otworzyc sie pliku!" << endl;
  50.  
  51. getch();
  52. return( 0 );
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement