8 #include "PlusConfigure.h" 14 #include <vtkMatrix4x4.h> 15 #include <vtksys/CommandLineArguments.hxx> 21 int main(
int argc,
char** argv)
23 double frameRate = 60;
24 bool printHelp(
false);
26 vtksys::CommandLineArguments args;
27 args.Initialize(argc, argv);
29 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
31 args.AddArgument(
"--frame-rate", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &frameRate,
"Requested acquisition frame rate (in FPS, default = 30)");
32 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
33 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
37 std::cerr <<
"Problem parsing arguments" << std::endl;
38 std::cout << std::endl << std::endl <<
"vtkLeapMotionTest1 help:" << args.GetHelp() << std::endl;
46 std::cout << std::endl << std::endl <<
"vtkLeapMotionTest1 help:" << args.GetHelp() << std::endl;
51 vtkNew<vtkPlusLeapMotion> leapMotion;
52 leapMotion->SetDeviceId(
"LeapMotionDevice");
53 leapMotion->SetToolReferenceFrameName(
"Tracker");
55 vtkNew<vtkPlusDataSource>
source;
56 source->SetId(
"LeftIndexDistal");
59 channel->SetChannelId(
"TrackerChannel");
61 leapMotion->AddTool(
source);
62 leapMotion->AddOutputChannel(
channel);
66 LOG_ERROR(
"Unable to connect to device");
72 LOG_ERROR(
"Unable to start recording");
76 std::this_thread::sleep_for(std::chrono::milliseconds(100));
78 igsioTrackedFrame frame;
81 LOG_ERROR(
"Unable to retrieve frame from channel.");
85 vtkNew<vtkMatrix4x4> mat;
86 if (frame.GetFrameTransform(igsioTransformName(
"LeftIndexDistal",
"Tracker"), mat) !=
PLUS_SUCCESS)
88 LOG_ERROR(
"Unable to retrieve left index distal transform.");
94 LOG_ERROR(
"Unable to stop recording.");
100 LOG_ERROR(
"Unable to disconnect");
int main(int argc, char **argv)
static vtkIGSIOLogger * Instance()