2014-03-26 04:52:48 +08:00
[![Gobot ](https://raw.github.com/hybridgroup/gobot/gh-pages/images/elements/logo.png )](http://gobot.io/)
2013-10-22 05:23:24 +08:00
2013-12-06 06:35:30 +08:00
http://gobot.io/
2014-04-18 15:15:07 +08:00
Gobot is a framework and set of libraries 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.
Want to use Ruby or Javascript on robots? Check out our sister projects Artoo (http://artoo.io) and Cylon.js (http://cylonjs.com/)
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
## 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 (
"github.com/hybridgroup/gobot"
2014-06-09 11:28:17 +08:00
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/gpio"
"time"
2013-11-10 02:51:30 +08:00
)
func main() {
2014-06-09 11:28:17 +08:00
gbot := gobot.NewGobot()
2013-11-10 02:51:30 +08:00
2014-06-09 11:30:15 +08:00
adaptor := firmata.NewFirmataAdaptor("myFirmata", "/dev/ttyACM0")
led := gpio.NewLedDriver(adaptor, "myLed", "13")
2013-11-10 02:51:30 +08:00
2013-11-14 12:50:22 +08:00
work := func() {
2014-06-09 11:28:17 +08:00
gobot.Every(1*time.Second, func() {
led.Toggle()
2013-11-10 02:51:30 +08:00
})
}
2013-11-14 12:50:22 +08:00
2014-06-09 11:28:17 +08:00
gbot.Robots = append(gbot.Robots,
2014-06-09 11:30:15 +08:00
gobot.NewRobot("blink", []gobot.Connection{adaptor}, []gobot.Device{led}, work))
2013-11-10 02:51:30 +08:00
2014-06-09 11:28:17 +08:00
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-02-05 06:27:16 +08:00
"github.com/hybridgroup/gobot"
2014-06-09 11:28:17 +08:00
"github.com/hybridgroup/gobot/platforms/sphero"
"time"
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-06-09 11:28:17 +08:00
gbot := gobot.NewGobot()
2013-12-06 06:40:29 +08:00
2014-06-09 11:28:17 +08:00
adaptor := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0")
ball := sphero.NewSpheroDriver(adaptor, "sphero")
2014-02-05 06:27:16 +08:00
work := func() {
2014-06-09 11:28:17 +08:00
gobot.Every(3*time.Second, func() {
ball.Roll(30, uint16(gobot.Rand(360)))
2014-02-05 06:27:16 +08:00
})
}
2014-06-09 11:28:17 +08:00
gbot.Robots = append(gbot.Robots,
gobot.NewRobot("sphero", []gobot.Connection{adaptor}, []gobot.Device{ball}, work))
2014-02-05 06:27:16 +08:00
2014-06-09 11:28:17 +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:
2013-12-14 00:54:30 +08:00
2014-06-09 11:28:17 +08:00
- [Ardrone ](http://ardrone2.parrot.com/ ) < => [Library ](https://github.com/hybridgroup/tree/master/platforms/ardrone )
- [Arduino ](http://www.arduino.cc/ ) < => [Library ](https://github.com/hybridgroup/tree/master/platforms/firmata )
- [Beaglebone Black ](http://beagleboard.org/Products/BeagleBone+Black/ ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/beaglebone )
- [Joystick ](http://en.wikipedia.org/wiki/Joystick ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/joystick )
- [Digispark ](http://digistump.com/products/1 ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/digispark )
- [Joystick ](http://en.wikipedia.org/wiki/Joystick ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/joystick )
- [Leap Motion ](https://www.leapmotion.com/ ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/leapmotion )
- [Neurosky ](http://neurosky.com/products-markets/eeg-biosensors/hardware/ ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/neurosky )
- [OpenCV ](http://opencv.org/ ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/opencv )
- [Spark ](https://www.spark.io/ ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/spark )
- [Sphero ](http://www.gosphero.com/ ) < => [Library ](https://github.com/hybridgroup/tree/dev/platforms/sphero )
2013-12-14 00:54:30 +08:00
Support for many devices that use General Purpose Input/Output (GPIO) have
a shared set of drivers provded using the cylon-gpio module:
2014-06-09 11:28:17 +08:00
- [GPIO ](https://en.wikipedia.org/wiki/General_Purpose_Input/Output ) < => [Drivers ](https://github.com/hybridgroup/tree/dev/platforms/gpio )
2014-03-27 02:59:12 +08:00
- Analog Sensor
2013-12-14 00:54:30 +08:00
- Button
2014-03-27 02:59:12 +08:00
- Digital Sensor
2013-12-14 00:54:30 +08:00
- LED
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
drivers provded using the gobot-i2c module:
2014-06-09 11:28:17 +08:00
- [I2C ](https://en.wikipedia.org/wiki/I%C2%B2C ) < => [Drivers ](https://github.com/hybridgroup/tree/dev/platforms/i2c )
2014-03-27 02:59:12 +08:00
- BlinkM
- HMC6352
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-12-06 06:35:30 +08:00
## Getting Started
2014-06-09 11:28:17 +08:00
Install Gobot with: `go get -u github.com/hybridgroup/gobot`
2013-12-06 06:35:30 +08:00
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-09 11:28:17 +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
2013-12-06 06:35:30 +08:00
```go
2014-06-09 11:28:17 +08:00
master := gobot.NewGobot()
api.NewApi(master).Start()
2013-11-25 07:59:36 +08:00
```
2014-04-20 01:16:44 +08:00
You can also specify the api host and port, and turn on authentication:
```go
2014-06-09 11:28:17 +08:00
master := gobot.NewGobot()
server := api.NewApi(master)
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
2014-02-05 06:15:21 +08:00
In order to use the [robeaux ](https://github.com/hybridgroup/robeaux ) AngularJS interface with Gobot you simply clone the robeaux repo and place it in the directory of your Gobot program. The robeaux assets must be in a folder called `robeaux` .
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!
## Contributing
2014-04-29 20:27:25 +08:00
* All active development is in the `dev` branch. New or updated features must be added to the `dev` branch. Hotfixes will be considered on the `master` branch in situations where it does not alter behaviour or features, only fixes a bug.
2013-12-28 10:33:36 +08:00
* All patches must be provided under the Apache 2.0 License
2013-12-29 04:36:56 +08:00
* Please use the -s option in git to "sign off" that the commit is your work and you are providing it under the Apache 2.0 License
* Submit a Github Pull Request to the appropriate branch and ideally discuss the changes with us in IRC.
2013-12-28 10:33:36 +08:00
* We will look at the patch, test it out, and give you feedback.
* Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers from time to time but they can complicate merges and should be done seperately.
* Take care to maintain the existing coding style.
2014-04-29 20:27:25 +08:00
* `go fmt` your code.
2013-12-28 10:33:36 +08:00
* Add unit tests for any new or changed functionality.
2013-12-29 04:36:56 +08:00
* All pull requests should be "fast forward"
2013-12-28 10:33:36 +08:00
* If there are commits after yours use “git rebase -i < new_head_branch > ”
* If you have local changes you may need to use “git stash”
2013-12-29 04:36:56 +08:00
* For git help see [progit ](http://git-scm.com/book ) which is an awesome (and free) book on git
2013-12-28 10:33:36 +08:00
2013-11-10 02:51:30 +08:00
## License
2014-03-26 04:52:48 +08:00
Copyright (c) 2013-2014 The Hybrid Group. Licensed under the Apache 2.0 license.