#include <Magnetometer.h>
Inheritance diagram for Magnetometer:
Public Member Functions | |
Magnetometer () | |
Default Constructor. | |
Magnetometer (TiXmlHandle handle) | |
Primary constructor. | |
virtual | ~Magnetometer () |
Deinitialize. | |
Measurement | GetMeasurement () |
Function to return scalar measurement (not currently used). | |
Vector | GetRawVectorMeasurement () |
Function to return magnetometer measurement in the form of a vector in the Sensor Frame. | |
Vector | GetVectorMeasurement () |
Function to return magnetometer measurement in the form of a vector in Body frame. | |
virtual int | Initialize (const string &magfn) |
Magnetometer initialization function. | |
void | AsciiParser () |
Parse the ascii magnetometer string into x, y, z components. The magnetometer does not seem to always return the correct format. Recommend using binary parser. | |
void | BinaryParser () |
Binary parser- return string has the following format return = Xh | Xl | Yh | Yl | Zh | Zl | CR where h and l are high and low bytes respectively and CR is a carriage return. The high byte is a signed int, the low unsigned. output is parsed by converting each byte to integer, left shifting the high byte 8 times and adding the two together. The high byte is left shifted since the high and low byte comprise a single 16 bit integer and the first bit of the high byte must be multiplied by 2^8 instead of 2^0, and so on for the other bits The high byte is casted straight to an int, but for the low byte, the char must first be casted to unsigned char, then to int since that byte is unsigned. | |
void | DefaultConfiguration () |
Set Magnetometer to factory defaults. | |
void | SetBaud19200Configuration () |
Set Baud Rate to 19,200. | |
void | PolledDataConfiguration () |
Set Magnetometer to Polled data. | |
void | ContinuousDataConfiguration () |
Set Magnetometer to Continuous data. | |
void | SetAsciiConfiguration () |
Set to Ascii. Note: code not setup for Ascii parsing. | |
void | SetBinaryConfiguration () |
void | SetSampleRateConfiguration () |
Set Sample Rate ( 10, 20 , 25, 30, 40, 50, 60, 100, 123, 154 ) Note: Check HMR2300 manual for Output Sample rate restrictions. Recommended < 60 sps. | |
void | SetResetOnConfiguration () |
Set/Reset ON. | |
void | SetResetOffConfiguration () |
Set/Reset Off. | |
void | SetAveragingOnConfiguration () |
Set Averaging On. | |
void | SetAveragingOffConfiguration () |
Set Averaging OFF. | |
void | ReEnterOnConfiguration () |
Re-Enter Response On. | |
void | ReEnterOffConfiguration () |
Re-Enter Response OFF. | |
void | QuerryConfiguration () |
Querry parameters. | |
bool | IsActive () |
Returns the current state of m_bActiveState. | |
Vector | GetLocation () const |
Returns the physical location of the device with respect to whorl body coordinates. | |
void | SetLocation (const Vector &newDeviceLocation) |
Specify the physical location of the device with respect to whorl body coordinates. | |
Static Public Attributes | |
const bool | c_bNotActive = false |
a constant bool that is equal to false. | |
const bool | c_bActive = true |
a constant bool that is equal to true. | |
Protected Member Functions | |
virtual int | Initialize () |
Initializes the device for use. | |
virtual int | Deinitialize () |
Deinitializes the device from further use. | |
Protected Attributes | |
char * | name |
Private Attributes | |
int | m_magfd |
Member variable for magnetometer file descriptor. | |
Matrix | m_Rmb |
Member variable for rotation matrix. | |
char * | buffer |
Member variable for response from magnetometer. | |
char * | magread |
Member variable for magnetometer counts. | |
Vector | m_magCountsSensor |
Member variable for magnetometer counts in the Sensor Frame. | |
Vector | m_magCountsBody |
Member variable for magnetometer counts in the Body Frame. | |
int | m_sampleRate |
Member variable to specify sample rate. Not implemented yet. | |
double | m_xOff |
x offset | |
double | m_yOff |
y offset | |
double | m_majorA |
Major axis. | |
double | m_minorA |
Minor axis. | |
double | m_phi |
Angle between x-axis and major axis. |
|
Default Constructor.
Definition at line 22 of file Magnetometer.cpp. |
|
Primary constructor.
Definition at line 29 of file Magnetometer.cpp. References _, buffer, checkResponse(), TiXmlHandle::Child(), O_SESSAME::Deg2Rad(), TiXmlHandle::Element(), TiXmlHandle::FirstChild(), Device::Initialize(), CAMdoubleMatrix::initialize(), CAMdoubleVector::initialize(), m_magCountsSensor, m_majorA, m_minorA, m_phi, m_Rmb, m_xOff, m_yOff, magread, and O_SESSAME::Vector. |
|
Deinitialize.
Definition at line 109 of file Magnetometer.cpp. |
|
Parse the ascii magnetometer string into x, y, z components. The magnetometer does not seem to always return the correct format. Recommend using binary parser.
Definition at line 357 of file Magnetometer.cpp. References hear(), m_magCountsSensor, m_magfd, magread, and say(). |
|
Binary parser- return string has the following format return = Xh | Xl | Yh | Yl | Zh | Zl | CR where h and l are high and low bytes respectively and CR is a carriage return. The high byte is a signed int, the low unsigned. output is parsed by converting each byte to integer, left shifting the high byte 8 times and adding the two together. The high byte is left shifted since the high and low byte comprise a single 16 bit integer and the first bit of the high byte must be multiplied by 2^8 instead of 2^0, and so on for the other bits The high byte is casted straight to an int, but for the low byte, the char must first be casted to unsigned char, then to int since that byte is unsigned.
Definition at line 411 of file Magnetometer.cpp. References hear(), m_magCountsSensor, m_magfd, magread, and say(). Referenced by GetRawVectorMeasurement(). |
|
Set Magnetometer to Continuous data.
Definition at line 217 of file Magnetometer.cpp. |
|
Set Magnetometer to factory defaults.
Definition at line 178 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Deinitializes the device from further use.
Reimplemented in ControlMomentGyro, LinearActuator, MomentumWheel, PhysicalControlMomentGyro, and PhysicalMomentumWheel. Definition at line 113 of file Device.cpp. References Device::c_bNotActive, and Device::SetActive(). Referenced by Device::~Device(), Relay::~Relay(), and Thruster::~Thruster(). |
|
Returns the physical location of the device with respect to whorl body coordinates.
Definition at line 75 of file Device.cpp. References O_SESSAME::Vector. |
|
Function to return scalar measurement (not currently used).
Implements Sensor. Definition at line 334 of file Magnetometer.cpp. |
|
Function to return magnetometer measurement in the form of a vector in the Sensor Frame.
Definition at line 344 of file Magnetometer.cpp. References BinaryParser(), and O_SESSAME::Vector. Referenced by GetVectorMeasurement(). |
|
Function to return magnetometer measurement in the form of a vector in Body frame.
Definition at line 433 of file Magnetometer.cpp. References GetRawVectorMeasurement(), m_magCountsBody, m_minorA, m_phi, m_Rmb, and O_SESSAME::Vector. Referenced by triadObserver::Run(). |
|
Initializes the device for use.
Reimplemented in ControlMomentGyro, PhysicalControlMomentGyro, PhysicalMomentumWheel, Thruster, Actuator, Relay, DMUAccelerometer, DMURateGyro, PhysicalTiltSensor, and TiltSensor. Definition at line 100 of file Device.cpp. References Device::c_bActive, and Device::SetActive(). Referenced by Actuator::Initialize(), and Magnetometer(). |
|
Magnetometer initialization function.
Definition at line 132 of file Magnetometer.cpp. References DefaultConfiguration(), init_serial(), m_magfd, PolledDataConfiguration(), QuerryConfiguration(), ReEnterOnConfiguration(), SetAveragingOnConfiguration(), SetBaud19200Configuration(), SetBinaryConfiguration(), SetResetOnConfiguration(), and SetSampleRateConfiguration(). |
|
Returns the current state of m_bActiveState.
Definition at line 59 of file Device.cpp. Referenced by Device::Device(). |
|
Set Magnetometer to Polled data.
Definition at line 207 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Querry parameters.
Definition at line 324 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Re-Enter Response OFF.
Definition at line 313 of file Magnetometer.cpp. |
|
Re-Enter Response On.
Definition at line 302 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Set to Ascii. Note: code not setup for Ascii parsing.
Definition at line 237 of file Magnetometer.cpp. |
|
Set Averaging OFF.
Definition at line 291 of file Magnetometer.cpp. |
|
Set Averaging On.
Definition at line 280 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Set Baud Rate to 19,200.
Definition at line 193 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Definition at line 225 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Specify the physical location of the device with respect to whorl body coordinates.
Definition at line 67 of file Device.cpp. References Device::m_Location, and O_SESSAME::Vector. |
|
Set/Reset Off.
Definition at line 269 of file Magnetometer.cpp. |
|
Set/Reset ON.
Definition at line 258 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Set Sample Rate ( 10, 20 , 25, 30, 40, 50, 60, 100, 123, 154 ) Note: Check HMR2300 manual for Output Sample rate restrictions. Recommended < 60 sps.
Definition at line 249 of file Magnetometer.cpp. References buffer, hear(), m_magfd, and say(). Referenced by Initialize(). |
|
Member variable for response from magnetometer.
Definition at line 89 of file Magnetometer.h. Referenced by ContinuousDataConfiguration(), DefaultConfiguration(), Magnetometer(), PolledDataConfiguration(), QuerryConfiguration(), ReEnterOffConfiguration(), ReEnterOnConfiguration(), SetAsciiConfiguration(), SetAveragingOffConfiguration(), SetAveragingOnConfiguration(), SetBaud19200Configuration(), SetBinaryConfiguration(), SetResetOffConfiguration(), SetResetOnConfiguration(), SetSampleRateConfiguration(), and ~Magnetometer(). |
|
a constant bool that is equal to true. Used for setting the active state Definition at line 50 of file Device.h. Referenced by Device::Initialize(). |
|
a constant bool that is equal to false. Used for setting the active state. Definition at line 48 of file Device.h. Referenced by Device::Deinitialize(), and Device::Device(). |
|
Member variable for magnetometer counts in the Body Frame.
Definition at line 95 of file Magnetometer.h. Referenced by GetVectorMeasurement(). |
|
Member variable for magnetometer counts in the Sensor Frame.
Definition at line 93 of file Magnetometer.h. Referenced by AsciiParser(), BinaryParser(), and Magnetometer(). |
|
Member variable for magnetometer file descriptor.
Definition at line 85 of file Magnetometer.h. Referenced by AsciiParser(), BinaryParser(), ContinuousDataConfiguration(), DefaultConfiguration(), Initialize(), PolledDataConfiguration(), QuerryConfiguration(), ReEnterOffConfiguration(), ReEnterOnConfiguration(), SetAsciiConfiguration(), SetAveragingOffConfiguration(), SetAveragingOnConfiguration(), SetBaud19200Configuration(), SetBinaryConfiguration(), SetResetOffConfiguration(), SetResetOnConfiguration(), SetSampleRateConfiguration(), and ~Magnetometer(). |
|
Major axis.
Definition at line 103 of file Magnetometer.h. Referenced by Magnetometer(). |
|
Minor axis.
Definition at line 105 of file Magnetometer.h. Referenced by GetVectorMeasurement(), and Magnetometer(). |
|
Angle between x-axis and major axis.
Definition at line 107 of file Magnetometer.h. Referenced by GetVectorMeasurement(), and Magnetometer(). |
|
Member variable for rotation matrix.
Definition at line 87 of file Magnetometer.h. Referenced by GetVectorMeasurement(), and Magnetometer(). |
|
Member variable to specify sample rate. Not implemented yet.
Definition at line 97 of file Magnetometer.h. |
|
x offset
Definition at line 99 of file Magnetometer.h. Referenced by Magnetometer(). |
|
y offset
Definition at line 101 of file Magnetometer.h. Referenced by Magnetometer(). |
|
Member variable for magnetometer counts.
Definition at line 91 of file Magnetometer.h. Referenced by AsciiParser(), BinaryParser(), and Magnetometer(). |
|
|