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-03-26 04:52:48 +08:00
Gobot is a set of libraries for robotics, physical computing, and the Internet of Things, using the Go programming language (http://golang.org/)
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/)
2013-12-03 17:28:55 +08:00
[![Build Status ](https://travis-ci.org/hybridgroup/gobot.png?branch=master )](https://travis-ci.org/hybridgroup/gobot)
2013-11-10 02:51:30 +08:00
## Examples
2013-12-06 06:40:29 +08:00
### Basic
2013-11-10 02:51:30 +08:00
2013-12-06 06:40:29 +08:00
#### Go with a Sphero
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"
"github.com/hybridgroup/gobot-sphero"
)
func main() {
spheroAdaptor := new(gobotSphero.SpheroAdaptor)
spheroAdaptor.Name = "Sphero"
2013-12-04 08:13:18 +08:00
spheroAdaptor.Port = "/dev/rfcomm0"
2013-11-10 02:51:30 +08:00
sphero := gobotSphero.NewSphero(spheroAdaptor)
sphero.Name = "Sphero"
2013-11-14 12:50:22 +08:00
work := func() {
gobot.Every("2s", func() {
2013-12-04 08:13:18 +08:00
sphero.Roll(100, uint16(gobot.Rand(360)))
2013-11-10 02:51:30 +08:00
})
}
2013-11-14 12:50:22 +08:00
2013-11-10 02:51:30 +08:00
robot := gobot.Robot{
2014-02-05 06:27:16 +08:00
Connections: []gobot.Connection{spheroAdaptor},
Devices: []gobot.Device{sphero},
2013-11-14 12:50:22 +08:00
Work: work,
2013-11-10 02:51:30 +08:00
}
robot.Start()
}
```
2013-12-06 06:40:29 +08:00
#### Go with a Blink
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"
"github.com/hybridgroup/gobot-firmata"
"github.com/hybridgroup/gobot-gpio"
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-02-05 06:27:16 +08:00
firmata := new(gobotFirmata.FirmataAdaptor)
firmata.Name = "firmata"
firmata.Port = "/dev/ttyACM0"
led := gobotGPIO.NewLed(firmata)
led.Name = "led"
led.Pin = "13"
work := func() {
gobot.Every("1s", func() {
led.Toggle()
})
}
robot := gobot.Robot{
Connections: []gobot.Connection{firmata},
Devices: []gobot.Device{led},
Work: work,
}
robot.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
- [Arduino ](http://www.arduino.cc/ ) < ==> [Library ](https://github.com/hybridgroup/gobot-firmata )
2013-11-10 02:51:30 +08:00
- [Beaglebone Black ](http://beagleboard.org/Products/BeagleBone+Black/ ) < => [Library ](https://github.com/hybridgroup/gobot-beaglebone )
2013-11-14 00:20:47 +08:00
- [Digispark ](http://digistump.com/products/1 ) < => [Library ](https://github.com/hybridgroup/gobot-digispark )
2013-12-07 01:37:52 +08:00
- [Firmata ](http://firmata.org/wiki/Main_Page ) < => [Library ](https://github.com/hybridgroup/gobot-firmata )
2013-12-14 00:54:30 +08:00
- [Leap Motion ](https://www.leapmotion.com/ ) < => [Library ](https://github.com/hybridgroup/gobot-leap )
- [Spark ](https://www.spark.io/ ) < => [Library ](https://github.com/hybridgroup/gobot-spark )
- [Sphero ](http://www.gosphero.com/ ) < => [Library ](https://github.com/hybridgroup/gobot-sphero )
Support for many devices that use General Purpose Input/Output (GPIO) have
a shared set of drivers provded using the cylon-gpio module:
- [GPIO ](https://en.wikipedia.org/wiki/General_Purpose_Input/Output ) < => [Drivers ](https://github.com/hybridgroup/gobot-gpio )
2014-03-28 02:34:20 +08:00
- Analog Sensor
2013-12-14 00:54:30 +08:00
- Button
- LED
2014-03-28 02:34:20 +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:
- [I2C ](https://en.wikipedia.org/wiki/I%C2%B2C ) < => [Drivers ](https://github.com/hybridgroup/gobot-i2c )
- 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
Install the library with: `go get -u github.com/hybridgroup/gobot`
Then install additional libraries for whatever hardware support you want to use from your robot. For example, `go get -u github.com/hybridgroup/gobot-sphero` to use Gobot with a Sphero.
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.
To activate the API, use the `Api` command like this:
2013-12-06 06:35:30 +08:00
```go
2013-11-25 08:24:32 +08:00
master := gobot.GobotMaster()
2013-11-25 07:59:36 +08:00
gobot.Api(master)
```
To specify the api port run your Gobot program with the `PORT` environment variable
```
$ PORT=8080 go run gobotProgram.go
```
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
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.
* 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.