Documentation
¶
Overview ¶
Package roomba defines and implements the interface for interacting with iRobot Roomba Open Interface robots.
Index ¶
- func Pack(data []interface{}) []byte
- type Roomba
- func (this *Roomba) ButtonPush(button byte) error
- func (this *Roomba) Clean() error
- func (this *Roomba) Control() error
- func (this *Roomba) DirectDrive(right, left int16) error
- func (this *Roomba) Drive(velocity, radius int16) error
- func (this *Roomba) Full() error
- func (this *Roomba) LEDDisplay(data []byte) error
- func (this *Roomba) LEDs(check_robot, dock, spot, debris bool, power_color, power_intensity byte) error
- func (this *Roomba) MainBrush(on bool, defaultDir bool) error
- func (this *Roomba) Open(baud uint) error
- func (this *Roomba) Passive() error
- func (this *Roomba) PauseStream()
- func (this *Roomba) Play(num byte) error
- func (this *Roomba) Power() error
- func (this *Roomba) PulseBRC()
- func (this *Roomba) QueryList(packet_ids []byte) ([][]byte, error)
- func (this *Roomba) Read(p []byte) (n int, err error)
- func (this *Roomba) ReadStream(packet_ids []byte, out chan<- [][]byte)
- func (this *Roomba) Reset() error
- func (this *Roomba) Safe() error
- func (this *Roomba) SeekDock() error
- func (this *Roomba) Sensors(packet_id byte) ([]byte, error)
- func (this *Roomba) Song(num byte, notes ...byte) error
- func (this *Roomba) Spot() error
- func (this *Roomba) Start(keepAlive bool) error
- func (this *Roomba) Stop() error
- func (this *Roomba) Stream(packet_ids []byte) (<-chan [][]byte, error)
- func (this *Roomba) Write(opcode byte, p []byte) error
- func (this *Roomba) WriteByte(opcode byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Roomba ¶
type Roomba struct {
PortName string
S io.ReadWriter
StreamPaused chan bool
// contains filtered or unexported fields
}
func MakeRoomba ¶
func MakeRoomba(port_name string, brc *gpio.DirectPinDriver) (*Roomba, error)
MakeRoomba initializes a new Roomba structure and sets up a serial port. By default, Roomba communicates at 115200 baud. Providing a brc port will send periodic pulses to keep roomba alive in passive mode.
func (*Roomba) ButtonPush ¶
func (*Roomba) DirectDrive ¶
DirectDrive command lets you control the forward and backward motion of Roomba’s drive wheels independently. It takes two 16-bit signed values. The first specifies the velocity of the right wheel in millimeters per second (mm/s), The next one specifies the velocity of the left wheel A positive velocity makes that wheel drive forward, while a negative velocity makes it drive backward. Right wheel velocity (-500 – 500 mm/s). Left wheel velocity (-500 – 500 mm/s).
func (*Roomba) Drive ¶
Drive command controls Roomba’s drive wheels. It takes two 16-bit signed values. The first one specifies the average velocity of the drive wheels in millimeters per second (mm/s). The next one specifies the radius in millimeters at which Roomba will turn. The longer radii make Roomba drive straighter, while the shorter radii make Roomba turn more. The radius is measured from the center of the turning circle to the center of Roomba. A Drive command with a positive velocity and a positive radius makes Roomba drive forward while turning toward the left. A negative radius makes Roomba turn toward the right. Special cases for the radius make Roomba turn in place or drive straight. A negative velocity makes Roomba drive backward. Velocity is in range (-500 – 500 mm/s), radius (-2000 – 2000 mm). Special cases: straight = 32768 or 32767 = ex 8000 or 7FFF, turn in place clockwise = -1, turn in place counter-clockwise = 1
func (*Roomba) Full ¶
Full command gives you complete control over Roomba by putting the OI into Full mode, and turning off the cliff, wheel-drop and internal charger safety features.
func (*Roomba) LEDDisplay ¶
LEDDisplay displays data in the 7 segment display.
func (*Roomba) LEDs ¶
func (this *Roomba) LEDs(check_robot, dock, spot, debris bool, power_color, power_intensity byte) error
LEDs command controls the LEDs common to all models of Roomba 500. The Clean/Power LED is specified by two data bytes: one for the color and the other for the intensity. Color: 0 = green, 255 = red. Intermediate values are intermediate colors (orange, yellow, etc). Intensitiy: 0 = off, 255 = full intensity. Intermediate values are intermediate intensities.
func (*Roomba) PauseStream ¶
func (this *Roomba) PauseStream()
PauseStream command lets you stop steam without clearing the list of requested packets.
func (*Roomba) Play ¶
Play lets you select a song num to play from the songs added to Roomba using the Song command. You must add one or more songs to Roomba using the Song function in order for the Play command to work.
func (*Roomba) QueryList ¶
QueryList command lets you ask for a list of sensor packets. The result is returned once, as in the Sensors command. The robot returns the packets in / the order you specify.
func (*Roomba) ReadStream ¶
func (*Roomba) Safe ¶
Safe sends the OI into Safe mode, enabling user control of Roomba. It turns off all LEDs.
func (*Roomba) Sensors ¶
Sensors command requests the OI to send a packet of sensor data bytes. There are 58 different sensor data packets. Each provides a value of a specific sensor or group of sensors.
func (*Roomba) Start ¶
Start command starts the OI. You must always send the Start command before sending any other commands to the OI. Note: Use the Start command (128) to change the mode to Passive.
func (*Roomba) Stop ¶
This command stops the OI. All streams will stop and the robot will no longer respond to commands. Use this command when you are finished working with the robot.
func (*Roomba) Stream ¶
Stream command starts a stream of data packets. The list of packets requested is sent every 15 ms, which is the rate Roomba uses to update data. This method of requesting sensor data is best if you are controlling Roomba over a wireless network (which has poor real-time characteristics) with software running on a desktop computer.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package constants defines values for OpenInterface op codes, sensor codes and sensor packet lengths among others.
|
Package constants defines values for OpenInterface op codes, sensor codes and sensor packet lengths among others. |
|
Package sim defines a limited OpenInterface simulator type that's mainly used for testing.
|
Package sim defines a limited OpenInterface simulator type that's mainly used for testing. |