本文整理汇总了C++中Spatial::getAcceleration方法的典型用法代码示例。如果您正苦于以下问题:C++ Spatial::getAcceleration方法的具体用法?C++ Spatial::getAcceleration怎么用?C++ Spatial::getAcceleration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spatial
的用法示例。
在下文中一共展示了Spatial::getAcceleration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Compass testCompass;
InterfaceKit ifKit;
LCD lcd;
Motor motor;
Spatial spatial;
CPhidgetManagerHandle device = 0;
LocalErrorCatcher(
CPhidgetManager_create(&device));
LocalErrorCatcher(
CPhidgetManager_set_OnAttach_Handler((CPhidgetManagerHandle) device,
AttachHandler, NULL));
LocalErrorCatcher(
CPhidgetManager_set_OnDetach_Handler((CPhidgetManagerHandle ) device,
DetachHandler, NULL));
LocalErrorCatcher(
CPhidgetManager_set_OnError_Handler((CPhidgetManagerHandle) device,
LibraryErrorHandler, NULL));
printf("Starting Phidget Playground...\n");
// Most opening and closing would be via a cast to
// (CPhidgetHandle), however, this manager has its
// own handle struct to cast to.
LocalErrorCatcher(
CPhidgetManager_open((CPhidgetManagerHandle) device));
std::stringstream ss;
lcd.clear();
for(int i=0;i<1000;i++){
testCompass.refresh();
ss << std::fixed << std::setprecision(1) << "Heading: " << testCompass.getHeading();
lcd.setText(ss.str(), 0);
ss.str(std::string());
ss << std::fixed << std::setprecision(2) << spatial.getAcceleration(AXIS_X) << " " << spatial.getAcceleration(AXIS_Y) << " " << spatial.getAcceleration(AXIS_Z);
lcd.setText(ss.str(), 1);
ss.str(std::string());
usleep(100000);
}
printf("Press Enter to end...\n");
getchar();
LocalErrorCatcher(
CPhidgetManager_close((CPhidgetManagerHandle) device));
LocalErrorCatcher(
CPhidgetManager_delete((CPhidgetManagerHandle) device));
return 0;
}