Connecting and reading Garmin LidarLite Sensor with Gobot Framework
GOBOT is a framework written in Go programming language. Useful for connecting robotic components, variety of hardware & IoT devices.
Framework consists of
Robots -> Virtual entity representing rover, drones, sensors etc.
Adaptors -> Allows connectivity to the hardware e.g. connection to Arduino is done using Firmata Adaptor, defining how to talk to it
Drivers -> Defines specific functionality to support on specific hardware devices e.g. buttons, sensors, etc.
API -> Provides RESTful API to query Robot status
There are additional core features of the framework that I recommend having a look esp. Events, Commands allowing Subscribing / Publishing events to the device for more refer to the doc
There's already a long list of Platforms for which the drivers and adaptors are available. For this blog I will be working with Arduino + Garmin LidarLite v3. There are cheaper versions available for distance measurement, however if you are looking for high performance, high precision optical distance measurement sensor, then this is it.
This defines the vitual representation of the entity and the driver + the work this robot needs to do.
Here's the complete code. Before running this pacakge make sure to build it as you likely will have to execute the runnable with sudo. To build simply navigate to the folder in the shell where the main.go exists and execute
$ go build
This will create runnable file with the package name execute the same with sudo if needed like so
$ sudo ./GarminLidarLite
And if everything done as required following ouput will appear with sensor readings printed out every second