• Stars
    star
    8,627
  • Rank 4,018 (Top 0.09 %)
  • Language
    Go
  • License
    Other
  • Created over 10 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Golang framework for robotics, drones, and the Internet of Things (IoT)

Gobot

GoDoc CircleCI Build status Appveyor Build status codecov Go Report Card License

Gobot (https://gobot.io/) is a framework using the Go programming language (https://golang.org/) for robotics, physical computing, and the Internet of Things.

It provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the same time.

Want to run Go directly on microcontrollers? Check out our sister project TinyGo (https://tinygo.org/)

Getting Started

Get in touch

Get the Gobot source code by running this commands:

git clone https://github.com/hybridgroup/gobot.git
git checkout release

Afterwards have a look at the examples directory. You need to find an example matching your platform for your first test (e.g. "raspi_blink.go"). Than build the binary (cross compile), transfer it to your target and run it.

env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink examples/raspi_blink.go

Building the code on your local machine with the example code above will create a binary for ARMv5. This is probably not what you need for your specific target platform. Please read also the platform specific documentation in the platform subfolders.

Create your first project

Create a new folder and a new Go module project.

mkdir ~/my_gobot_example
cd ~/my_gobot_example
go mod init my.gobot.example.com

Copy your example file besides the go.mod file, import the requirements and build.

cp /<path to gobot folder>/examples/raspi_blink.go ~/my_gobot_example/
go mod tidy
env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink raspi_blink.go

Now you are ready to modify the example and test your changes. Start by removing the build directives at the beginning of the file.

Examples

Gobot with Arduino

package main

import (
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/drivers/gpio"
  "gobot.io/x/gobot/v2/platforms/firmata"
)

func main() {
  firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
  led := gpio.NewLedDriver(firmataAdaptor, "13")

  work := func() {
    gobot.Every(1*time.Second, func() {
      led.Toggle()
    })
  }

  robot := gobot.NewRobot("bot",
    []gobot.Connection{firmataAdaptor},
    []gobot.Device{led},
    work,
  )

  robot.Start()
}

Gobot with Sphero

package main

import (
  "fmt"
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/platforms/sphero"
)

func main() {
  adaptor := sphero.NewAdaptor("/dev/rfcomm0")
  driver := sphero.NewSpheroDriver(adaptor)

  work := func() {
    gobot.Every(3*time.Second, func() {
      driver.Roll(30, uint16(gobot.Rand(360)))
    })
  }

  robot := gobot.NewRobot("sphero",
    []gobot.Connection{adaptor},
    []gobot.Device{driver},
    work,
  )

  robot.Start()
}

"Metal" Gobot

You can use the entire Gobot framework as shown in the examples above ("Classic" Gobot), or you can pick and choose from the various Gobot packages to control hardware with nothing but pure idiomatic Golang code ("Metal" Gobot). For example:

package main

import (
  "gobot.io/x/gobot/v2/drivers/gpio"
  "gobot.io/x/gobot/v2/platforms/intel-iot/edison"
  "time"
)

func main() {
  e := edison.NewAdaptor()
  e.Connect()

  led := gpio.NewLedDriver(e, "13")
  led.Start()

  for {
    led.Toggle()
    time.Sleep(1000 * time.Millisecond)
  }
}

"Master" Gobot

You can also use the full capabilities of the framework aka "Master Gobot" to control swarms of robots or other features such as the built-in API server. For example:

package main

import (
  "fmt"
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/api"
  "gobot.io/x/gobot/v2/platforms/sphero"
)

func NewSwarmBot(port string) *gobot.Robot {
  spheroAdaptor := sphero.NewAdaptor(port)
  spheroDriver := sphero.NewSpheroDriver(spheroAdaptor)
  spheroDriver.SetName("Sphero" + port)

  work := func() {
    spheroDriver.Stop()

    spheroDriver.On(sphero.Collision, func(data interface{}) {
      fmt.Println("Collision Detected!")
    })

    gobot.Every(1*time.Second, func() {
      spheroDriver.Roll(100, uint16(gobot.Rand(360)))
    })
    gobot.Every(3*time.Second, func() {
      spheroDriver.SetRGB(uint8(gobot.Rand(255)),
        uint8(gobot.Rand(255)),
        uint8(gobot.Rand(255)),
      )
    })
  }

  robot := gobot.NewRobot("sphero",
    []gobot.Connection{spheroAdaptor},
    []gobot.Device{spheroDriver},
    work,
  )

  return robot
}

func main() {
  master := gobot.NewMaster()
  api.NewAPI(master).Start()

  spheros := []string{
    "/dev/rfcomm0",
    "/dev/rfcomm1",
    "/dev/rfcomm2",
    "/dev/rfcomm3",
  }

  for _, port := range spheros {
    master.AddRobot(NewSwarmBot(port))
  }

  master.Start()
}

Hardware Support

Gobot has a extensible system for connecting to hardware devices. The following robotics and physical computing platforms are currently supported:

Support for many devices that use General Purpose Input/Output (GPIO) have a shared set of drivers provided using the gobot/drivers/gpio package:

  • GPIO <=> Drivers
    • AIP1640 LED Dot Matrix/7 Segment Controller
    • Button
    • Buzzer
    • Direct Pin
    • EasyDriver
    • Grove Button (by using driver for Button)
    • Grove Buzzer (by using driver for Buzzer)
    • Grove LED (by using driver for LED)
    • Grove Magnetic Switch (by using driver for Button)
    • Grove Relay (by using driver for Relay)
    • Grove Touch Sensor (by using driver for Button)
    • HC-SR04 Ultrasonic Ranging Module
    • HD44780 LCD controller
    • LED
    • Makey Button (by using driver for Button)
    • MAX7219 LED Dot Matrix
    • Motor
    • Proximity Infra Red (PIR) Motion Sensor
    • Relay
    • RGB LED
    • Servo
    • Stepper Motor
    • TM1638 LED Controller

Support for many devices that use Analog Input/Output (AIO) have a shared set of drivers provided using the gobot/drivers/aio package:

  • AIO <=> Drivers
    • Analog Actuator
    • Analog Sensor
    • Grove Light Sensor
    • Grove Piezo Vibration Sensor
    • Grove Rotary Dial
    • Grove Sound Sensor
    • Grove Temperature Sensor
    • Temperature Sensor (supports linear and NTC thermistor in normal and inverse mode)
    • Thermal Zone Temperature Sensor

Support for devices that use Inter-Integrated Circuit (I2C) have a shared set of drivers provided using the gobot/drivers/i2c package:

  • I2C <=> Drivers
    • Adafruit 1109 2x16 RGB-LCD with 5 keys
    • Adafruit 2327 16-Channel PWM/Servo HAT Hat
    • Adafruit 2348 DC and Stepper Motor Hat
    • ADS1015 Analog to Digital Converter
    • ADS1115 Analog to Digital Converter
    • ADXL345 Digital Accelerometer
    • BH1750 Digital Luminosity/Lux/Light Sensor
    • BlinkM LED
    • BME280 Barometric Pressure/Temperature/Altitude/Humidity Sensor
    • BMP180 Barometric Pressure/Temperature/Altitude Sensor
    • BMP280 Barometric Pressure/Temperature/Altitude Sensor
    • BMP388 Barometric Pressure/Temperature/Altitude Sensor
    • DRV2605L Haptic Controller
    • Generic driver for read and write values to/from register address
    • Grove Digital Accelerometer
    • GrovePi Expansion Board
    • Grove RGB LCD
    • HMC6352 Compass
    • HMC5883L 3-Axis Digital Compass
    • INA3221 Voltage Monitor
    • JHD1313M1 LCD Display w/RGB Backlight
    • L3GD20H 3-Axis Gyroscope
    • LIDAR-Lite
    • MCP23017 Port Expander
    • MMA7660 3-Axis Accelerometer
    • MPL115A2 Barometric Pressure/Temperature
    • MPU6050 Accelerometer/Gyroscope
    • PCA9501 8-bit I/O port with interrupt, 2-kbit EEPROM
    • PCA953x LED Dimmer for PCA9530 (2-bit), PCA9533 (4-bit), PCA9531 (8-bit), PCA9532 (16-bit)
    • PCA9685 16-channel 12-bit PWM/Servo Driver
    • PCF8583 clock and calendar or event counter, 240 x 8-bit RAM
    • PCF8591 8-bit 4xA/D & 1xD/A converter
    • SHT2x Temperature/Humidity
    • SHT3x-D Temperature/Humidity
    • SSD1306 OLED Display Controller
    • TSL2561 Digital Luminosity/Lux/Light Sensor
    • Wii Nunchuck Controller
    • YL-40 Brightness/Temperature sensor, Potentiometer, analog input, analog output Driver

Support for devices that use Serial Peripheral Interface (SPI) have a shared set of drivers provided using the gobot/drivers/spi package:

  • SPI <=> Drivers
    • APA102 Programmable LEDs
    • MCP3002 Analog/Digital Converter
    • MCP3004 Analog/Digital Converter
    • MCP3008 Analog/Digital Converter
    • MCP3202 Analog/Digital Converter
    • MCP3204 Analog/Digital Converter
    • MCP3208 Analog/Digital Converter
    • MCP3304 Analog/Digital Converter
    • MFRC522 RFID Card Reader
    • SSD1306 OLED Display Controller

More platforms and drivers are coming soon...

API

Gobot includes a RESTful API to query the status of any robot running within a group, including the connection and device status, and execute device commands.

To activate the API, import the gobot.io/x/gobot/v2/api package and instantiate the API like this:

  master := gobot.NewMaster()
  api.NewAPI(master).Start()

You can also specify the api host and port, and turn on authentication:

  master := gobot.NewMaster()
  server := api.NewAPI(master)
  server.Port = "4000"
  server.AddHandler(api.BasicAuth("gort", "klatuu"))
  server.Start()

You may access the robeaux React.js interface with Gobot by navigating to http://localhost:3000/index.html.

CLI

Gobot uses the Gort http://gort.io Command Line Interface (CLI) so you can access important features right from the command line. We call it "RobotOps", aka "DevOps For Robotics". You can scan, connect, update device firmware, and more!

Documentation

We're always adding documentation to our web site at https://gobot.io/ please check there as we continue to work on Gobot

Thank you!

Need help?

Contributing

For our contribution guidelines, please go to https://github.com/hybridgroup/gobot/blob/master/CONTRIBUTING.md .

Gobot is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. You can read about it here.

License

Copyright (c) 2013-2020 The Hybrid Group. Licensed under the Apache 2.0 license.

The Contributor Covenant is released under the Creative Commons Attribution 4.0 International Public License, which requires that attribution be included.

More Repositories

1

gocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, and OpenCV Contrib.
Go
6,284
star
2

cylon

JavaScript framework for robotics, drones, and the Internet of Things (IoT)
JavaScript
3,979
star
3

artoo

Ruby framework for robotics, drones, and the Internet of Things (IoT)
Ruby
1,533
star
4

gabba

Simple way to send server-side notifications to Google Analytics
Ruby
464
star
5

gort

Command Line Interface (CLI) for RobotOps
Go
434
star
6

kidsruby

KidsRuby is a Ruby programming environment meant for kids to learn and have fun!
JavaScript
333
star
7

taskmapper

Taskmapper provides a universal API to bug tracking and project management systems using Ruby
Ruby
218
star
8

rubyserial

FFI Ruby library for RS-232 serial port communication
Ruby
154
star
9

mechanoid

Mechanoid is a framework for WebAssembly applications on embedded systems and IoT devices.
Go
145
star
10

node-bebop

A Node.js client for controlling Parrot Bebop & Bebop2 quadcopters.
JavaScript
144
star
11

robeaux

Universal dashboard to robotic devices based on React
CSS
125
star
12

GitHub-Wikifier

A pre-commit Git Hook that will generate all the Table of Contents you will ever need. Just write your content, and let it take over.
Shell
100
star
13

gitnesse

Acceptance testing with Cucumber using a git-based wiki to store feature stories
Ruby
88
star
14

cppp-io

Common Protocol for Programming Physical Input and Output
72
star
15

cylon-raspi

Cylon adaptor for the Raspberry Pi
JavaScript
69
star
16

go-ncs

Go language bindings for the Intel Movidius Neural Compute Stick
Go
49
star
17

watchbot

Pebble watch app to control robotic devices
JavaScript
46
star
18

cylon-sphero

Cylon adaptor for Sphero robot
JavaScript
46
star
19

cylon-firmata

Cylon adaptor for the Firmata protocol
JavaScript
45
star
20

artoo-arduino

Artoo adaptor for the Arduino microcontroller.
Ruby
45
star
21

tinyglobo

A pico balloon floats into the great big world, towing a RP2040 Pico programmed with TinyGo
Go
42
star
22

kidsruby-class-1

Class notes for KidsRuby Class 1
Ruby
40
star
23

gophercon-2019

Go
37
star
24

cylon-intel-iot

Cylon adaptors for the Intel Edison & Galileo
JavaScript
36
star
25

cylon-leapmotion

Cylon adaptor for the Leap Motion
JavaScript
35
star
26

gophercar

Gophercar is a DIY platform for self-driving miniature cars using the Go programming language.
Go
32
star
27

artoo-raspi

Artoo adaptor for the Raspberry Pi
Ruby
32
star
28

commander

Mobile application to control robots
JavaScript
30
star
29

cylon-ble

Cylon.js adaptor/drivers for Bluetooth LE
JavaScript
29
star
30

cylon-neurosky

Cylon adaptor/driver for the Neurosky Mindwave
JavaScript
28
star
31

cylon-sphero-ble

Cylon.js driver for the Sphero BB-8 & Sphero Ollie robots
JavaScript
26
star
32

gophercon-2017

Hardware hack day support info for Gophercon 2017 and beyond!
Go
26
star
33

cvscope

Experimental CLI tool for visually exploring video image filters and algorithms that are part of OpenCV. Written in Go using GoCV.
Go
25
star
34

artoo-sphero

Artoo adaptor for the Sphero robot.
Ruby
24
star
35

cylon-spark

Cylon adaptor for the Spark core device
JavaScript
24
star
36

cylon-octoblu

Cylon adaptor/driver for the Octoblu machine to machine messaging system
JavaScript
23
star
37

gophercon-2018

Gophercon hardware hackday
Go
22
star
38

cylon-opencv

Cylon adaptor and driver for OpenCV
JavaScript
20
star
39

cylon-beaglebone

Cylon adaptor for the Beaglebone Black single board computer
JavaScript
20
star
40

artoo-ardrone

Artoo adaptor for the ARDrone 2.0 quadcopter
Ruby
20
star
41

cylon-bebop

Cylon.js driver/adaptor for Parrot Bebop drone
JavaScript
19
star
42

cylon-gpio

Cylon drivers for GPIO devices
JavaScript
19
star
43

cylon-crazyflie

Cylon adaptor/driver for the Crazyflie nanocopter
JavaScript
18
star
44

cylon-ardrone

Cylon adaptor and drivers for the Parrot ARDrone 2.0
JavaScript
17
star
45

gopherbot

A robotic gopher plushie that you can code using TinyGo.
Go
17
star
46

kidsrubyinstaller-osx

KidsRuby installer for OSX
Shell
16
star
47

cylon-api-socketio

Cylon.js API plugin for Socket.io
JavaScript
15
star
48

gobot-firmata

Gobot adaptor for the Firmata protocol
Go
14
star
49

cylon-mip

Cylon.js driver for MIP
JavaScript
13
star
50

cylon-site

Website for Cylon.js - JavaScript robotics framework using Node.js
HTML
13
star
51

kidsruby-os

KidsRuby helps kids learn to program using the awesome language Ruby anywhere they go, just bring their own USB drive, plug in, and reboot.
Ruby
13
star
52

cylon-tessel

Cylon adaptor for the Tessel
JavaScript
13
star
53

artoo-opencv

Artoo drivers for OpenCV computer vision library
Ruby
12
star
54

artoo-leapmotion

Artoo adaptor for the Leap Motion controller
Ruby
11
star
55

taskmapper-redmine

Ticketmaster provider for Redmine API
Ruby
11
star
56

cylon-api-http

Cylon.js API plugin for http/https
JavaScript
11
star
57

cylon-i2c

Cylon.js drivers for i2c devices
JavaScript
11
star
58

kidsrubyinstaller-windows

KidsRuby installer for Windows
Ruby
10
star
59

mechanoid-examples

Examples written using Mechanoid framework for WASM-based embedded development.
Go
10
star
60

kidsruby-examples

KidsRuby examples
Ruby
10
star
61

gobot-gpio

Gobot drivers for GPIO devices
Go
9
star
62

gobot-site

Website for Gobot - Golang framework/set of libraries for robotics and physical computing
Haml
9
star
63

gobot-spark

Gobot adaptor for the spark core
Go
9
star
64

kidsruby-site

Have fun and learn Ruby programming for free! Works on any computer.
CSS
9
star
65

cylon-speech

Cylon adaptor/driver for the eSpeak Text To Speech software
JavaScript
8
star
66

gopherboat

Robotic boat programmed using TinyGo
Go
8
star
67

gobot-beaglebone

Gobot adaptor for the Beaglebone Black development board
Go
8
star
68

cylon-joystick

Cylon adaptor and driver for HID joysticks/controllers
JavaScript
8
star
69

artoo-roomba

Artoo adaptor for the Roomba robot.
Ruby
8
star
70

artoo-pebble

Artoo adaptor for the Pebble smart watch
Ruby
8
star
71

artoo-spark

Artoo adaptor for the Spark core device
Ruby
8
star
72

kidsruby-cookbooks

KidsRuby Chef recipes used for build server
Ruby
7
star
73

cylon-hue

Cylon.js adaptor/driver for Phillips Hue
JavaScript
7
star
74

cylon-mqtt

Cylon.js adaptor/driver for MQTT protocol
JavaScript
7
star
75

hacklab-2019

GoLab 2019 "HackLab" for hardware hacking using Go
Go
7
star
76

cylon-audio

Cylon.js adaptor/driver for audio
JavaScript
6
star
77

cylon-rapiro

Cylon adaptor/driver for the Rapiro bipedal robot
JavaScript
6
star
78

hashcode

Just a little fun project to chart the results of #code2014
Ruby
6
star
79

taskmapper-github

Ticketmaster provider for Github ticket system
Ruby
6
star
80

taskmapper-unfuddle

Ticketmaster provider for Unfuddle
Ruby
6
star
81

artoo-joystick

Artoo adaptor and driver for any SDL joystick
Ruby
6
star
82

artoo-gpio

Artoo standard drivers for GPIO devices
Ruby
6
star
83

gobot-sphero

Gobot adaptor for Sphero robot
Go
5
star
84

artoo-neurosky

Artoo adaptor/drivers for the Neurosky Mindwave Mobile
Ruby
5
star
85

gobot-dotgo-2017

Gobot workshop for dotGo
Go
5
star
86

gobot-opencv

Go
5
star
87

artoo-keyboard

Artoo adaptor/driver for keyboard interaction
Ruby
5
star
88

taskmapper-lighthouse

Ticketmaster provider for Lighthouse
Ruby
5
star
89

gophercon-2022

Hardware hack session at Gophercon 2022
Go
5
star
90

taskmapper-basecamp

Ticketmaster provider for 37 Signals' Basecamp
Ruby
5
star
91

gobot-ardrone

Gobot adaptor and drivers for the Parrot ARDrone 2.0
Go
5
star
92

cylon-chip

Cylon.js adaptor for the C.H.I.P. $9 computer
JavaScript
5
star
93

cylon-wiced-sense

Cylon.js driver for WICED Sense
JavaScript
5
star
94

phonegap-cylon-spark

An phonegap app to control spark with cylon
CSS
5
star
95

gdg-2019

Hardware hack session at the GDG Leads Summit 2019
Go
5
star
96

cylon-keyboard

Cylon adaptor and driver for keyboard input
JavaScript
5
star
97

taskmapper-assembla

Ticketmaster provider for Assembla API
Ruby
4
star
98

gopherconeu-2022

Go
4
star
99

gocv-site

The website for GoCV
HTML
4
star
100

cylon-powerup

Cylon.js driver for Powerup 3.0 glider
JavaScript
4
star