Class «gyroscope»

This article is automatically translated from Russian by Google Translator.

Represents the gyroscope of the TRIK controller. At rest, the average value of the gyroscope output is not zero and is called a bias or bias error.

The parameter is determined by many factors and can vary, for example, depending on the ambient temperature.

In order for the gyroscope to work properly it is necessary to subtract the zero offset from the incoming values. This can be calculated using the "calibrate" method.

Since calibration takes a long time, if you run the model frequently, you can do it once, then store the value in a variable with "getCalibrationVaules", and call "setCalibrationValues" instead of calibration when you run the program.

Method

Description

Calculates a zero offset within a specified time and initializes the gyroscope with this parameter, resets the current tilt angles.

Returns an object that contains the necessary zero-offset data.

Returns true if calibration is complete, false otherwise.

Returns an array of seven elements: angular velocities on the three axes, time of the last measurement, tilt angles on the three axes.

Returns an array of three elements with angular velocities on the three axes.

Sets the object containing the necessary parameters about the zero offset.

Сигнал

Описание

The signal sent by the sensor after the end of the calibration.

The signal sent by the sensor when it has new data ready.

calibrate

Calculates a zero offset within a specified time and initializes the gyroscope with this parameter, resets the current tilt angles. The recommended calibration time is 10-20 seconds.

Syntax

brick.gyroscope().calibrate(msec);

Parameter:

  • msec — time in milliseconds.

calibrationFinished

The signal sent by the sensor after the end of the calibration.

getCalibrationValues

Returns an object that contains the necessary zero-offset data.

Syntax

brick.gyroscope().getCalibrationValues();

isCalibrated

Returns true if calibration is complete, false otherwise.

Syntax

brick.gyroscope().isCalibrated();

newData

The signal sent by the sensor when it has new data ready.

read

Returns an array of seven elements:

  • 0−2 — angular velocities on the three axes (in milligrades/seconds),

  • 3 — a time of the last measurement (in microseconds),

  • 4−6 — tilt angles on the three axes (in milligrads).

Syntax

brick.gyroscope().read();

readRawData

Returns an array of three elements with angular velocities on the three axes.

Syntax

brick.gyroscope().readRawData();

setCalibrationValues

Sets the object containing the necessary parameters about the zero offset.

Since calibration takes a long time, if you run the model frequently, you can do it once, then store the value in a variable with "getCalibrationVaules", and call "setCalibrationValues" instead of calibration when you run the program.

Syntax

brick.gyroscope().setCalibrationValues(values);

Parameter:

  • values — object containing bias data.

Last updated