vicon
DriverTest.cpp
Go to the documentation of this file.
1 #include "ViconDriver.hpp"
2 #include <iostream>
3 
4 using namespace std;
5 
6 int main( int argc, char* argv[] )
7 {
8  if( argc < 2 )
9  {
10  std::cout << "usage: DriverTest hostname subject segment" << std::endl;
11  exit(0);
12  }
13 
14  vicon::Driver driver;
15  if( !driver.connect( std::string(argv[1]) ) )
16  {
17  std::cout << "could not connect to host " << argv[1] << std::endl;
18  exit(0);
19  }
20 
21  std::string subject( argv[2] );
22  std::string segment( argv[3] );
23 
24  while(driver.getFrame())
25  {
26  bool is_there;
27  std::cout << "got frame at " << driver.getTimestamp() << std::endl;
28  std::cout << "transform: " << std::endl
29  << driver.getSegmentTransform(subject, segment, is_there).matrix() << std::endl;
30  if ( !is_there ) std::cout << "object is occluded!" << std::endl;
31  }
32 }
Eigen::Affine3d getSegmentTransform(const std::string &subjectName, const std::string &segmentName, bool &inFrame)
bool connect(const std::string &hostname, const unsigned int port=801)
Definition: ViconDriver.cpp:53
bool getFrame(const base::Time &timeout=base::Time::fromSeconds(1.0))
Definition: ViconDriver.cpp:93
base::Time getTimestamp()
int main(int argc, char *argv[])
Definition: DriverTest.cpp:6