sim

package
v0.0.0-...-2bc8909 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sim defines a limited OpenInterface simulator type that's mainly used for testing.

Simulator can be created using MakeRoombaSim() function, which returns a simulator instance and a ReadWriter, suitable for passing to go-roomba client.

Index

Constants

This section is empty.

Variables

View Source
var MockSensorValues = map[byte][]byte{
	constants.SENSOR_BUMP_WHEELS_DROPS:       []byte{3},
	constants.SENSOR_VIRTUAL_WALL:            []byte{5},
	constants.SENSOR_CLIFF_RIGHT:             []byte{42},
	constants.SENSOR_TEMPERATURE:             []byte{25},
	constants.SENSOR_OI_MODE:                 []byte{2},
	constants.SENSOR_SONG_NUMBER:             []byte{1},
	constants.SENSOR_DISTANCE:                []byte{10, 20},
	constants.SENSOR_WALL:                    []byte{35},
	constants.SENSOR_BATTERY_CHARGE:          roomba.Pack([]interface{}{uint16(1000)}),
	constants.SENSOR_BATTERY_CAPACITY:        roomba.Pack([]interface{}{uint16(1500)}),
	constants.SENSOR_CURRENT:                 roomba.Pack([]interface{}{int16(-747)}),
	constants.SENSOR_CLIFF_FRONT_LEFT_SIGNAL: roomba.Pack([]interface{}{uint8(2), uint8(25)}),
}

MockSensorValues contains mapping of sensor codes to sensor values returned by a RoombaSimulator object on sensor requests.

Functions

This section is empty.

Types

type RoombaSimulator

type RoombaSimulator struct {
	WrittenBytes bytes.Buffer // Logs all the bytes written by the simulator to its Writer.
	ReadBytes    bytes.Buffer // Logs all the bytes read by the simulator from its Reader.

	RequestedVelocity []byte
	RequestedRadius   []byte
	// contains filtered or unexported fields
}

Roomba simulator instance. Should be constructed with MakeRoombaSim() function.

func MakeRoombaSim

func MakeRoombaSim() (*RoombaSimulator, *readWriter)

func (*RoombaSimulator) Stop

func (sim *RoombaSimulator) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL