Elisa3
|
#include "sensors.h"
Functions | |
void | calibrateSensors () |
Calibrate all the sensors (proximity, ground and accelerometer). Pay attention for the robot to be positionated in a flat surface and that no objects obstruct the sensors. Peripherals need to be already initialized before calling this function. | |
void | initAccelerometer () |
Test which device is mounted on the robot and configure it. | |
unsigned char | initMMA7455L () |
Configure the MMA74565L accelerometer (2g sensitivity, 10 bits resolution). | |
unsigned char | initADXL345 () |
Configure the ADXL345 accelerometer (2g sensitivity, 10 bits resolution). | |
void | readAccelXY () |
Request the X and Y values (10 bit data, 2's complement) and save them in their respective global variables accX and accY. | |
void | readAccelXYZ () |
Request the X, Y and Z values (10 bit data, 2's complement) and save them in their respective global variables accX, accY and accZ. | |
void | readAccelXYZ_1 () |
void | readAccelXYZ_2 () |
void | computeAngle () |
Compute the angle of the robot using the X and Y axes; the resulting angle is saved in the global variable "currentAngle". The angle refers to a classical reference system where the 0 points to the right, 90 to the top, 180 to the left and 270 to the bottom in a vertical wall. In order for the angle to be computed correctly, the robot has to be calibrated leaving it flat on the ground. Moreover this function update the robot motion plane (horizontal or vertical) based on the Z axis; this information is then used to switch between horizontal and vertical speed controller. |
void calibrateSensors | ( | ) |
Calibrate all the sensors (proximity, ground and accelerometer). Pay attention for the robot to be positionated in a flat surface and that no objects obstruct the sensors. Peripherals need to be already initialized before calling this function.
void computeAngle | ( | ) |
Compute the angle of the robot using the X and Y axes; the resulting angle is saved in the global variable "currentAngle". The angle refers to a classical reference system where the 0 points to the right, 90 to the top, 180 to the left and 270 to the bottom in a vertical wall. In order for the angle to be computed correctly, the robot has to be calibrated leaving it flat on the ground. Moreover this function update the robot motion plane (horizontal or vertical) based on the Z axis; this information is then used to switch between horizontal and vertical speed controller.
void initAccelerometer | ( | ) |
Test which device is mounted on the robot and configure it.
unsigned char initADXL345 | ( | ) |
Configure the ADXL345 accelerometer (2g sensitivity, 10 bits resolution).
0 | configuration ok |
1 | communication error |
unsigned char initMMA7455L | ( | ) |
Configure the MMA74565L accelerometer (2g sensitivity, 10 bits resolution).
0 | configuration ok |
1 | communication error |
void readAccelXY | ( | ) |
Request the X and Y values (10 bit data, 2's complement) and save them in their respective global variables accX and accY.
void readAccelXYZ | ( | ) |
Request the X, Y and Z values (10 bit data, 2's complement) and save them in their respective global variables accX, accY and accZ.
void readAccelXYZ_1 | ( | ) |
void readAccelXYZ_2 | ( | ) |