44 #include <visp3/core/vpConfig.h> 46 #if defined( VISP_HAVE_OCCIPITAL_STRUCTURE ) && ( VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11 ) 48 #include <visp3/gui/vpPlot.h> 49 #include <visp3/sensor/vpOccipitalStructure.h> 56 double initial_ts, ts;
60 ST::CaptureSessionSettings settings;
61 settings.source = ST::CaptureSessionSourceId::StructureCore;
62 settings.structureCore.depthEnabled =
true;
63 settings.structureCore.visibleEnabled =
true;
64 settings.structureCore.accelerometerEnabled =
true;
65 settings.structureCore.gyroscopeEnabled =
true;
66 settings.structureCore.imuUpdateRate = ST::StructureCoreIMUUpdateRate::AccelAndGyro_1000Hz;
71 vpPlot acceleration_plotter( 1, 400, 800, 10, 10,
"Accelerations" );
72 vpPlot rotationRate_plotter( 1, 400, 800, 10, 450,
"Rotation rates" );
73 acceleration_plotter.initGraph( 0, 3 );
74 rotationRate_plotter.initGraph( 0, 3 );
83 acceleration_plotter.plot( 0, 0, 0, 0 );
84 acceleration_plotter.plot( 0, 1, 0, 0 );
85 acceleration_plotter.plot( 0, 2, 0, 0 );
86 rotationRate_plotter.plot( 0, 0, 0, 0 );
87 rotationRate_plotter.plot( 0, 1, 0, 0 );
88 rotationRate_plotter.plot( 0, 2, 0, 0 );
90 acceleration_plotter.setLegend( 0, 0,
"X axis" );
91 acceleration_plotter.setLegend( 0, 1,
"Y axis" );
92 acceleration_plotter.setLegend( 0, 2,
"Z axis" );
93 rotationRate_plotter.setLegend( 0, 0,
"X axis" );
94 rotationRate_plotter.setLegend( 0, 1,
"Y axis" );
95 rotationRate_plotter.setLegend( 0, 2,
"Z axis" );
97 sc.
getIMUData( &imu_vel, &imu_acc, &initial_ts );
104 acceleration_plotter.plot( 0, ts - initial_ts, imu_acc );
105 rotationRate_plotter.plot( 0, ts - initial_ts, imu_vel );
115 std::cerr <<
"Structure SDK error " << e.
what() << std::endl;
117 catch (
const std::exception &e )
119 std::cerr << e.what() << std::endl;
128 #if !defined( VISP_HAVE_OCCIPITAL_STRUCTURE ) 129 std::cout <<
"You do not have Occipital Structure SDK functionality enabled..." << std::endl;
130 std::cout <<
"Tip:" << std::endl;
131 std::cout <<
"- Install libStructure, configure again ViSP using cmake and build again this example" << std::endl;
133 #elif ( VISP_CXX_STANDARD < VISP_CXX_STANDARD_11 ) 134 std::cout <<
"You do not build ViSP with c++11 or higher compiler flag" << std::endl;
135 std::cout <<
"Tip:" << std::endl;
136 std::cout <<
"- Configure ViSP again using cmake -DUSE_CXX_STANDARD=11, and build again this example" << std::endl;
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
void getIMUData(vpColVector *imu_vel, vpColVector *imu_acc, double *ts=NULL)
error that can be emited by ViSP classes.
bool open(const ST::CaptureSessionSettings &settings)
static const vpColor green
const char * what() const
Implementation of column vector and the associated operations.
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
static const vpColor blue