Firmware for Arduino | PLEN Project Company Inc.
PLEN2::AccelerationGyroSensor Class Reference

Management class of acceleration and gyro sensor. More...

#include <AccelerationGyroSensor.h>

Public Member Functions

bool sampling ()
 Do sampling sensor values. More...
 
const int16_t & getAccX ()
 Get acceleration on X axis. More...
 
const int16_t & getAccY ()
 Get acceleration on Y axis. More...
 
const int16_t & getAccZ ()
 Get acceleration on Z axis. More...
 
const int16_t & getGyroRoll ()
 Get angular velocity of roll axis (rotation axis on X axis) More...
 
const int16_t & getGyroPitch ()
 Get angular velocity of pitch axis (rotation axis on Y axis) More...
 
const int16_t & getGyroYaw ()
 Get angular velocity of yaw axis (rotation axis on Z axis) More...
 
void dump ()
 Dump all sensors' value after sampling. More...
 

Detailed Description

Management class of acceleration and gyro sensor.

Member Function Documentation

void PLEN2::AccelerationGyroSensor::dump ( )

Dump all sensors' value after sampling.

Output result in JSON format as below.

{
"Acc X": <integer>,
"Acc Y": <integer>,
"Acc Z": <integer>,
"Gyro Roll": <integer>,
"Gyro Pitch": <integer>,
"Gyro Yaw": <integer>
}
const int16_t& PLEN2::AccelerationGyroSensor::getAccX ( )

Get acceleration on X axis.

Returns
Acceleration on X axis
Attention
Return the value cached at the runtime of the sampling method.
const int16_t& PLEN2::AccelerationGyroSensor::getAccY ( )

Get acceleration on Y axis.

Returns
Acceleration on Y axis
Attention
Return the value cached at the runtime of the sampling method.
const int16_t& PLEN2::AccelerationGyroSensor::getAccZ ( )

Get acceleration on Z axis.

Returns
Acceleration on Z axis
Attention
Return the value cached at the runtime of the sampling method.
const int16_t& PLEN2::AccelerationGyroSensor::getGyroPitch ( )

Get angular velocity of pitch axis (rotation axis on Y axis)

Returns
Angular velocity of pitch axis
Attention
Return the value cached at the runtime of the sampling method.
const int16_t& PLEN2::AccelerationGyroSensor::getGyroRoll ( )

Get angular velocity of roll axis (rotation axis on X axis)

Returns
Angular velocity of roll axis
Attention
Return the value cached at the runtime of the sampling method.
const int16_t& PLEN2::AccelerationGyroSensor::getGyroYaw ( )

Get angular velocity of yaw axis (rotation axis on Z axis)

Returns
Angular velocity of yaw axis
Attention
Return the value cached at the runtime of the sampling method.
bool PLEN2::AccelerationGyroSensor::sampling ( )

Do sampling sensor values.

Usage assumption is to call the method at stated periods from loop().

Returns
Result
Attention
The method has a deadlock of interruption and communication wait because it communicate with the sensor through a bus, so using it in constructor and interruption vector is deprecated.

The order of power supplied or firmware startup timing is base-board, head-board. If the method calls from early timing, program freezes because synchronism of communication is missed. (Generally, after setup() inserts a 3000[msec] delays for success.)

The documentation for this class was generated from the following file: