Slamtec RPLIDAR Manuale utente

www . sla m te c .c o m
Shangh ai Slam tec.C o.,Ltd
RPLIDAR
Low Cost 360 Degree Laser Range Scanner
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:
oLinux
ooutput\Linux\Release
ooutput\Linux\Debug.
oMacOS
ooutput\Darwin\Release
ooutput\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

7/ 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
Figure 2-1 ultra_simple Demo Application Data Output
Steps:
1) Connect RPLIDAR to PC by using the provided USB cable. (The chip
transforming the USB to serial port is embedded in the RPLIDAR
development kit)
2) Start application by using the following command:
oWindows
ultra_simple <com_port>
Note: if the com number is larger than 9, e.g. com11, then you should
start application use command like this: ultra_grabber \\.\com11
oLinux
ultra_simple <tty device>
e.g. ultra_simple /dev/ttyUSB0.
oLinux

8/ 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
ultra_simple <usb tty device>
e.g. ultra_simple /dev/tty.SLAB_USBtoUART.
simple_grabber
This application demonstrates the process of getting RPLIDAR’s serial number,
firmware version and healthy status after connecting the PC and RPLIDAR. Then
the demo application grabs two round of scan data and shows the range data as
histogram in the command line mode. User can print all scan data if needed.
Figure 2-2 simple_grabber Demo Application Data Output
Steps:
1) Connect RPLIDAR to pc using provided USB cable. (USB to serial chip
embedded in RPLIDAR development kit)
2) Start application use command: simple_grabber <com number>
oWindows
simple_grabber <com_port>

9/ 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
Note: if the com number is larger than 9, e.g. com11, then you should
start application use command like this: ultra_grabber \\.\com11
oLinux
simple_grabber <tty device>
e.g. ultra_simple /dev/ttyUSB0.
oLinux
simple_grabber <usb tty device>
e.g. ultra_simple /dev/tty.SLAB_USBtoUART.
frame_grabber
This demo application can show real-time laser scan data in the GUI with 0-360
degree environment range data. Note, this demo application only has win32
version.
Figure 2-3 frame_grabber Demo Application Data Output

10 / 17
Copyright (c) 2009-2013 RoboPeak Team
Copyright (c) 2013-2017 Shanghai Slamtec Co., Ltd.
Steps:
1) Connect RPLIDAR to pc using provided USB cable. (USB to serial chip
embedded in RPLIDAR development kit)
2) Choose correct com port number through com port selection dialog.
3) Press start scan button (marked in red in the figure above) to start.
Altri manuali per RPLIDAR
1
Indice
Altri manuali Slamtec Scanner























