openrave.org

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
orshowsensors.cpp
Go to the documentation of this file.
1 
14 #include <openrave-core.h>
15 #include <vector>
16 
17 #include "orexample.h"
18 
19 using namespace OpenRAVE;
20 using namespace std;
21 
22 namespace cppexamples {
23 
25 {
26 public:
27  virtual void demothread(int argc, char ** argv) {
28  penv->Load("data/testwamcamera.env.xml");
29  size_t ienablesensor = 0;
30  // get all the sensors, this includes all attached robot sensors
31  std::vector<SensorBasePtr> sensors;
32  penv->GetSensors(sensors);
33  while(IsOk()) {
34  for(size_t isensor = 0; isensor < sensors.size(); ++isensor) {
35  sensors[isensor]->Configure(isensor == ienablesensor ? SensorBase::CC_PowerOn : SensorBase::CC_PowerOff);
36  sensors[isensor]->Configure(isensor == ienablesensor ? SensorBase::CC_RenderDataOn : SensorBase::CC_RenderDataOff);
37  }
38  ienablesensor = (ienablesensor+1)%sensors.size();
39  boost::this_thread::sleep(boost::posix_time::seconds(5));
40  }
41  }
42 };
43 
44 } // end namespace cppexamples
45 
46 int main(int argc, char ** argv)
47 {
49  return example.main(argc,argv);
50 }