hybridgroup.gobot/README.md

182 lines
6.5 KiB
Markdown
Raw Normal View History

2015-06-30 11:07:15 +08:00
[![Gobot](https://raw.githubusercontent.com/hybridgroup/gobot-site/master/source/images/elements/gobot-logo-small.png)](http://gobot.io/)
2013-12-06 06:35:30 +08:00
2015-06-30 11:12:54 +08:00
Gobot (http://gobot.io/) is a framework using the Go programming language (http://golang.org/) for robotics, physical computing, and the Internet of Things.
2013-11-10 02:51:30 +08:00
It provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the same time.
2015-06-30 09:41:11 +08:00
Want to use Javascript robotics? Check out our sister project Cylon.js (http://cylonjs.com/)
Want to use Ruby on robots? Check out our sister project Artoo (http://artoo.io)
2013-11-10 02:51:30 +08:00
2014-10-29 23:35:28 +08:00
[![GoDoc](https://godoc.org/github.com/hybridgroup/gobot?status.svg)](https://godoc.org/github.com/hybridgroup/gobot)
2014-04-17 00:32:13 +08:00
[![Build Status](https://travis-ci.org/hybridgroup/gobot.png?branch=master)](https://travis-ci.org/hybridgroup/gobot) [![Coverage Status](https://coveralls.io/repos/hybridgroup/gobot/badge.png?branch=master)](https://coveralls.io/r/hybridgroup/gobot?branch=master)
2013-11-10 02:51:30 +08:00
2015-01-15 18:52:07 +08:00
## Getting Started
Get the Gobot source with: `go get -d -u github.com/hybridgroup/gobot/...`
2014-10-29 23:35:28 +08:00
2013-11-10 02:51:30 +08:00
## Examples
2014-06-09 11:28:17 +08:00
#### Gobot with Arduino
2013-11-10 02:51:30 +08:00
```go
package main
2013-11-14 12:50:22 +08:00
2013-11-10 02:51:30 +08:00
import (
2014-07-11 08:02:00 +08:00
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/gpio"
2013-11-10 02:51:30 +08:00
)
func main() {
2014-07-11 08:02:00 +08:00
gbot := gobot.NewGobot()
2013-11-10 02:51:30 +08:00
2014-07-11 08:02:00 +08:00
firmataAdaptor := firmata.NewFirmataAdaptor("arduino", "/dev/ttyACM0")
led := gpio.NewLedDriver(firmataAdaptor, "led", "13")
2013-11-10 02:51:30 +08:00
2014-07-11 08:02:00 +08:00
work := func() {
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
2013-11-14 12:50:22 +08:00
2014-07-11 08:02:00 +08:00
robot := gobot.NewRobot("bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{led},
work,
)
2013-11-10 02:51:30 +08:00
2014-07-11 08:02:00 +08:00
gbot.AddRobot(robot)
gbot.Start()
2013-11-10 02:51:30 +08:00
}
```
2014-06-09 11:28:17 +08:00
#### Gobot with Sphero
2013-11-25 07:59:36 +08:00
2013-12-06 06:40:29 +08:00
```go
package main
2013-11-25 07:59:36 +08:00
2013-12-06 06:40:29 +08:00
import (
2014-07-11 08:02:00 +08:00
"fmt"
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/sphero"
2013-12-06 06:40:29 +08:00
)
2013-11-25 07:59:36 +08:00
2013-12-06 06:40:29 +08:00
func main() {
2014-07-11 08:02:00 +08:00
gbot := gobot.NewGobot()
adaptor := sphero.NewSpheroAdaptor("sphero", "/dev/rfcomm0")
driver := sphero.NewSpheroDriver(adaptor, "sphero")
2013-12-06 06:40:29 +08:00
2014-07-11 08:02:00 +08:00
work := func() {
gobot.Every(3*time.Second, func() {
driver.Roll(30, uint16(gobot.Rand(360)))
})
}
2014-02-05 06:27:16 +08:00
2014-07-11 08:02:00 +08:00
robot := gobot.NewRobot("sphero",
[]gobot.Connection{adaptor},
[]gobot.Device{driver},
work,
)
2014-02-05 06:27:16 +08:00
2014-07-11 08:02:00 +08:00
gbot.AddRobot(robot)
2014-02-05 06:27:16 +08:00
2014-07-11 08:02:00 +08:00
gbot.Start()
2013-12-06 06:40:29 +08:00
}
2013-11-25 07:59:36 +08:00
```
2013-11-10 02:51:30 +08:00
## Hardware Support
Gobot has a extensible system for connecting to hardware devices. The following robotics and physical computing platforms are currently supported:
2014-11-04 09:38:20 +08:00
2014-06-18 10:36:40 +08:00
- [Ardrone](http://ardrone2.parrot.com/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/ardrone)
- [Arduino](http://www.arduino.cc/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/firmata)
- [Beaglebone Black](http://beagleboard.org/Products/BeagleBone+Black/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/beaglebone)
- [Digispark](http://digistump.com/products/1) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/digispark)
2014-09-25 01:18:14 +08:00
- [Intel Edison](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/intel-iot/edison)
2014-06-18 10:36:40 +08:00
- [Joystick](http://en.wikipedia.org/wiki/Joystick) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/joystick)
- [Leap Motion](https://www.leapmotion.com/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/leapmotion)
2014-11-11 11:53:31 +08:00
- [MavLink](http://qgroundcontrol.org/mavlink/start) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/mavlinky)
- [MQTT](http://mqtt.org/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/mqtt)
2014-06-18 10:36:40 +08:00
- [Neurosky](http://neurosky.com/products-markets/eeg-biosensors/hardware/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/neurosky)
- [OpenCV](http://opencv.org/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/opencv)
2014-11-04 09:38:20 +08:00
- [Pebble](https://www.getpebble.com/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/pebble)
2014-11-11 11:53:31 +08:00
- [Raspberry Pi](http://www.raspberrypi.org/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/raspi)
2014-06-18 10:36:40 +08:00
- [Spark](https://www.spark.io/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/spark)
- [Sphero](http://www.gosphero.com/) <=> [Library](https://github.com/hybridgroup/gobot/tree/master/platforms/sphero)
2014-11-04 09:38:20 +08:00
2013-12-14 00:54:30 +08:00
Support for many devices that use General Purpose Input/Output (GPIO) have
2014-05-07 17:07:34 +08:00
a shared set of drivers provided using the cylon-gpio module:
2013-12-14 00:54:30 +08:00
2014-06-18 10:36:40 +08:00
- [GPIO](https://en.wikipedia.org/wiki/General_Purpose_Input/Output) <=> [Drivers](https://github.com/hybridgroup/gobot/tree/master/platforms/gpio)
2014-03-27 02:59:12 +08:00
- Analog Sensor
2013-12-14 00:54:30 +08:00
- Button
2014-11-04 09:38:20 +08:00
- Direct Pin
2014-03-27 02:59:12 +08:00
- Digital Sensor
- Direct Pin
2013-12-14 00:54:30 +08:00
- LED
- Makey Button
2014-03-27 02:59:12 +08:00
- Motor
2013-12-14 00:54:30 +08:00
- Servo
2013-11-10 02:51:30 +08:00
2013-12-17 06:20:21 +08:00
Support for devices that use Inter-Integrated Circuit (I2C) have a shared set of
2014-05-07 17:07:34 +08:00
drivers provided using the gobot-i2c module:
2013-12-17 06:20:21 +08:00
2014-06-18 10:36:40 +08:00
- [I2C](https://en.wikipedia.org/wiki/I%C2%B2C) <=> [Drivers](https://github.com/hybridgroup/gobot/tree/master/platforms/i2c)
2014-03-27 02:59:12 +08:00
- BlinkM
- HMC6352
- LIDAR-Lite
2014-11-11 11:53:31 +08:00
- MPL1150A2
- MPU6050
2013-12-17 06:20:21 +08:00
- Wii Nunchuck Controller
2013-11-10 02:51:30 +08:00
More platforms and drivers are coming soon...
2013-11-25 07:59:36 +08:00
## 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.
2014-06-11 06:16:11 +08:00
To activate the API, require the `github.com/hybridgroup/gobot/api` package and instantiate the `API` like this:
2013-11-25 07:59:36 +08:00
2014-11-04 09:38:20 +08:00
```go
2014-07-11 08:02:00 +08:00
gbot := gobot.NewGobot()
api.NewAPI(gbot).Start()
2013-11-25 07:59:36 +08:00
```
You can also specify the api host and port, and turn on authentication:
2014-11-04 09:38:20 +08:00
```go
2014-07-11 08:02:00 +08:00
gbot := gobot.NewGobot()
server := api.NewAPI(gbot)
2014-06-09 11:28:17 +08:00
server.Port = "4000"
server.Username = "Gort"
server.Password = "klaatu"
server.Start()
2013-11-25 07:59:36 +08:00
```
2013-11-10 02:51:30 +08:00
2015-06-30 11:14:16 +08:00
You may access the [robeaux](https://github.com/hybridgroup/robeaux) React.js interface with Gobot by navigating to `http://localhost:3000/index.html`.
2014-02-05 06:15:21 +08:00
2013-11-10 02:51:30 +08:00
## Documentation
We're busy adding documentation to our web site at http://gobot.io/ please check there as we continue to work on Gobot
Thank you!
2015-01-15 18:52:07 +08:00
## Need help?
* Join our mailing list: https://groups.google.com/forum/#!forum/gobotio
* IRC: `#gobotio @ irc.freenode.net`
* Issues: https://github.com/hybridgroup/gobot/issues
2015-01-17 01:57:10 +08:00
* twitter: [@gobotio](https://twitter.com/gobotio)
2015-01-15 18:52:07 +08:00
2013-11-10 02:51:30 +08:00
## Contributing
For our contribution guidelines, please go to [https://github.com/hybridgroup/gobot/blob/master/CONTRIBUTING.md
](https://github.com/hybridgroup/gobot/blob/master/CONTRIBUTING.md
).
2013-11-10 02:51:30 +08:00
## License
2015-01-15 18:52:07 +08:00
Copyright (c) 2013-2015 The Hybrid Group. Licensed under the Apache 2.0 license.