html: toc: true # number_sections: true toc_depth: 6 toc_float: true collapsed: true smooth_scroll: true ---
← C/C++ ← Xvisio SDK Documentation Home Page
"demo_api" provides the use of numeric characters to select the execution function to demonstrate the basic functions of the Xvisio device and the corresponding SDK API, as well as the sample code corresponding to the execution function.
cp -r /usr/share/xvsdk/demo-api <path_to_work>
cp -r /usr/share/xvsdk/pipe_srv <path_to_work>
cd <path_to_work>/demo-api
mkdir build
cd build
cmake ..
make
A successful build will generate an executable binary named 'demo-api'.Connect the xvisio device and the Ubunut host with a USB cable.
To view the USB device status, open a terminal anywhere and type:
lsusb
Observe the terminal output usb status information where VID:PID is "040e:f408", and the USB device whose device name is "MCCI XVisio vSLAM" is the Xvisio device.
Confirm that the current device enumeration is USB3.0 or USB2.0 by the USB Bus number of the Xvisio device and the corresponding BUS HUB type.
Please ensure proper enumeration of Xvisio device
The above description is shown in the following figure:
Start terminal and navigate to the "<path_to_work>/demo-api/build/" directory and execute:
./demo-api
Before doing this step, you need to make sure that the program has been successfully built and 'demo-api' has been generated.
Start another terminal in the same location and execute:
./pipe_srv
pipe_srv and demo-api must be started in the same directory.
After the startup is successful, the terminal will output the function menu print, as follows:
pipe server recv has already exist
pipe server send has already exist
wait for client connect....
pipe server get send handle: 3
pipe server get recv handle: 4
ready handle: send:3,recv:4
Demo
------------------------------
1 : Init SDK and get IMU
2 : Stop get IMU, start slam, get 6dof
....
0 : exit program
------------------------------
enter select:
Menu function Type the corresponding numeric character on the terminal of pipe-srv and press Enter to execute the corresponding function, and observe the output of the demo-api terminal. Function Menu Description
Version | cmake command |
---|---|
VS2019 64 bits | cmake -G "Visual Studio 16 2019" -A x64 |
VS2019 32 bits | cmake -G "Visual Studio 16 2019" -A Win32 |
VS2017 64 bits | cmake -G "Visual Studio 15 2017" -A x64 |
VS2017 32 bits | cmake -G "Visual Studio 15 2017" -A Win32 |
./demo-api.exe
Notice:
unzip android-ndk-r21e-linux-x86_64.zip
sudo gedit ~/.bashrc
add at the end of the file.
export ANDROID_NDK_ROOT=/path_from_yours/android-ndk-r21e/
export NDK=${ANDROID_NDK_ROOT}
export PATH=${PATH}:$NDK
Where "/path_from_yours/android-ndk-r21e/" is replaced with the absolute path of NDK decompression.
sourc ~/.bashrc
ndk-build -v
The version information is correct and no errors are reported.cd android/jni/
ndk-build
All the examples in "Android.mk" can be compiled.
The compilation is successful without error. The arm64-v8a in the android/libs/ directory will generate an executable binary file.adb root
adb remount
If remount fails,excute:
adb disable-verity
adb reboot
adb root
adb remount
If it still fails, please contact the Android device vendor for support
arm64 example:
adb push arm64-v8a /data/test/
arm32 example:
adb push armeavi-v7a /data/test/
adb shell
cd /data/test/arm64-v8a/
LD_LIBRARY_PATH=./ ./demo-api
adb shell
cd /data/test/arm64-v8a/
LD_LIBRARY_PATH=./ ./pipe_srv
pipe server recv has already exist
pipe server send has already exist
wait for client connect....
pipe server get send handle: 3
pipe server get recv handle: 4
ready handle: send:3,recv:4
Demo
------------------------------
1 : Init SDK and get IMU
2 : Stop get IMU, start slam, get 6dof
....
0 : exit program
------------------------------
enter select:
Platform | Path |
---|---|
Windows | The samples\demo-api directory in the installation directory, for example: C:\Program Files\xvsdk\samples\demo-api\ |
Linux/Ubuntu | /usr/share/xvsdk/demo-api/ |
Android | examples/demo-api/ in the unzipped folder of Android SDK |
File | Description |
---|---|
demo-api.cpp | demo-api core file |
fps_count.hpp | The file that implements the class that calculates the frame rate |
pipe_srv.h | Pipeline function file (not supported on Windows) |
CMakeLists.txt | Cmake project file (not supported on Android) |
The function “main(....)” of “demo-api.cpp” is the entry function:
int main( int argc, char* argv[] ) try{....}
"meun_main[]" is the preset function menu:
static const char meun_main[] = { ....}
"while" loop to wait for input character command parsing.
while (cond) {
The Windows platform does not use pipes. By entering the character 'm' to stop an already running function and output the menu.
#ifdef _WIN32 std::cin >> cCmd; if (cCmd == "m") { if (device) { //stop all running items if (device->display()) { device->display()->close(); } if (device->orientationStream()) { //device->orientationStream()->stop(); device->orientationStream()->unregisterCallback(imuId); } ....
Non-Windows platforms wait for piped commands:
#else cmd = requestCmdAllPlatform(meun_main, sizeof(meun_main)); #endif
Parse command:
switch (cmd) { case 1: { .... } break; case 3: case 22: case 28: case 36: ....
The function menu corresponding to the serial number is executed in each case, and the description of the menu function is shown in Section 4.
Serial Number | Function | Describe | Remark | Keywords |
---|---|---|---|---|
1 | Init SDK and get IMU | Initialize SDK and device and then start getting IMU data stream | The first thing to do after starting the demo-api program is to check the SDK version, Xvisio device version and other initial information. | INIT |
2 | Stop get IMU, start slam, get 6dof | Stop getting the IMU and then start the SLAM process to get the 6dof data stream | Use as a test to verify SLAM functionality | SLAM |
3 | Stop slam, stop get 6dof, get IMU | Stop getting 6dof and stop SLAM process and then restart get IMU stream | Use as a test to verify SLAM functionality | SLAM |
4 | Get eyetracking data, stop get IMU | Stop getting the IMU and then start the Eye tracking process to get the eye tracking camera image stream | Used as a test to verify ET (Eye Tracking) functionality | ET (Eye Tracking) |
5 | Stop get eyetracking data, get IMU | Stop the Eye tracking process and then restart to get the IMU data stream | Used as a test to verify ET (Eye Tracking) functionality | ET(Eye Tracking) |
9 | Stop get IMU, get rgb data | Stop getting imu and start rgb process to get rgb data | Used to test rgb data process | RGB |
10 | Stop rgb, get IMU | Stop getting rgb data and restart IMU process | Used to test rgb data process | RGB |
11 | Stop get IMU, get tof data | Stop getting imu and start tof process to get tof data | Used to test tof data process | TOF |
12 | Stop tof, get IMU | Stop getting tof data and restart IMU process | Used to test tof data process | TOF |
13 | Start tof plane detection, start slam, stop get IMU, get 6dof | Stop getting imu and start tof plane detection process to get tof plane data, then start slam, get 6dof data | Used to test tof plane detection data | TOF plane detection |
14 | Stop tof plane detection, stop slam, get IMU | Stop getting tof plane detection process and stop slam, restart getting imu data | Used to test tof plane detection data | TOF plane detection |
15 | Stop get IMU, switch to edge mode, get edge 6dof | Stop getting imu and start slam with edge mode, get 6dof data | Used to test edge mode slam data | edge slam |
16 | Stop get edge 6dof, get IMU | Stop getting edge mode slam data, restart getting imu | Used to test edge mode slam data | edge slam |
17 | Test display: open display,set brightness to 2,set brightness to 9 | Open display setting, set brightness to 2, then set brightness to 9 | Used to test display brightness setting | display |
18 | Test display: close display | Close display setting | Used to test display brightness setting | display |
19 | Stop get IMU, start slam, get 6dof | Stop getting imu and start slam with mixed mode, get 6dof data | Used to test mixed mode slam data | SLAM |
20 | Save shared map | Create shared map and save into bin file | Used to test cslam mode | cslam |
21 | Stop slam, start CSLAM using shared map, start slam | Stop getting imu and start cslam mode with shared map file, start slam to get 6dof data | Used to test cslam mode | cslam |
22 | Stop slam, get IMU | Stop getting slam data and restart getting imu | Used to test slam | slam |
23 | Start stereo plane detection, start slam, stop get IMU, get 6dof | Stop getting imu and start fisheye plane detection process to get fisheye plane data, then start slam, get 6dof data | Used to test fisheye plane detection data | fisheye plane detection |
24 | Stop stereo plane detection, stop slam, get IMU | Stop getting fisheye plane detection process and stop slam, restart getting imu data | Used to test fisheye plane detection data | fisheye plane detection |
25 | Stop get IMU, switch to EdgeFusionOnHost mode, get 6dof with callback | Stop getting imu and start slam with miEdgeFusionOnHostxed mode, get 6dof data | Used to test EdgeFusionOnHost mode slam data | EdgeFusionOnHost slam |
26 | Stop get IMU, switch to EdgeFusionOnHost mode, get 6dof with get-pose | Stop getting EdgeFusionOnHost mode slam data and restart getting imu | Used to test EdgeFusionOnHost mode slam | EdgeFusionOnHost slam |
27 | Stop get IMU, switch to EdgeFusionOnHost mode, get 6dof with get-pose | Stop getting imu and start slam with miEdgeFusionOnHostxed mode, get 6dof data with get-pose method | Used to test EdgeFusionOnHost mode slam data with get-pose method | EdgeFusionOnHost get-pose |
28 | Stop get 6dof with get-pose, stop EdgeFusionOnHost slam, get IMU | Stop getting EdgeFusionOnHost mode slam data and restart getting imu | Used to test EdgeFusionOnHost mode slam data with get-pose method | EdgeFusionOnHost get-pose |
29 | Call 3Dof get() | Stop getting imu and get 3dof data with get method | Used to test 3dof data with get method | 3dof get |
30 | Stop call 3Dof get(), get IMU | Stop getting 3dof data with get method and restart getting imu | Used to test 3dof data with get method | 3dof get |
31 | Call 3Dof getAt() | Stop getting imu and get 3dof data with getAt method | Used to test 3dof data with getAt method | 3dof getAt |
32 | Stop call 3Dof getAt(), get IMU | Stop getting imu and get 3dof data with getAt method | Used to test 3dof data with getAt method | 3dof getAt |
33 | Stop get IMU, switch to mixed mode, get 6dof with callback | Stop getting imu and start slam with mixed mode, get 6dof data with callback method | Used to test mixed mode slam data with callback method | mixed slam callback |
34 | Stop get 6dof with callback, stop mix slam, get IMU | Stop getting mixed mode slam data and restart getting imu | Used to test mixed mode slam data with callback method | mixed slam callback |
35 | Stop get IMU, switch to mixed mode, get 6dof with get-pos-at | Stop getting imu and start slam with mixed mode, get 6dof data with get-pos-at method | Used to test mixed mode slam data with get-pos-at method | mixed slam get-pos-at |
36 | Stop get 6dof with get-pos-at, stop mix slam, get IMU | Stop getting mixed mode slam data and restart getting imu | Used to test mixed mode slam data with get-pos-at method | mixed slam get-pos-at |
37 | Stop get IMU, read rgb calibration | Stop getting imu and get rgb calibration data | Used to test rgb calibration data | RGB Calibration |
38 | Stop get IMU, set rgb resolution | Stop getting imu and set rgb resolution | Used to test rgb resolution setting | RGB Resolution |
39 | Stop get rgb data, get IMU | Stop getting rgb data and restart getting imu data | Used to test rgb camera data | RGB |
40 | Stop get IMU, set rbg format | Stop getting imu and set rgb format | Used to test rgb format seeting | RGB format |
41 | Stop get IMU, set rbg exposure mode, white balance control, ISO level, EXP level | Stop getting imu and set rgb exposure mode, white balance control ISO level and EXP level | Used to test rgb camera setting | RGB |
42 | Stop get IMU, set eyetracking exposure, gain | Stop getting imu and set eyetracking exposure and gain data | Used to test eyetracking setting | ET |
43 | Stop get IMU, set eyetracking led control | Stop getting imu and set eyetracking led control | Used to test eyetracking led control setting | ET |
44 | Stop get IMU, read fisheye calibration | Stop getting imu and read fisheye calibration | Used to test fisheye calibration | fisheye calibration |
45 | Stop get IMU, read TOF calibration | Stop getting imu and read TOF calibration | Used to test TOF calibration | TOF calibration |
47 | Stop get IMU, set TOF stream mode | Stop getting imu and set TOF stream mode | Used to test TOF stream mode setting | TOF mode |
47 | Stop get IMU, set TOF distance mode | Stop getting imu and set TOF distance mode | Used to test TOF distance mode setting | TOF Distance |
48 | Stop get IMU, set event data | Stop getting imu and register event callback to get event data | Used to test event callback data | event |
49 | Stop get IMU, set CNN data | Stop getting imu and register CNN callback to get CNN data | Used to test CNN callback data | CNN |
50 | Stop get IMU, get gesture stream data | Stop getting imu and register gesture callback, get gesture stream data | Used to test gesture stream data | gesture |
51 | Stop get gesture stream data, get IMU | Stop getting gesture stream and restart getting imu | Used to test gesture stream data | gesture |
52 | Stop get IMU, get dynamic gesture stream data | Stop getting imu and register dynamic gesture callback, get dynamic gesture stream data | Used to test dynamic gesture stream data | dynamic gesture stream |
53 | Stop get dynamic gesture stream data, get IMU | Stop getting dynamic gesture stream and restart getting imu | Used to test dynamic gesture stream data | dynamic gesture stream |
54 | Stop get IMU, get gesture keypoints | Stop getting imu and register gesture keypoints callback, get gesture keypoints data | Used to test gesture keypoints data | gesture keypoints |
55 | Stop get gesture keypoints, get IMU | Stop getting gesture keypoints and restart getting imu | Used to test gesture keypoints data | gesture keypoints |
56 | Stop get IMU, get gesture keypoints based on slam | Stop getting imu and register gesture keypoints callback, get gesture keypoints data with slam | Used to test gesture keypoints data with slam | gesture slam keypoints |
57 | Stop get gesture keypoints based on slam, get IMU | Stop getting gesture keypoints with slam and restart getting imu | Used to test gesture keypoints data with slam | gesture slam keypoints |
58 | Set gesture configuration file path | Stop getting imu data and set gesture configuration file path | Used to test gesture configuration file path setting | gesture path |
59 | Get display calibration | Stop getting imu and get display calibration data | Used to test display calibration data | display calibration |
60 | Camera on/off switch | Configure fisheye, rgb and tof camera switch | Used to test camera switch | camera switch |
61 | Start april tag detection | Stop getting imu and start april-tag detection, get april-tag data | Used test april-tag data | April-tag |
62 | Stop april tag detection, get IMU | Stop getting april-tag detection and restart getting imu | Used test april-tag data | April-tag |
63 | Start surface callback | Stop getting imu and start surface callback, get surface callback data | Used to test surface data | surface |
64 | Stop surface callback, get IMU | Stop getting surface callback data and restart getting imu | Used to test surface data | surface |
65 | Start event callback | Stop getting imu and start event callback, get event callback data | Used to test event data | event |
66 | Stop event callback, get IMU | Stop getting event callback data and restart getting imu | Used to test event data | event |
67 | Stop get IMU, start SGBM | Stop getting imu and start SGBM callback, get SGBM callback data | Used to test SGBM data | SGBM |
68 | Stop SGBM, get IMU | Stop getting SGBM callback data and restart getting imu | Used to test SGBM data | SGBM |
69 | Stop get IMU, start get gaze data | Stop getting imu and start gaze callback, get gaze callback data | Used to test gaze data | GAZE |
77 | Start get device status data | Stop getting imu and start device status callback, get device status callback data | Used to test device status data | device status |
78 | Stop get device status data | Stop getting device status callback data and restart getting imu | Used to test device status data | device status |
79 | Stop get IMU, switch the fisheye resolution to HIGH | Stop getting imu and switch fisheye resolution to HIGH | Used to test 80 resolution setting | fisheye resolution mode |
80 | Stop get IMU, switch the fisheye resolution to MEDIUM | Stop getting imu and switch fisheye resolution to MEDIUM | Used to test fisheye resolution setting | fisheye resolution mode |
81 | Stop get fisheye data, get IMU | Stop getting fisheye data and restart getting imu | Used to test fisheye data | fisheye |
82 | Start RGBD | Stop getting imu and start RGBD callback, get RGBD callback data | Used to test RGBD data | RGBD |
83 | Stop RGBD, get IMU | Stop getting RGBD callback data and restart getting imu | Used to test RGBD data | RGBD |
84 | Change FE framerate into 50Hz | Stop getting imu and set fisheye framerate to 50Hz | Used to test fisheye framerate setting | fisheye framerate |
85 | Change FE framerate into 60Hz | Stop getting imu and set fisheye framerate to 60Hz | Used to test fisheye framerate setting | fisheye framerate |
86 | Change RGB to AF/MF mode | swith rgb auto/manual focus mode | test for rgb focus mode | rgb mode |
87 | Change RGB local distance | change rgb local distance | test for rgb local distance | rgb mode |
88 | Start get device status data with SLAM | start device status callback data with slam | test for device status | device status |
89 | Stop get device status data and SLAM | stop device status callback data with slam | test for device status | |
90 | Start get device status data without IMU | start device status callback data without imu | test for device status | device status |
99 | Enable/Disable output log | enable/disable log data output | test for log output | log mode |
100 | Start gps callback | start gps callback data | test for gps feature | gps data |
101 | Stop gps callback | stop gps callback data | test for gps feature | gps data |
102 | Start gps distance callback | start gps distance callback data | test for gps feature | gps data |
103 | Stop gps distance callback | stop gps distance callback data | test for gps feature | gps data |
104 | Start fe dewarp callback | start fisheye dewarp callback data | test for fisheye dewarp feature | fisheye dewarp |
105 | Stop fe dewarp callback | stop fisheye dewarp callback data | test for fisheye dewarp feature | fisheye dewarp |
109 | Start STM callback | start terrestrial magnetism data callback | test for terrestrial magnetism feature | stm data |
110 | Stop STM callback | stop terrestrial magnetism data callback | test for terrestrial magnetism feature | stm data |
111 | Get four eye apriltag | get apriltag data for four eyes devices | test for four eyes device apriltag | four eye apriltag |
112 | Get QRcode apriltag | get qrcode mode apriltag data | test for qrcode apriltag | QRCode Apriltag |