func (r *Robots) Each(f func(*Robot)) {
	for _, robot := range *r {
		f(robot)
	}
}
Each enumerates through the Robots and calls specified callback function.
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
}