Slamtec RPLIDAR User Manual

www .s la m t e c .c o m
Shangh ai Slam te c .Co.,L td
RPLIDAR
Introduction to Standard SDK
2017-05-15 rev.1.0
CONTENTS ................................................................................................................................................... 1
INTRODUCTION ......................................................................................................................................... 3
SDK ORGANIZATION ......................................................................................................................................... 3
BUILD SDK AND DEMO APPLICATIONS ............................................................................................................. 4
CROSS COMPILE ................................................................................................................................................. 6
DEMO APPLICATION ................................................................................................................................ 6
ULTRA_SIMPLE .................................................................................................................................................... 6
SIMPLE_GRABBER ................................................................................................................................................ 8
FRAME_GRABBER ................................................................................................................................................ 9
SDK USAGE AND DEVELOPMENT GUIDE .......................................................................................... 11
ASSUMPTION .................................................................................................................................................... 11
SDK USAGE ...................................................................................................................................................... 11
RUNTIME CONSISTENCY ................................................................................................................................... 11
SDK HEADERS .................................................................................................................................................. 11
SDK INITIALIZATION AND TERMINATION ........................................................................................................ 12
CONNECTING TO AN RPLIDAR ....................................................................................................................... 12
MOTOR START AND STOP CONTROL ............................................................................................................... 13
MEASUREMENT SCAN AND DATA ACQUIRING ................................................................................................ 13
RETRIEVING OTHER INFORMATION OF AN RPLIDAR...................................................................................... 14
THE OPERATIONS RELATED TO THE ACCESSORY BOARD ................................................................................. 15
REVISION HISTORY ................................................................................................................................. 16
APPENDIX .................................................................................................................................................. 17
IMAGE AND TABLE INDEX ................................................................................................................................. 17
Contents
3 / 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
This document introduces the open source RPLIDAR standard SDK. The SDK can be used in Windows, MacOS (10.x) and Linux environment by using Microsoft Visual C++ 2010 and Makefile.
SDK Organization
The RPLIDAR standard SDK organized as bellow:
Figure 1-1 The RPLIDAR standard SDK organization
The workspaces directory contains VS project files for SDK and related demo applications.
The sdk directory contains the external header files(the include folder) of RPLIDAR driver application and the internal implementation code of SDK itself(the src folder).
The app directory contains the related sample code. And SLAMTEC provides the following demo applications in the app directory:
ultra_simple
An ultra-simple command line application demonstrates the simplest way to connect to an RPLIDAR device and continuously fetching the scan data and outputting the data to the console. Users can quickly integrate RPLIDAR to their existing system based on this demo application.
simple_grabber
Introduction
4 / 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
A command line grab application. Each execution will grab two round of laser data and show as histogram.
frame_grabber
A win32 GUI grab application. When pressing start scan button, it will start scan continuously and show the data in the UI.
For SDK after compilation, there will be two more subfolders in the SDK: obj and output. The output folder contains generated SDK static library (.lib or .a) and demo application executable files (exe or elf). obj folder contains intermediate files generated during compilation.
Build SDK and Demo Applications
If you’re developing under Windows, please open VS solution file
sdk_and_demo.sln under workspaces\vc10 or workspaces\vc9. It contains the SDK project and all demo application projects.
Figure 1-2 The RPLIDAR Standard SDK Solution File
5 / 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
Now, you can develop SDK and all the demo applications in VS environment easily. There are two ways of compiling: Debug and Release. And you can choose according to your requirement. Depends on your build configure, the generated binary can be found under output\win32\Release or output\win32\Debug.
If you’re developing under Linux or MacOS, just type “make” under the root of SDK directory to start compiling. It will do Release build by default, and you can also type “make DEBUG=1” to do Debug build. The generated binary can be found under the following folders:
o Linux
o output\Linux\Release o output\Linux\Debug.
o MacOS
o output\Darwin\Release o output\Darwin\Debug.
Figure 1-3 Develop RPLIDAR Standard SDK in Linux
6 / 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
Figure 1-4 Develop RPLIDAR Standard SDK in MacOS
Cross Compile
The SDK build system allows you to generate binaries which run on another platform/system using the cross-compiling feature.
NOTE: this feature only works with Make build system.
The cross compile process can be triggered by invoking the cross_compile.sh script under the SDK root folder. The common usage is:
CROSS_COMPILE_PREFIX=<COMPILE_PREFIX> ./cross_compile.sh
e.g. CROSS_COMPILE_PREFIX=arm-linux-gnueabihf ./cross_compile.sh
ultra_simple
The demo application simply connects to an RPLIDAR device and outputs the scan data to the console:
Demo Application
Loading...
+ 11 hidden pages