Thumbnail

Hitachi-LG LDS Lidar

by Hitachi

NMS Driver for the Hitachi-LG LDS 360 degree lidar.

How to add the Hitachi-LG LDS Lidar robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Navigation category tab.
  5. Press the Hitachi-LG LDS Lidar icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Hitachi-LG LDS Lidar robot skill.

How to use the Hitachi-LG LDS Lidar robot skill

NMS Driver for the Hitachi-LG LDS 360 degree lidar. This robot skill connects to the Lidar and pushes the data into ARC's NMS (navigation messaging system) to be used with level 1 navigation viewers. Read the NMS manual page to understand how this skill can be used.



Screenshot
User-inserted image



Configuration
User-inserted image


1) BaudRate
The baud rate for the communication. 

2) Offset Degrees
Correct the angle that the lidar is mounted

3) Advanced communication parsing
Include debug information in the log window. This is only recommended if asked by Synthiam to help debug a communication issue. Otherwise, this will use a lot of resources.

4) Set variables with location data
If you're not using the NMS, check this, and global variables will be created for the scan data.

5) Fake NMS Pose hint event
The Better Navigator can use the Hector SLAM pose hint, which will not require a pose sensor. You can enable this option if you have The Better Navigator configured to use Hector as the pose hint. This will send a "fake" pose hint of 0,0 to the NMS so that the pose event will run after every lidar scan.


NMS (Navigation Messaging System)


This skill operates in Level #3 Group #1. It publishes obstacle detection to the NMS. While some SLAM systems will attempt to determine the cartesian position of the robot without telemetry, it is best to combine this skill with a Group #2 sensor. 
User-inserted image



How to Use EZ-LIDAR SLAM



Program the LIDAR in Blockly
Like all Synthiam controls, the Blockly programming language can be used. In this example below, the robot will speak when an object has come close to it. It will also speak the degrees of where the object was. To see this program in action, click HERE.
User-inserted image



Variables
In the configuration menu of this control, you can view the variables that this skill creates. The variables hold the most recent values of minimum/maximum distance, degrees, and running status of the lidar.User-inserted image



Arduino Sketch


There are two ways to connect to this lidar. You can either use a standard USB<->UART convertor, such as those found on amazon or eBay. Or you can use a 32u4 based Arduino board (i.e. Micro) to make your own USB<->UART converter. The 32u4 based boards are necessary Arduino versions to use because they support emulating USB HID devices, such as a Serial device. 

Here is a simple sketch that can be used on a 32u4 based board...

Code:


void setup() {

Serial1.begin(230400); // Init Hardware Serial port on pins 0 and 1
Serial.begin(230400); // Init Serial Port
}

void loop() {

if (Serial.available())
Serial1.write(Serial.read());

if (Serial1.available())
Serial.write(Serial1.read());
}

Wiring


GREY - Ground
RED - +5
GREEN - RX (connects to TX on Arduino or USB Converter)
BROWN - TX (connects to RX on Arduino or USB converter)

Robotis USB <-> UART Converter


The Robotis version of this sensor may include their USB UART converter, which uses a CP210x chipset. The driver for windows can be found by clicking here: CP210x_Windows_Drivers.zip

Videos


Real-time SLAM mapping


Room Mapping


Near Object Detection


Resources


The source files for the hardware can be found here: github.com/synthiam/E-41_LIDAR

ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

#82  
Thanks DJ,

I was hoping for the parts you used. I see many different parts and would like to use the same as you, please.
I jurat don't want to get the wrong ones,
Thanks in advance.

Cheers
PRO
Synthiam
#83   — Edited
Any USB <-> UART adapter will work. I don't have any preferred USB <-> UART adapter to recommend. I have dozens of different onces. I get them from Amazon.
#85  
thetechguru,
  Can you give any details on your new faster computer, like RAM, etc.
Noticed them on Amazon with different options.
Sounds like you are getting good results with navigation.
Thanks,
Steve S
#86  
#87  
Not sure if there is a different area to post, also, no Related Hardware Product for my
Hitachi-LG LDS Lidar.  I keep getting Parser: Packet failed CRC check errors.  Does anyone no way? see below...


