func (r *Robot) Start() (errs []error) {
	log.Println("Starting Robot", r.Name, "...")
	if cerrs := r.Connections().Start(); len(cerrs) > 0 {
		errs = append(errs, cerrs...)
		return
	}
	if derrs := r.Devices().Start(); len(derrs) > 0 {
		errs = append(errs, derrs...)
		return
	}
	if r.Work != nil {
		log.Println("Starting work...")
		r.Work()
	}
	return
}
Start a Robot's Connections, Devices, and work.
package gobot
import (
	"fmt"
	"log"
)
type JSONRobot struct {
	Name        string            `json:"name"`
	Commands    []string          `json:"commands"`
	Connections []*JSONConnection `json:"connections"`
	Devices     []*JSONDevice     `json:"devices"`
}
func NewJSONRobot(robot *Robot) *JSONRobot {
	jsonRobot := &JSONRobot{
		Name:        robot.Name,
		Commands:    []string{},
		Connections: []*JSONConnection{},
		Devices:     []*JSONDevice{},
	}
	for command := range robot.Commands() {
		jsonRobot.Commands = append(jsonRobot.Commands, command)
	}
	robot.Devices().Each(func(device Device) {
		jsonDevice := NewJSONDevice(device)
		jsonRobot.Connections = append(jsonRobot.Connections, NewJSONConnection(robot.Connection(jsonDevice.Connection)))
		jsonRobot.Devices = append(jsonRobot.Devices, jsonDevice)
	})
	return jsonRobot
}
type Robot struct {
	Name        string
	Work        func()
	connections *Connections
	devices     *Devices
	Commander
	Eventer
}
type Robots []*Robot
func (r *Robots) Len() int {
	return len(*r)
}
func (r *Robots) Start() (errs []error) {
	for _, robot := range *r {
		if errs = robot.Start(); len(errs) > 0 {
			for i, err := range errs {
				errs[i] = fmt.Errorf("Robot %q: %v", robot.Name, err)
			}
			return
		}
	}
	return
}
func (r *Robots) Stop() (errs []error) {
	for _, robot := range *r {
		if errs = robot.Stop(); len(errs) > 0 {
			for i, err := range errs {
				errs[i] = fmt.Errorf("Robot %q: %v", robot.Name, err)
			}
			return
		}
	}
	return
}
func (r *Robots) Each(f func(*Robot)) {
	for _, robot := range *r {
		f(robot)
	}
}
func NewRobot(name string, v ...interface{}) *Robot {
	if name == "" {
		name = fmt.Sprintf("%X", Rand(int(^uint(0)>>1)))
	}
	r := &Robot{
		Name:        name,
		connections: &Connections{},
		devices:     &Devices{},
		Work:        nil,
		Eventer:     NewEventer(),
		Commander:   NewCommander(),
	}
	log.Println("Initializing Robot", r.Name, "...")
	for i := range v {
		switch v[i].(type) {
		case []Connection:
			log.Println("Initializing connections...")
			for _, connection := range v[i].([]Connection) {
				c := r.AddConnection(connection)
				log.Println("Initializing connection", c.Name(), "...")
			}
		case []Device:
			log.Println("Initializing devices...")
			for _, device := range v[i].([]Device) {
				d := r.AddDevice(device)
				log.Println("Initializing device", d.Name(), "...")
			}
		case func():
			r.Work = v[i].(func())
		}
	}
	return r
}