summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/euler.cpp4
-rw-r--r--compat/euler.hpp6
-rw-r--r--cv/translation-calibrator.cpp2
-rw-r--r--logic/pipeline.cpp26
-rw-r--r--logic/pipeline.hpp8
-rw-r--r--pose-widget/pose-widget.hpp2
6 files changed, 24 insertions, 24 deletions
diff --git a/compat/euler.cpp b/compat/euler.cpp
index 889fc53e..5d6fb25b 100644
--- a/compat/euler.cpp
+++ b/compat/euler.cpp
@@ -4,7 +4,7 @@
namespace euler {
-euler_t rmat_to_euler(const rmat& R)
+Pose_ rmat_to_euler(const rmat& R)
{
const double cy = sqrt(R(2,2)*R(2, 2) + R(2, 1)*R(2, 1));
const bool large_enough = cy > 1e-10;
@@ -23,7 +23,7 @@ euler_t rmat_to_euler(const rmat& R)
}
// tait-bryan angles, not euler
-rmat euler_to_rmat(const euler_t& input)
+rmat euler_to_rmat(const Pose_& input)
{
const double H = -input(0);
const double P = -input(1);
diff --git a/compat/euler.hpp b/compat/euler.hpp
index d4217a70..b2f10ac0 100644
--- a/compat/euler.hpp
+++ b/compat/euler.hpp
@@ -17,9 +17,9 @@ template<int h_, int w_> using dmat = Mat<double, h_, w_>;
using dvec3 = Mat<double, 3, 1>;
using rmat = dmat<3, 3>;
-using euler_t = dmat<3, 1>;
+using Pose_ = dmat<3, 1>;
-rmat OTR_COMPAT_EXPORT euler_to_rmat(const euler_t& input);
-euler_t OTR_COMPAT_EXPORT rmat_to_euler(const rmat& R);
+rmat OTR_COMPAT_EXPORT euler_to_rmat(const Pose_& input);
+Pose_ OTR_COMPAT_EXPORT rmat_to_euler(const rmat& R);
} // end ns euler
diff --git a/cv/translation-calibrator.cpp b/cv/translation-calibrator.cpp
index 8117b1e7..dd520ce6 100644
--- a/cv/translation-calibrator.cpp
+++ b/cv/translation-calibrator.cpp
@@ -91,7 +91,7 @@ bool TranslationCalibrator::check_bucket(const cv::Matx33d& R_CM_k)
for (unsigned i = 0; i < 3; i++)
r(j, i) = R_CM_k(j, i);
- const euler_t ypr = rmat_to_euler(r) * r2d;
+ const Pose_ ypr = rmat_to_euler(r) * r2d;
auto array_index = [](double val, double spacing) {
return (unsigned)iround((val + 180)/spacing);
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index 9d783952..65699287 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -46,15 +46,15 @@ void reltrans::on_center()
moving_to_reltans = false;
}
-euler_t reltrans::rotate(const rmat& R, const euler_t& in, vec3_bool disable) const
+Pose_ reltrans::rotate(const rmat& R, const Pose_& in, vec3_bool disable) const
{
enum { tb_Z, tb_X, tb_Y };
// TY is really yaw axis. need swapping accordingly.
// sign changes are due to right-vs-left handedness of coordinate system used
- const euler_t ret = R * euler_t(in(TZ), -in(TX), -in(TY));
+ const Pose_ ret = R * Pose_(in(TZ), -in(TX), -in(TY));
- euler_t output;
+ Pose_ output;
if (disable(TZ))
output(TZ) = in(TZ);
@@ -77,7 +77,7 @@ euler_t reltrans::rotate(const rmat& R, const euler_t& in, vec3_bool disable) co
Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
const vec6_bool& disable, bool neck_enable, int neck_z)
{
- euler_t rel((const double*)value);
+ Pose_ rel((const double*)value);
if (state != reltrans_disabled)
{
@@ -105,7 +105,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
constexpr double d2r = M_PI / 180;
const rmat R = euler_to_rmat(
- euler_t(value(Yaw) * d2r * !disable(Yaw),
+ Pose_(value(Yaw) * d2r * !disable(Yaw),
value(Pitch) * d2r * !disable(Pitch),
value(Roll) * d2r * !disable(Roll)));
@@ -114,7 +114,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
// dynamic neck
if (neck_enable && (state != reltrans_non_center || !in_zone))
{
- const euler_t neck = apply_neck(R, -neck_z, disable(TZ));
+ const Pose_ neck = apply_neck(R, -neck_z, disable(TZ));
for (unsigned k = 0; k < 3; k++)
rel(k) += neck(k);
@@ -144,7 +144,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
interp_pos = interp_pos * (1-alpha) + rel * alpha;
- const euler_t tmp = rel - interp_pos;
+ const Pose_ tmp = rel - interp_pos;
rel = interp_pos;
const double delta = std::fabs(tmp(0)) + std::fabs(tmp(1)) + std::fabs(tmp(2));
@@ -171,9 +171,9 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
};
}
-euler_t reltrans::apply_neck(const rmat& R, int nz, bool disable_tz) const
+Pose_ reltrans::apply_neck(const rmat& R, int nz, bool disable_tz) const
{
- euler_t neck;
+ Pose_ neck;
neck = rotate(R, { 0, 0, nz }, {});
neck(TZ) = neck(TZ) - nz;
@@ -288,8 +288,8 @@ void pipeline::maybe_set_center_pose(const Pose& value, bool own_center_logic)
}
else
{
- center.inv_R = euler_to_rmat(euler_t(&value[Yaw]) * (M_PI / 180)).t();
- center.T = euler_t(&value[TX]);
+ center.inv_R = euler_to_rmat(Pose_(&value[Yaw]) * (M_PI / 180)).t();
+ center.T = Pose_(&value[TX]);
}
}
}
@@ -300,8 +300,8 @@ Pose pipeline::apply_center(Pose value) const
for (unsigned k = 0; k < 3; k++)
value(k) -= center.T(k);
- euler_t rot = rmat_to_euler(
- euler_to_rmat(euler_t(&value[Yaw]) * (M_PI / 180)) * center.inv_R
+ Pose_ rot = rmat_to_euler(
+ euler_to_rmat(Pose_(&value[Yaw]) * (M_PI / 180)) * center.inv_R
);
for (unsigned k = 0; k < 3; k++)
value(k+3) = rot(k) * 180 / M_PI;
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 41ba7181..e6e9cc7e 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -33,7 +33,7 @@ using vec3_bool = Mat<bool, 6, 1>;
class reltrans
{
- euler_t interp_pos;
+ Pose_ interp_pos;
Timer interp_timer;
// this implements smooth transition into reltrans mode
@@ -49,8 +49,8 @@ public:
void on_center();
- euler_t rotate(const rmat& rmat, const euler_t& in, vec3_bool disable) const;
- euler_t apply_neck(const rmat& R, int nz, bool disable_tz) const;
+ Pose_ rotate(const rmat& rmat, const Pose_& in, vec3_bool disable) const;
+ Pose_ apply_neck(const rmat& R, int nz, bool disable_tz) const;
Pose apply_pipeline(reltrans_state state, const Pose& value,
const vec6_bool& disable, bool neck_enable, int neck_z);
};
@@ -100,7 +100,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
struct {
rmat inv_R = rmat::eye();
- euler_t T;
+ Pose_ T;
} center;
time_units::ms backlog_time {};
diff --git a/pose-widget/pose-widget.hpp b/pose-widget/pose-widget.hpp
index 15dd7866..18b76fb1 100644
--- a/pose-widget/pose-widget.hpp
+++ b/pose-widget/pose-widget.hpp
@@ -28,7 +28,7 @@ public:
private:
void paintEvent(QPaintEvent*) override;
- euler_t R, T;
+ Pose_ R, T;
QImage front{QImage{":/images/side1.png"}.convertToFormat(QImage::Format_ARGB32)};
QImage back{QImage{":/images/side6.png"}.convertToFormat(QImage::Format_ARGB32)};
};