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());
63 Eigen::Matrix4f prediction;
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);
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();
objpose::ObjectPosePredictionResult predictObjectPoseLinear(const std::map< DateTime, ObjectPose > &poses, const DateTime &time, const ObjectPose &latestPose)
Predict the pose of an object given a history of poses based on a linear regression.