Skip to content

Latest commit

 

History

History
74 lines (51 loc) · 2.01 KB

File metadata and controls

74 lines (51 loc) · 2.01 KB

Motion SDK C++ Example

Stream measurement and motion data from the Shadow. Print out the data in CSV format.

Each sample in time is one row. Each column is one channel from one device or joint in the Shadow skeleton.

Build the example

Windows

Open the folder in Visual Studio or VS Code, and build the Cmake project.

macOS and Linux

Use Cmake to build:

mkdir build
cd build
cmake ..
cmake --build .

Run the example

By default, the example application will read as many samples as possible and print them to the standard output. The samples are printed as they arrive, every ~10 milliseconds.

Usage: example [options...]

Allowed options:
  --help           show help message
  --file arg       output file
  --frames N       read N frames
  --header         show channel names in the first row
  --accel-range N  set accelerometer full scale range to N (g). Valid values [2, 8]
  --rate N         set sampling rate to N (Hz). Valid values: [100, 200, 400, 500, 1000]

Example usage:

  1. Output the stream to a csv file which you can open in spreadsheet editor (Openoffice, Libreoffice, Excel). Include a header on the first line of the csv file. The file is specified relative to the current working directory, or can be specified as a full path relative:
example --header --file ./streamed_data.csv
  1. Output the stream to the terminal, and include the header showing channel names
example --header
  1. Specify the accelerometer sensitivity. Select ±8g:
example --accel-range 8
  1. Specify the sampling rate. Select 1000 Hz:
example --rate 1000
  1. Motion SDK uses TCP/IP sockets, so it is easy to stream over the network as shown in this example. By default, the script connects to the MotionNode service running on localhost (127.0.0.1). If you want to connect to the MotionNode service on a different host, you can specify its IP address. For example, for a host with ip address 192.168.1.100:
example --host 192.168.1.100