06 Lesson. Calibration of the angular velocity sensor (AVS)
By default, AVS is not calibrated and outputs inaccurate values. As we already know from previous lessons, the satellite receives the necessary orientation information from the angular velocity sensor and magnetometer.
info
To learn more about the operation of the angular velocity sensor (AVS), follow the link: 02 Lesson. Getting to know the sensors.
For its calibration and further accurate operation, you can use the program below.
C++ code:
#include <stdio.h>
#include <stdint.h>
#include "libschsat.h"
void control(void){
float gyro_x = 0, gyro_y = 0, gyro_z = 0;
uint16_t tmp=0;
Sleep(1);
gyro_set_offset(tmp, gyro_x, gyro_y, gyro_z);
Sleep(1);
gyro_request_raw(tmp, &gyro_x, &gyro_y, &gyro_z);
printf("Before fix:\n %f %f %f", gyro_x, gyro_y, gyro_z);
Sleep(1);
gyro_set_offset(tmp, gyro_x, gyro_y, gyro_z);
Sleep(1);
gyro_request_raw(tmp, &gyro_x, &gyro_y, &gyro_z);
printf("\nAfter fix:\n %f %f %f \n", gyro_x, gyro_y, gyro_z);
uint8_t data[0];
send_unican_message(25, 2656, data, 0);
}
Python code:
from libschsat import Libschsat
import time
lib=Libschsat()
time.sleep(1)
lib.gyroSetOffset(0, 0, 0)
time.sleep(1)
gyro_x, gyro_y, gyro_z=lib.gyroRequestRaw(2)
print('Before fix ' + str(gyro_x) + '; ' + str(gyro_y) + '; ' + str(gyro_z))
lib.gyroSetOffset(gyro_x, gyro_y, gyro_z)
time.sleep(1)
gyro_x, gyro_y, gyro_z=lib.gyroRequestRaw(2)
print('After fix ' + str(gyro_x) + '; ' + str(gyro_y) + '; ' + str(gyro_z))
lib.sendMsgAndWaitAnswer('0xB60','0xF','0x19',0,[],'0x118')