SPL Gyroscope Sensor Module This Module provides an interface to the Gyroscope Sensor Board. The board has 16 channels and detects 3D translation and rotation. Compass sensors are also on board. Some board specific documentation: The sensor board can be connected through RS232 or USB. The board has 16 channels. To read a certain number of channels once, send: 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F or G as a character (note: from SPL use integers 1 to 16). The result comes back as 2 bytes per channel, unsigned, MSB first. (note: in SPL the result is an array with numbers) For example reading 3 channels can be done by sending '3'. Then a string with 6 characters can be read with 2 bytes for each channel. (note: in SPL it is done by sending 3 and receiving an array with 3 values). This module translates the integers 10 to 16 to the characters 'A' to 'G' before sending to the board. Received data is translated into an array of values. The number of elements corresponds to the number of channels requested. You can use gyro_prefetch_state to request a certain number of channels without waiting for the result. Then some other processing can be done before calling gyro_state which will read the prefetched state and thus return faster. However, using this method the time at which the values are valid is when calling gyro_prefetch_state, not gyro_state. In most cases the difference can be ignored unless there is heavy processing done between prefetch_state and state calls. Note: due to an unknown reason the first read result is bad and discardedbuiltin gyro_open(devicename);
Opens the serial (tty) device for communication. The single argument must be the full path to the device file. The return value is the file descriptor (fd) for the serial device. On failure, undef is returned. This file descriptor must be provided to all other gyro functions as first argument.
Sends a request to the device to read the state of given number of channels. This function does not wait for the result to be ready and returns immediately. Thus it can be used to avoid having to wait for the result when using gyro_state only.
Reads given number of channels from device. Returns an array with the read values.
Closes the serial device.
|Generated by SPLDOC.||http://www.clifford.at/spl/|