25 #include <manif/SE3.h>
27 #include <SimoxUtility/math/pose/pose.h>
28 #include <SimoxUtility/math/regression/linear.h>
36 objpose::ObjectPosePredictionResult
41 objpose::ObjectPosePredictionResult result;
42 result.success =
false;
46 static const int tangentDims = 6;
49 std::vector<double> timestampsSec;
50 std::vector<Vector6d> tangentPoses;
53 for (
const auto& [timestamp, pose] : poses)
55 timestampsSec.push_back((timestamp - timeOrigin).toSecondsDouble());
56 manif::SE3f se3(simox::math::position(pose.objectPoseGlobal),
58 tangentPoses.emplace_back(se3.cast<
double>().log().coeffs());
65 if (timestampsSec.size() <= 1 || latestPose.
isStatic)
71 using simox::math::LinearRegression;
72 const bool inputOffset =
false;
74 const LinearRegression<tangentDims> model =
75 LinearRegression<tangentDims>::Fit(timestampsSec, tangentPoses, inputOffset);
76 const auto predictionTime = armarx::fromIce<DateTime>(time);
77 Vector6d linearPred = model.predict((predictionTime - timeOrigin).toSecondsDouble());
78 prediction = manif::SE3Tangentd(linearPred).exp().transform().cast<
float>();
86 result.success =
true;
87 result.prediction = latestCopy.
toIce();