Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of tilt_angles by
Tiltmeter.h
00001 #ifndef TILTMETER_H 00002 #define TILTMETER_H 00003 00004 class Tiltmeter 00005 { 00006 public: 00007 00008 // Default constructor 00009 Tiltmeter(); 00010 00011 00012 // Detect the presence of tiltmeter sensor and ensure its status is appropriately set. 00013 // 00014 // Arguments: 00015 // None 00016 // 00017 // Returns: 00018 // The function returns true if the sensor is present and ready to use, and false otherwise. 00019 virtual bool TestConnection() = 0; 00020 00021 00022 // Compute the tilt angles and store them internally; you can access the computed values by 00023 // calling the GetRoll() and GetPitch() functions. 00024 // 00025 // Arguments: 00026 // None 00027 // 00028 // Returns: 00029 // Nothing 00030 void ComputeTiltAngles(); 00031 00032 00033 // Get the most recent roll angle as computed by calling ComputeTilt() 00034 // 00035 // Arguments: 00036 // None 00037 // 00038 // Returns: 00039 // The function returns the roll angle in units of degrees 00040 float GetRoll() const; 00041 00042 00043 // Get the most recent roll angle as computed by calling ComputeTilt() 00044 // 00045 // Arguments: 00046 // None 00047 // 00048 // Returns: 00049 // The function returns the roll angle in units of degrees 00050 float GetPitch() const; 00051 00052 00053 private: 00054 00055 // Read the accelerometer data and store the values for later use. You can access the values by 00056 // calling the GetAccelX(), GetAccelY() and/or GetAccelZ(); 00057 // 00058 // Arguments: 00059 // None 00060 // 00061 // Returns: 00062 // Nothing 00063 // 00064 // Remarks: 00065 // The data will be stored in the 'MeasuredAccel' member variable in units of m/s/s 00066 virtual void ReadAccelerometers() = 0; 00067 00068 00069 // Get the most recently measured X-axis acceleration as stored during the last call to 00070 // ReadAccelerometer() 00071 // 00072 // Arguments: 00073 // None 00074 // 00075 // Returns: 00076 // The function returns the most recently measured X-axis acceleration in units of m/s/s 00077 virtual float GetAccelX() const = 0; 00078 00079 00080 // Get the most recently measured Y-axis acceleration as stored during the last call to 00081 // ReadAccelerometer() 00082 // 00083 // Arguments: 00084 // None 00085 // 00086 // Returns: 00087 // The function returns the most recently measured Y-axis acceleration in units of m/s/s 00088 virtual float GetAccelY() const = 0; 00089 00090 00091 // Get the most recently measured Z-axis acceleration as stored during the last call to 00092 // ReadAccelerometer() 00093 // 00094 // Arguments: 00095 // None 00096 // 00097 // Returns: 00098 // The function returns the most recently measured Z-axis acceleration in units of m/s/s 00099 virtual float GetAccelZ() const = 0; 00100 00101 00102 private: 00103 00104 // Variables to store the roll and pitch values in units of degrees 00105 float RollAngle, PitchAngle; 00106 00107 00108 }; 00109 00110 #endif 00111
Generated on Sat Jul 16 2022 15:16:04 by
1.7.2
