Angular velocity sensor
Virtual consumption - 40mA

Picture 1. Angular velocity sensor
Angular velocity sensor (AVS) allows you to measure the current angular velocities of the device along three axes (Picture 1). Depending on the location of the sensor, one of these readings, namely, the speed of rotation around the thread, will be critical for controlling the device, and the other two will help to assess the fluctuations of its center of mass relative to the local vertical, which can also be used in control.
tip
The angular velocity determined by the sensor is 0.00875 degrees/second per unit RAW (see function library, hyro_request_raw).
Example code for checking the angular velocity sensor in C
#include "libschsat.h"
/*
** Lab 3: get a raw data from a hyro
*/
void control(void)
{
int i;
const int num = 1; /* hyro #1 */
printf("Enable hyro #%d\n", num);
hyro_turn_on(num);
Sleep(1);
printf("Get RAW data from hyro #%d\n", num);
for (i = 0; i < 10; i++) {
int16_t x, y, z;
if (LSS_OK == hyro_request_raw(num, &x, &y, &z)) {
printf("%d: x=%d y=%d z=%d\n", i, x, y, z);
} else {
puts("Fail!");
}
Sleep(1);
}
printf("Disable hyro #%d\n", num);
hyro_turn_off(num);
}
Example code for checking the angular velocity sensor in Python
def control(): # The main function of the program in which to call the rest of the functions
hyro_result = [0,0,0,0] # Initialize hyro_result
num = 1 # AVS
print number "Enable angular velocity sensor No.", num
hyro_turn_on(num) # Enabling AVS
sleep(1) # Waiting for 1 second to turn on
print "Get RAW data from angular velocity sensor"
for i in range(10): #Read the readings 10 times
hyro_result = hyro_request_raw(num) #writing the response of the hyro_request_raw function to the hyro_result variable
if not hyro_result[0]: # if the sensor did not return an error message,
print "state:", hyro_result[0], "x_raw =", hyro_result[1], "y_raw =", hyro_result[2], "z_raw =", hyro_result[3] # We output the data
elif hyro_result[0] == 1: # if the sensor returned an error message of 1
print "Fail because of access error, check the connection"
elif hyro_result[0] == 2: # if the sensor returned an error message 2
print "Fail because of interface error, check your code"
sleep(1) # Readings are read once per second
print "Disable angular velocity sensor No.", num
hyro_turn_off(num) # Turn off AVS
``