1 #ifndef __JDETECTOR__JCOMPASS__
2 #define __JDETECTOR__JCOMPASS__
90 double A0 =
data.AHRS_A0;
91 double A1 =
data.AHRS_A1;
92 double A2 =
data.AHRS_A2;
94 double H0 =
data.AHRS_H0;
95 double H1 =
data.AHRS_H1;
96 double H2 =
data.AHRS_H2;
124 this->
roll = atan2(-A1, -A2);
125 this->
pitch = atan2(A0, sqrt(A1*A1 + A2*A2));
147 this->
pitch = asin(+1.0);
149 this->
pitch = asin(-1.0);
151 this->
pitch = asin(sp);
164 return static_cast<const JCompass&
>(*this);
175 static_cast<JCompass&
>(*this) = compass;
192 return (Rz * Ry * Rx);
205 const double cy = cos(-0.5 *
yaw);
206 const double sy = sin(-0.5 *
yaw);
207 const double cp = cos(+0.5 *
pitch);
208 const double sp = sin(+0.5 *
pitch);
209 const double cr = cos(-0.5 *
roll);
210 const double sr = sin(-0.5 *
roll);
213 sr * cp * cy - cr * sp * sy,
214 cr * sp * cy + sr * cp * sy,
215 cr * cp * sy - sr * sp * cy);
260 const double precision = std::numeric_limits<double>::min())
const
262 return (fabs(
getYaw() - compass.
getYaw()) <= precision &&
277 this->
yaw -= meridian;
338 out << compass.
pitch;
Data structure for compass in three dimensions.
double getYaw() const
Get yaw compass.
void setCompass(const JCompass &compass)
Set compass.
JCompass(const JQuaternion3D &Q)
Constructor.
bool equals(const JCompass &compass, const double precision=std::numeric_limits< double >::min()) const
Check equality.
JCompass(const JAHRS &data, const JAHRSCalibration &calibration)
Constructor.
friend JWriter & operator<<(JWriter &out, const JCompass &compass)
Write compasss to output.
JRotation3D getRotation() const
Get rotation matrix.
friend JReader & operator>>(JReader &in, JCompass &compass)
Read compasss from input.
void correct(const double declination, const double meridian)
Correct compass for magnetic declination and meridian convergence angle.
const JCompass & getCompass() const
Get compass.
double getRoll() const
Get roll compass.
JCompass(const double yaw, const double pitch, const double roll)
Constructor.
JQuaternion3D getQuaternion() const
Get quaternion.
friend std::ostream & operator<<(std::ostream &out, const JCompass &compass)
Write compasss to output.
JCompass()
Default constructor.
friend std::istream & operator>>(std::istream &in, JCompass &compass)
Read compasss from input.
double getPitch() const
Get pitch compass.
Data structure for unit quaternion in three dimensions.
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
Interface for binary input.
Interface for binary output.
void transform(double &__x, double &__y, double &__z) const
Transform.
file Auxiliary data structures and methods for detector calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template definition of auxiliary base class for comparison of data structures.