LIDAR Lite Mapping with DYNAMIXEL Servos
This demo will show off the capabilities of the LIDAR Lite by rotating the LIDAR lite and using the data to create a visual map of the room. This demo will require Google Chrome to be installed on your computer.
Required Hardware
Robot Turrets
This project is compatible with all of the InterbotiX Robot Turrets listed below. Each Turret comes with an ArboitX-M Robocontroller, a serial programming cable, power, hardware and servos - everything you need to perform this demo. The added tilt servo is not needed for this demo, but will give you an added degree of freedom for scanning the LIDAR Lite.
Pan/Tilt Kits
If you already have an ArbotiX Robocontroller, you can purchase a Pan/Tilt kit to use for this demo.
Build Your Own
This demo only requires a single DYNAMIXEL servo to rotate the LIDAR Lite. See this article about servos compatible with the ArbotiX-M and this demo, as well as programming and power hardware you will need. Please note that scanning at higher speeds with the MX-12W and AX-12W is currently untested with our demo software. Results may vary. You may wish to get a back-frame for your respective servo
- F8 Frame (AX-12A, AX12-W, AX-18A, MX-12W)
- FR07-B101K (MX-28T)
- FR05-B101K (MX-64T)
- FR08-B101K (MX-106T)
If you are intersted in getting the hardware only (no servos) from our Pan-Tilt kits to create a Pan-only kit, please Contact us
Hardware Setup
If you have not already done so, please go through the ArbotiX-M Getting Started Guide and any getting started guides for your kits. If you are using a single AX-12A, you do not need any special setup. If you are using MX servos or a tilt servo, you will need to use the DynaManager to set the baudrate and ID for your servos. The Pan servo should be set to ID 1 at 1000000 bps, and the Tilt servo should be set to ID 2 at 1000000 bps. The Dynamanager will automatically set the baud rate correctly for you.
Finally, go through the LIDAR Lite getting started guide to hook up and test your LIDAR Lite.
The diagram below shows you everything you need to connect to get your LIDAR Lite scanner working. Only one servo as ID 1 needs to be connected, if you are using a Pan/Tilt mechanism, connect your second servo as ID 2.

LIDAR Lite Pin | ArbotiX Pin |
---|---|
5v | D16 Power Pin |
GND | D16 Ground Pin |
SDA | D16 Data Pin |
SCL | D17 Data Pin |
Hardware Programming
Download the firmware and software zip file. Extract this file's contents to your computer.
Now open
firmware/lidarPerimterScanner/lidarPerimterScanner.ino
in your Arduino IDE and load it onto your ArbotiX-M. Your pan servo will move towards its lowest position. Your tilt servo (if connected) will move to a centered/level position.
Servo Type
You will need to make a modification to the firmware depending on the servo you are using. At line 15 you should see
//#define AX //#define MX
You will need to uncomment one of these lines based on which servos you are using. For AX servos (AX-12A, AX-18A, AX-12W) your code should look like
#define AX //#define MX
For MX servos (MX-28T, MX-64T, MX-106T, MX-12W) your code should look like
//#define AX #define MX
Note on Scan Limits
By default, the firmware will make the servos scan for their entire limits (300° for AX servos, 360° for MX servos). By adjusting the PAN_MIN
and PAN_MAX
value, you can limit the servo to scan a smaller region. This may be useful for faster scanning when mounted on a robot. You will also need to adjust the MAPPRED_PAN_MIN
and MAPPED_PAN_MAX
lines. For MX servos, this will be the same as PAN_MIN
and PAN_MAX
. For AX servos, you will need to convert your angle limits into the 0-4095 scale. You can use the formula
mapped value = 4095 * degree/360So for example, the default limits of the AX servo are from 30° to 330° When 0° is 0 and 360° is 4095, 30°l maps to ~341 and 330° maps to 3754
Default Speed
By default the servo speed is fairly slow. We recommend that you adjust the speed in the app itself, but if you want the default speed to be higher, you can increase the value of the following line
#define DEFAULT_SPEED 64 //startup speed
See the manual for your specific servo for more information on speed settings. This demo performs much better at low speeds.
Software Setup
Open up a chrome browser and enter chrome://extensions/
into the address bar, or open the chrome settings and click on 'Extensions' in the left navigation bar. Click the check-box next to 'Developer Mode'. This will give you the ability to load unpacked chrome extensions.
Now click 'Load unpacked extension...' and navigate to the lidarChrome
folder. You should now see 'Lidar MX Turret' as an available extension. Click 'Launch' to launch the Application.
You should now see the Lidar Lite + Servo Mapping Demo.
Connection
From the drop-down menu you should see a list of available serial ports. Choose the port associated with your USB-Serial device - this should be the same device / port you used to program your ArbotiX-M. Click 'Connect' to connect to the device.
Start/Stop Sweep
Connecting to the ArbotiX-M will reset the board. It may take 5-6 seconds for the sketch to start up after a reset (the green user LED will turn on once the ArbotiX is ready).Once the board is ready you can click 'Start Sweep' to start the servo. The servo will sweep back and forth. Click 'Stop Sweep' to stop the motion. The servo will finish its current sweep before it stops.
X Center / Y Center
The red box represents the LIDAR Lite's Position. You can adjust the X Center
and Y Center
sliders to move this position in relation to the rest of the screen. This is useful if your setup is not in the center of the room.
Servo Speed
This slider allows you to set the servo scanning speed. This Application works with a variety of servos, so the speed will vary from servo to servo, and the slider will not be completely linear in terms of speed.
Max Distance
By adjusting this value, you can enlarge or decrease the size of the scan. Enter in the farthest distance from the LIDAR in your room to make the scan fit the screen as best as possible.
Clear On Sweep
Checking this box will cause the display to clear whenever a sweep is completed, similar to a radar type display.
Draw Lines
Checking this box will cause lines to be drawn between each point.
Clear Canvas
This will clear the current canvas display.