System.Exception: Lidar service parse error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Hitachi_LG_LDS_Lidar.LidarSensorParser.ParseRawSensorPacket(Byte[] data) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarSensorParser.cs:line 44
at Hitachi_LG_LDS_Lidar.MainForm._lidarService_OnLidarDataReady1(Object sender, Byte[] lidarData) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\MainForm.cs:line 201
at Hitachi_LG_LDS_Lidar.LidarServiceUART.imageThreadWorker(EZTaskScheduler sender, Int32 taskId, Object o) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarServiceUART.cs:line 176
at Hitachi_LG_LDS_Lidar.LidarServiceUART.imageThreadWorker(EZTaskScheduler sender, Int32 taskId, Object o) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarServiceUART.cs:line 182
at EZ_B.EZTaskScheduler.jn1guWLfLhdrbRwRngL(Object , Object , Int32 taskId, Object )
at EZ_B.EZTaskScheduler.tLuXrWNGK5()
System.Exception: Lidar service parse error: System.NullReferenceException: Object reference not set to an instance of an object.
at Hitachi_LG_LDS_Lidar.MainForm._lidarService_OnLidarDataReady1(Object sender, Byte[] lidarData) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\MainForm.cs:line 221
at Hitachi_LG_LDS_Lidar.LidarServiceUART.imageThreadWorker(EZTaskScheduler sender, Int32 taskId, Object o) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarServiceUART.cs:line 176
at Hitachi_LG_LDS_Lidar.LidarServiceUART.imageThreadWorker(EZTaskScheduler sender, Int32 taskId, Object o) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarServiceUART.cs:line 182
at EZ_B.EZTaskScheduler.jn1guWLfLhdrbRwRngL(Object , Object , Int32 taskId, Object )
at EZ_B.EZTaskScheduler.tLuXrWNGK5()
System.Exception: Lidar service parse error: System.NullReferenceException: Object reference not set to an instance of an object.
at Hitachi_LG_LDS_Lidar.MainForm._lidarService_OnLidarDataReady1(Object sender, Byte[] lidarData) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\MainForm.cs:line 221
at Hitachi_LG_LDS_Lidar.LidarServiceUART.imageThreadWorker(EZTaskScheduler sender, Int32 taskId, Object o) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarServiceUART.cs:line 176
at Hitachi_LG_LDS_Lidar.LidarServiceUART.imageThreadWorker(EZTaskScheduler sender, Int32 taskId, Object o) in C:\My Documents\SVN\Developer - Controls\In Production\Hitachi-LG LDS Lidar\MY_PROJECT_NAME\LidarServiceUART.cs:line 182
at EZ_B.EZTaskScheduler.jn1guWLfLhdrbRwRngL(Object , Object , Int32 taskId, Object )
at EZ_B.EZTaskScheduler.tLuXrWNGK5()


Thanks in advance.
PRO
Synthiam
#88  
Moved to comment to the robot skill that you're asking about:)

The error occurs when the data is corrupt. This can be due to the USB port being too busy and can't process the data quick enough. Or the sensor isn't getting enough power. Or the sensor is faulty and while spinning, it isn't making a good connection to send the correct amount of data.

Things to check are
- The wire isn't surrounded or wrapped in power lines or other signal lines
- The wire isn't connected securely to the usb uart adapter or sensor
- The sensor isn't getting enough power
- The sensor contacts is dusty and needs to be cleaned
- The usb port is busy with other devices. Try another usb port or disconnect some items on the usb line

Does the robot skill stop when it receives that error?
#89  
Thanks DJ,  I will check all you have listed.  Yes the robot skill and the
Hitachi-LG LDS Lidar. stop.
PRO
Synthiam
#90  
How long does it take before the error is raised?
PRO
Synthiam
#91  
Does it render the distances for a little while before throwing the error?
#92  
I tried everything that you listed nothing works. Luckily I had a spare Lidar.  Switched it out and everything is working I still get the Packet failed CRC check error.  But not that often.

it does render and variable smart watch and on the scale itself maybe it’s my PC or my usb hub.  Not sure but if it’s rendering the variables it should work OK I believe.

thanks for your help DJ.

User-inserted image
#93  
I forgot to answer your question. It would run for only a few seconds and then stop each time with the old Lidar.
PRO
Synthiam
#94  
Updated this robot skill to have a settings in the config menu which enables or disables debug information being written to the log file. Specifically the CRC errors won't be logged if this is unchecked.
PRO
Synthiam
#95  
Updated with performance improvement
PRO
Synthiam
#96  
v15 Updated with minor performance improvement
PRO
Synthiam
#97  
v16 - updated to allow not setting variables to save on performance
PRO
Synthiam
#98  
v19 updated

- it includes an option to fake the NMS pose hint event so you can use this 360 lidar without a pose sensor with The Better Navigator. Read manual above for more information
#99  
Ahh ordering one today! Having this in the toolbox would be significant!
#100  
Does it matter which way the Lidar is mounted?
Upright or upside down?
I assume it doesn't matter to the Lidar ... lol ... but would the software have a problem with it?
Asking before mounting.

Thanks
PRO
Synthiam
#101  
Look at the top of the page and you’ll see the manual that has an option for offset. 

Rotation is fine but upside down is never allowed for lidars. It’s the mechanics of how it spins and the bearings and such. They can’t mount upside down