Common Lisp Package: NXT

README:

FUNCTION

Public

Undocumented

ACCELERATION-SENSOR-ON (PORT &KEY (NXT *NXT*))

ANGLE-SENSOR-ON (PORT &KEY (NXT *NXT*))

CLOSE-CONNECTION

COMPASS-ON (PORT &KEY (NXT *NXT*))

ENUMERATE-DIGITAL-SENSORS (&KEY (NXT *NXT*))

FIND-AN-NXT (&OPTIONAL (LOOK-FOR-TYPES '(USB BLUETOOTH)) (DEVICE *DEFAULT-BLUETOOTH-DEVICE*) (ERRORP T))

FIND-FRAME-PAIR (NAME &OPTIONAL (ERRORP T))

SETFFIND-FRAME-PAIR (NEWVAL NAME)

FIND-USB-NXT

GET-ACCELERATION (PORT &KEY (NXT *NXT*))

GET-ACCUMULATED-ANGLE (PORT &KEY (NXT *NXT*))

GET-ANGLE-SENSOR-DATA (PORT &KEY (NXT *NXT*))

GET-BRIGHTNESS-OR-COLOR (PORT &KEY (NXT *NXT*))

GET-COMPASS (PORT &KEY (NXT *NXT*) (UNIT DEGREE))

GET-CURRENT-ANGLE (PORT &KEY (NXT *NXT*))

GET-RPM (PORT &KEY (NXT *NXT*))

GET-SWITCH (PORT &KEY (NXT *NXT*))

GET-ULTRASONIC (PORT &KEY (NXT *NXT*))

LIGHT-OFF (PORT &KEY (NXT *NXT*))

LIGHTDETECTOR-ON (PORT &KEY (COLOR FULL) (NXT *NXT*))

LIST-ALL-COMMANDS (&OPTIONAL APROPOS)

MOTOR-CONTROL (FIRST-MOTOR SECOND-MOTOR &KEY (NXT *NXT*) (POWER 0) (TACHO-LIMIT NIL) SPEED-REGULATION-P (ACTION-AT-TACHO-LIMIT BRAKE) SMOOTH-START-P)

MOTOR-READY-P (PORT &KEY (NXT *NXT*))

NXT-CLOSE (&KEY HANDLE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-CLOSE-MODULE-HANDLE (&KEY HANDLE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-DELETE (&KEY FILE-NAME (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-FIND-FIRST (&KEY FILE-NAME (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-FIND-NEXT (&KEY HANDLE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-GET-BATTERY-LEVEL (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-GET-CURRENT-PROGRAM-NAME (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-GET-DEVICE-INFO (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-GET-FIRMWARE-VERSION (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-GET-INPUT-VALUES (&KEY INPUT-PORT (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-GET-OUTPUT-STATE (&KEY OUTPUT-PORT (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-KEEP-ALIVE (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-LS-GET-STATUS (&KEY PORT (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-LS-READ (&KEY PORT (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-LS-WRITE (&KEY PORT RX-DATA-LENGTH TX-DATA (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-MESSAGE-READ (&KEY REMOTE-INBOX LOCAL-INBOX REMOVE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-MESSAGE-WRITE (&KEY INBOX MESSAGE-DATA (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-OPEN-READ (&KEY FILE-NAME (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-OPEN-WRITE (&KEY FILE-NAME FILE-SIZE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-PLAY-SOUND-FILE (&KEY LOOP FILE-NAME (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-PLAY-TONE (&KEY FREQUENCY DURATION (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-READ (&KEY HANDLE NR-OF-BYTES (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-REQUEST-FIRST-MODULE (&KEY RESOURCE-NAME (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-REQUEST-NEXT-MODULE (&KEY HANDLE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-RESET-INPUT-SCALED-VALUE (&KEY INPUT-PORT (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-RESET-MOTOR-POSITION (&KEY OUTPUT-PORT RELATIVE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-SET-INPUT-MODE (&KEY INPUT-PORT SENSOR-TYPE SENSOR-MODE (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-SET-OUTPUT-STATE (&KEY OUTPUT-PORT POWER-SET-POINT MODE REGULATION-MODE TURN-RATIO RUN-STATE TACHO-LIMIT (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-START-PROGRAM (&KEY FILE-NAME (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-STOP-PROGRAM (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-STOP-SOUND-PLAYBACK (&KEY (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

NXT-WRITE (&KEY HANDLE DATA (NXT *NXT*) (ONEWAYP NIL) (RETURN-STYLE ALIST) CHECK-STATUS)

OPEN-BLUETOOTH-NXT (DEVICE &KEY (IF-DOES-NOT-EXIST ERROR))

OPEN-CONNECTION (&OPTIONAL (LOOK-FOR-TYPES '(USB BLUETOOTH)) (DEVICE *DEFAULT-BLUETOOTH-DEVICE*))

PERFORM-COMMAND (NXT FP ONEWAYP RETURN-STYLE EXPECTED-STATUS ARGS)

PROBE-DIGITAL-SENSOR (PORT &KEY (NXT *NXT*))

QUERY-MOTOR (PORT &REST KEYS &KEY (NXT *NXT*) RESULT-STYLE ASSERT-STATUS)

RESTART-MOTOR-CONTROL (&KEY (NXT *NXT*))

RUNNING-A-PROGRAM-P (&OPTIONAL (NXT *NXT*))

SHOW-COMMAND (FP)

SHOW-COMMANDS (&OPTIONAL APROPOS)

SLEEP-UNTIL-MOTOR-READY (PORT &KEY (NXT *NXT*))

START-PROGRAM (PROGRAM-NAME &KEY (NXT *NXT*) (STOP-AND-WAIT-P T))

STOP-CURRENT-PROGRAM (&KEY (NXT *NXT*) (WAITP T))

STOP-MOTOR (PORT &KEY (NXT *NXT*))

SWITCH-ON (PORT &KEY (NXT *NXT*))

ULTRASONIC-ON (PORT &KEY SINGLE-SHOT-P (NXT *NXT*))

Private

+& (A B)

adds numbers, but lets symbols fall through

N-STATIC-BYTES (FI)

Cached length of the frame, excluding variable-length DATA, but including fixed-length DATA (and, of course, also including the length parameter which DATA refers to, if any).

PI-END (P)

The offset of the first byte following the parameter. Returns :unknown if the end is not known (for a DATA-PARAMETER).

PI-LAST-BYTE (P)

The offset of the parameter's last byte, i.e. the byte preceding PI-END. Returns :unknown if the end is not known (for a DATA-PARAMETER).

READ-LITTLE-ENDIAN-SHORT (STREAM)

Read a 16 bit int from the nxt, lsb first.

READ-UBYTE-FROM-REPLY (VECTOR LOCATION)

Extract unsigned byte value from the reply vector `vector' at location `location'.

WRITE-TO-NXT-US (SHORT STREAM)

Write a 16 bit int to the nxt lsb first.

WRITE-UBYTE-TO-COMMAND (VECTOR VALUE LOCATION)

Put the value `value' in the command vector `vector' at location `location'.

Undocumented

%COMPUTE-BLUETOOTH-TIMEOUT (TIMESTAMP DELAY)

ARGNAMES-FROM-ARGS (ARGS)

CALL-WITH-MOTOR-DELAYS (FUN NXT PORT)

CHECK-MOTOR-CONTROL-PORTS (A B)

CHECK-OFFSETS (PARAMETERS)

CLEAR-ALL

COMPUTE-MOTOR-TIMEOUT (MOTORS)

COMPUTE-TIMEOUT (S)

COPY-FILE-FROM-NXT (FILE-NAME-NXT FILE-NAME)

COPY-FILE-TO-NXT (FILE-NAME FILE-NAME-NXT)

CREATE-NXT-COMMAND-FORM (NAME TYPE-CODE COMMAND-CODE &REST ARGS)

ENCODE-FRAME (TC CC FI ARGS)

ENCODE-MOTOR-CONTROL-PORTS (A B)

ENSURE-FRAME-PAIR (NAME TYPE-CODE COMMAND-CODE)

ENSURE-LIBUSB-INITIALIZED

ENSURE-LIBUSB-LOADED

ENSURE-MESSAGE-READ (NXT REMOTE-INBOX LOCAL-INBOX REMOVE)

EXIT-LIBUSB

FI-NBYTES (FI ARGUMENTS)

FIND-ALL-FILES

FIND-ALL-MODULES

GET-CALIBRATED-VALUE (PORT &KEY (NXT *NXT*))

GET-FILE (FILE-NAME)

GET-NORMALIZED-VALUE (PORT &KEY (NXT *NXT*))

GET-SCALED-VALUE (PORT &KEY (NXT *NXT*))

GET-VALID-INPUT-VALUES (PORT &KEY (NXT *NXT*) (TIMEOUT 1))

LIBUSB_BULK_TRANSFER (DEVICE ENDPOINT DATA LENGTH TRANSFERRED TIMEOUT)

LIBUSB_CLAIM_INTERFACE (DEVICE IFACE)

LIBUSB_CLOSE (DEVICE)

LIBUSB_EXIT (CONTEXT)

LIBUSB_INIT (&CONTEXT)

LIBUSB_OPEN_DEVICE_WITH_VID_PID (CONTEXT VENDOR DEVICE)

LIBUSB_RELEASE_INTERFACE (DEVICE IFACE)

LIBUSB_SET_CONFIGURATION (DEVICE CONFIGURATION)

LOOKUP-COMMAND-CODE (COMMAND-CODE)

LS-READ (&REST KEYS)

NOTE-DATA-READ (NXT)

NOTE-DATA-WRITTEN (NXT)

NOTE-MOTOR-COMMANDED (MOTOR)

PARSE-FRAME-INFO (SPECS)

PARSE-PARAMETER-SPEC (NAME SPEC)

PARSE-PARAMETER-SPECS (SPECS)

PUT-FILE (FILE-NAME DATA)

READ-I2C (PORT RX-LEN DEVICE REGISTER &KEY (NXT *NXT*))

READ-REPLY (NXT CC FI)

READ-REPLY/CHECKED (NXT CC FI RETURN-STYLE EXPECTED-STATUS)

READ-ULONG-FROM-REPLY (VECTOR LOCATION)

READ-UWORD-FROM-REPLY (VECTOR LOCATION)

SEND-STRING-MESSAGE (INBOX MESSAGE &KEY (NXT *NXT*) (CHECK-STATUS SUCCESS))

SHOW-FRAME-INFO (FI)

SIGN-EXTEND (BITS VALUE)

STATUS-OK-P (REPLY)

TIMEOUTP (ABS-TIMEOUT)

UB8-VECTOR (&REST ARGS)

VALUE-OF (KEY ASSOC)

VARIABLE-LENGTH-FRAME-P (FI)

WAIT-FOR-BLUETOOTH (NXT DELAY-TYPE)

WRITE-REQUEST (NXT TC CC FI ONEWAYP ARGS)

WRITE-ULONG-TO-COMMAND (VECTOR VALUE LOCATION)

WRITE-UWORD-TO-COMMAND (VECTOR VALUE LOCATION)

MACRO

Private

DEF-NXT-COMMAND (NAME NAME-CODE TYPE-CODE &REST REST)

Creates the command function `name' which is a nxt command with the two command identification bytes `type-code' and `command-code'. The `args' contains key value pairs that should be taken by the function together with a type specifier. Type specifiers are lists of the form (`type' `position' rest). The type is one of ubyte - unsigned byte uword - unsigned word (2 bytes) ulong - unsigned long (4 bytes) string - has additional parameter, `final-position'.

DEF-REPLY-PACKAGE (CODE &REST REST)

Creates a `parse-nxt-reply' specialized `(eql code)' to parse a nxt reply package. The method `(parse-nxt-reply ((code (eql code)) (data vector)) ...)' ...

Undocumented

DEFCFUN (NAME RET &REST ARGS)

WITH-MOTOR-DELAYS ((NXT PORT) &BODY BODY)

GENERIC-FUNCTION

Public

Undocumented

CLOSE-NXT (NXT)

Private

Undocumented

COMPUTE-BLUETOOTH-TIMEOUT (NXT DELAY-TYPE)

DECODE-PARAMETER (PARAM VECTOR)

ENCODE-PARAMETER (PARAM VAL INTO-VECTOR)

READ-FROM-NXT (NXT)

WRITE-TO-NXT (NXT DATA-VECTOR)

SLOT-ACCESSOR

Private

PI-NBYTES (PARAM)

The Returns the length in bytes occupied this parameter. The exception is if a 'data' spec is present. The data is variable length and is not accounted for. However, if the size of the data is stored in the frame, the ubyte where the length of the data is stored IS taken into account.

SETFPI-NBYTES (NEW-VALUE OBJECT)

Set the Returns the length in bytes occupied this parameter. The exception is if a 'data' spec is present. The data is variable length and is not accounted for. However, if the size of the data is stored in the frame, the ubyte where the length of the data is stored IS taken into account.

Undocumented

%N-STATIC-BYTES (OBJECT)

SETF%N-STATIC-BYTES (NEW-VALUE OBJECT)

BUF (OBJECT)

SETFBUF (NEW-VALUE OBJECT)

COMMAND-TIMESTAMP (OBJECT)

SETFCOMMAND-TIMESTAMP (NEW-VALUE OBJECT)

CONNECTION (OBJECT)

SETFCONNECTION (NEW-VALUE OBJECT)

FI-EXPLICIT-PARAMETERS (OBJECT)

SETFFI-EXPLICIT-PARAMETERS (NEW-VALUE OBJECT)

FI-PARAMETERS (OBJECT)

SETFFI-PARAMETERS (NEW-VALUE OBJECT)

FP-COMMAND-CODE (OBJECT)

SETFFP-COMMAND-CODE (NEW-VALUE OBJECT)

FP-NAME (OBJECT)

SETFFP-NAME (NEW-VALUE OBJECT)

FP-REPLY (OBJECT)

SETFFP-REPLY (NEW-VALUE OBJECT)

FP-REQUEST (OBJECT)

SETFFP-REQUEST (NEW-VALUE OBJECT)

FP-TYPE-CODE (OBJECT)

SETFFP-TYPE-CODE (NEW-VALUE OBJECT)

HANDLE (OBJECT)

SETFHANDLE (NEW-VALUE OBJECT)

MOTOR-STATES (OBJECT)

SETFMOTOR-STATES (NEW-VALUE OBJECT)

PI-ADJUST-SIZE (OBJECT)

SETFPI-ADJUST-SIZE (NEW-VALUE OBJECT)

PI-NAME (OBJECT)

SETFPI-NAME (NEW-VALUE OBJECT)

PI-OFFSET (OBJECT)

SETFPI-OFFSET (NEW-VALUE OBJECT)

PI-SIZE-PARAMETER (OBJECT)

SETFPI-SIZE-PARAMETER (NEW-VALUE OBJECT)

READ-TIMESTAMP (OBJECT)

SETFREAD-TIMESTAMP (NEW-VALUE OBJECT)

SIZE-PARAMETER-P (PARAMETER)

SETFSIZE-PARAMETER-P (NEW-VALUE OBJECT)

WRITE-TIMESTAMP (OBJECT)

SETFWRITE-TIMESTAMP (NEW-VALUE OBJECT)

VARIABLE

Public

*NXT*

Holds the default NXT instance (which functions use by default, if no explicit NXT parameter is given. Replaces the old *connection* variable.

Undocumented

*DEFAULT-BLUETOOTH-DEVICE*

Private

*BLUETOOTH-DELAY-BETWEEN-DIRECTIONS*

Required delay in seconds when switching between reading from and writing to the brick in either direction.

*BLUETOOTH-DELAY-BETWEEN-WRITES*

Required delay in seconds between successive writes to the brick.

Undocumented

*CODE-TO-INFO-TABLE*

*LIBUSB-CONTEXT*

*LIBUSB-LOADED-P*

*MOTOR-CONTROL-FILENAME*

*START/STOP-PROGRAM-TIMEOUT*

*STATUS-VALUES*

*USB-TIMEOUT*

CLASS

Public

NXT

Common superclass of BLUETOOTH-NXT and USB-NXT.

Undocumented

BLUETOOTH-NXT

USB-NXT

Private

DATA-PARAMETER/FIXED-LENGTH

A data parameter which is specified as fixed-length in the protocol. This kind of parameter does not have a size field on the wire.

DATA-PARAMETER/IMPLICIT-LENGTH

A data parameter which is variable-length, but does not have a size field on the wire. This type of parameter can occur only at the end of a frame.

DATA-PARAMETER/SPECIFIED-LENGTH

A data parameter which is variable-length, but and stores its size (plus the value of adjust-size) in a second parameter, the size-parameter, which must precede the data.

Undocumented

DATA-PARAMETER

FRAME-INFO

FRAME-PAIR

MOTOR-STATE

NBYTES-MIXIN

NUMERIC-PARAMETER

PARAMETER-INFO

SBYTE-PARAMETER

SLONG-PARAMETER

STATUS-PARAMETER

STRING-PARAMETER

SWORD-PARAMETER

UBYTE-PARAMETER

ULONG-PARAMETER

UWORD-PARAMETER

VARIABLE-LENGTH-DATA-PARAMETER

CONSTANT

Private

Undocumented

+ANGLE+

+ANGLESTEP-MODE+

+BOOLEAN-MODE+

+CELSIUS-MODE+

+CONTINUOUS+

+CUSTOM+

+DEFAULT-I2C-ADDRESS+

+FAHRENHEIT-MODE+

+LIGHT-ACTIVE+

+LIGHT-INACTIVE+

+LOWSPEED+

+LOWSPEED-9V+

+MODE-MASK+

+NO-SENSOR+

+NXC-DELAY+

+PCT-FULL-SCALE-MODE+

+PERIOD-COUNTER-MODE+

+RAW-MODE+

+REFLECTION+

+SINGLE-SHOT+

+SLOPE-MASK+

+SOUND-DB+

+SOUND-DBA+

+STATE-COMMAND+

+SWITCH+

+TEMPERATURE+

+TRANSITION-CNT-MODE+

+USB-CONFIGURATION+

+USB-INTERFACE+

+USB-MAXIMUM-FRAME-SIZE+

+USB-RECV-ENDPOINT+

+USB-SEND-ENDPOINT+