summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-05-04 20:14:16 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-05-04 20:14:16 +0200
commit538853d89547a101f2af7c7e193a0d05576e6247 (patch)
treedd208401caa8636087cf684ee44a2a9961435ee2 /logic
parent85162f706e5c85c5dfe98d14c0096ed18670dcf8 (diff)
change awkward type name
Diffstat (limited to 'logic')
-rw-r--r--logic/pipeline.cpp26
-rw-r--r--logic/pipeline.hpp8
2 files changed, 17 insertions, 17 deletions
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 {};