SRI-FTSensor-SDK
- Tech Stack: C++
- Github URL: Project Link
Introduction
SRI FTSensor SDK is a cross-platform C++ wrapper of the FT Sensor made by Sunrise Instruments.
Dependencies
The SRI FTSensor SDK is a header-only library. But it depends on some Boost Libs.
- Boost.Asio Provide tcp, serial-port communication.
And also utilize some Boost header-only library, such as lexical_cast,
format and string_algo.
If you are using Linux-like system (e.g. Ubuntu), Boost can be easily installed by package manager:
$ sudo apt install boost-all-dev
Compile
You can just put all the header file(in the include directory) into your own
project, and compile it. In the root directory, there has an example to show how to use this
SDK. After installing the Boost library, you can just type the following command:
$ git clone https://github.com/thinkexist1989/SRI-FTSensor-SDK.git
$ cd SRI-FTSensor-SDK/
$ mkdir build && cd build
$ cmake ..
$ make -j`nproc`
$ ./test #Run the example
Usage
-
Include the header files in your main.cpp
#include <sri/ftsensor.hpp> #include <sri/commethernet.hpp> // connection to the tcp-type FTSensor #include <iostream> int main() { ... } -
Initialize the communication to FTSensor(I has a tcp-type sensor with ip 192.168.1.108)
SRI::CommEthernet* ce = new SRI::CommEthernet("192.168.1.108", 4008); -
Initialize the Sensor with communication
SRI::FTSensor sensor(ce); -
Get or set some parameters
IpAddr ip = sensor.getIpAddress(); -
Get real-time data from sensor
auto rtData = sensor.getRealTimeDataOnce<float>(rtMode,rtDataValid);