Skip to content

Commit a09be45

Browse files
authored
Add files via upload
Added references
1 parent 1828186 commit a09be45

4 files changed

Lines changed: 87 additions & 0 deletions

File tree

include/QuaternionCalc.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@
3737

3838
namespace libRSF
3939
{
40+
41+
/** @brief Converts a quaterion to Tait–Bryan angles
42+
* From:
43+
* Wikipedia contributors,
44+
* "Conversion between quaternions and Euler angles"
45+
* Wikipedia, The Free Encyclopedia,
46+
* https://en.wikipedia.org/w/index.php?title=Conversion_between_quaternions_and_Euler_angles&oldid=883423661
47+
* (accessed February 15, 2019).
48+
*
49+
* @param Quaternion ceres quaternion with ordering w,x,y,z
50+
* @param Yaw rotation around z
51+
* @param Pitch rotation around y
52+
* @param Roll rotation around x
53+
*/
54+
template<typename T>
55+
inline void QuaternionToRPY(const T* Quaternion, T* Roll, T* Pitch, T* Yaw);
56+
4057
/** @brief invert a quaternion
4158
*
4259
* @param Quaternion ceres quaternion with ordering w,x,y,z
@@ -48,6 +65,36 @@ namespace libRSF
4865
template<typename T>
4966
inline T RotationBetween(const T* Vector1, const T* Vector2, T* Quaternion);
5067

68+
template<typename T>
69+
inline void QuaternionToRPY(const T* Quaternion, T* Roll, T* Pitch, T* Yaw)
70+
{
71+
72+
const T& Qw = Quaternion[0];
73+
const T& Qx = Quaternion[1];
74+
const T& Qy = Quaternion[2];
75+
const T& Qz = Quaternion[3];
76+
77+
/** conversion from Wikipedia */
78+
// roll (x-axis rotation)
79+
T sinr_cosp = +2.0 * (Qw * Qx + Qy * Qz);
80+
T cosr_cosp = +1.0 - 2.0 * (Qx * Qx + Qy * Qy);
81+
Roll[0] = ceres::atan2(sinr_cosp, cosr_cosp);
82+
83+
// pitch (y-axis rotation)
84+
T sinp = +2.0 * (Qw * Qy - Qz * Qx);
85+
if (sinp >= T(1))
86+
Pitch[0] = T(M_PI / 2); // use 90 degrees if out of range
87+
else if (sinp <= T(-1))
88+
Pitch[0] = T(-M_PI / 2);
89+
else
90+
Pitch[0] = ceres::asin(sinp);
91+
92+
// yaw (z-axis rotation)
93+
T siny_cosp = +2.0 * (Qw * Qz + Qx * Qy);
94+
T cosy_cosp = +1.0 - 2.0 * (Qy * Qy + Qz * Qz);
95+
Yaw[0] = ceres::atan2(siny_cosp, cosy_cosp);
96+
}
97+
5198
template<typename T>
5299
inline void InvertQuaterion(const T* Quaternion, T* QuaternionInv)
53100
{

include/error_models/LossFunction.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ using ceres::LossFunction;
3838

3939
namespace libRSF
4040
{
41+
/** \brief The robust Dynamic Covariance Scaling loss function
42+
* Based on:
43+
* P. Agarwal, G. D. Tipaldi, L. Spinello, C. Stachniss and W. Burgard
44+
* "Robust map optimization using dynamic covariance scaling"
45+
* 2013 IEEE International Conference on Robotics and Automation, Karlsruhe, 2013
46+
* DOI: 10.1109/ICRA.2013.6630557
47+
*
48+
* \param Phi Tuning parameter of DCS
49+
*
50+
*/
4151
class DCSLoss : public LossFunction
4252
{
4353
public:
@@ -50,6 +60,16 @@ namespace libRSF
5060
const double Phi_;
5161
};
5262

63+
/** \brief The robust closed form of Dynamic Covariance Estimation
64+
* Based on:
65+
* T. Pfeifer, S. Lange and P. Protzel
66+
* "Dynamic Covariance Estimation — A parameter free approach to robust Sensor Fusion"
67+
* 2017 IEEE International Conference on Multisensor Fusion and Integration for Intelligent Systems (MFI), Daegu, 2017
68+
* DOI: 10.1109/MFI.2017.8170347
69+
*
70+
* \param Sigma Standard deviation without outliers
71+
*
72+
*/
5373
class cDCELoss : public LossFunction
5474
{
5575
public:

include/error_models/MaxMixture.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838

3939
namespace libRSF
4040
{
41+
/** \brief The robust Max-Mixture error model
42+
* Based on:
43+
* E. Olson and P. Agarwal
44+
* “Inference on networks of mixtures for robust robot mapping”
45+
* Proc. of Robotics: Science and Systems (RSS), Sydney, 2012.
46+
* DOI: 10.15607/RSS.2012.VIII.040
47+
*
48+
* \param Mixture Underlying mixture distribution
49+
*
50+
*/
4151
template <int Dimension, typename MixtureType>
4252
class MaxMixture : public ErrorModel <Dimension, Dimension+1>
4353
{

include/error_models/SumMixture.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939

4040
namespace libRSF
4141
{
42+
/** \brief The robust Sum-Mixture error model
43+
* Based on:
44+
* D. M. Rosen, M. Kaess, and J. J. Leonard
45+
* “Robust incremental online inference over sparse factor graphs: Beyond the Gaussian case”
46+
* Proc. of Intl. Conf. on Robotics and Automation (ICRA), Karlsruhe, 2013.
47+
* DOI: 10.1109/ICRA.2013.6630699
48+
*
49+
* \param Mixture Underlying mixture distribution
50+
*
51+
*/
4252
template <int Dimension, typename MixtureType>
4353
class SumMixture : public ErrorModel <Dimension, 1>
4454
{

0 commit comments

Comments
 (0)