Skip to content

Commit 2ff12cd

Browse files
committed
file
1 parent 846512f commit 2ff12cd

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#ifndef INNER_GAUSSIAN_API
2+
#define INNER_GAUSSIAN_API
3+
4+
#include <QObject>
5+
#include <Eigen/StdVector>
6+
#include <dsr/api/dsr_eigen_defs.h>
7+
#include <dsr/api/dsr_rt_api.h>
8+
#include <optional>
9+
#include <vector>
10+
11+
namespace DSR
12+
{
13+
class DSRGraph;
14+
15+
using Cov3d = Eigen::Matrix<double, 3, 3, Eigen::DontAlign>;
16+
using Cov6d = Eigen::Matrix<double, 6, 6, Eigen::DontAlign>;
17+
18+
struct GaussianPoint3D
19+
{
20+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21+
Mat::Vector3d mean = Mat::Vector3d::Zero();
22+
Cov3d covariance = Cov3d::Zero();
23+
};
24+
25+
struct GaussianPose2D
26+
{
27+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28+
Eigen::Vector3d mean = Eigen::Vector3d::Zero();
29+
Cov3d covariance = Cov3d::Zero();
30+
};
31+
32+
struct GaussianPose3D
33+
{
34+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35+
Mat::Vector6d mean = Mat::Vector6d::Zero();
36+
Cov6d covariance = Cov6d::Zero();
37+
};
38+
39+
class InnerGaussianAPI : public QObject
40+
{
41+
public:
42+
explicit InnerGaussianAPI(DSRGraph *graph);
43+
44+
std::optional<GaussianPose3D> get_transformation_gaussian(
45+
const std::string &dest,
46+
const std::string &orig,
47+
std::uint64_t timestamp = 0,
48+
const std::string &edge_type = "RT",
49+
RT_API::TimeQuery time_query = RT_API::TimeQuery::Nearest) const;
50+
51+
std::optional<GaussianPoint3D> transform_point(
52+
const std::string &dest,
53+
const GaussianPoint3D &point,
54+
const std::string &orig,
55+
std::uint64_t timestamp = 0,
56+
const std::string &edge_type = "RT",
57+
RT_API::TimeQuery time_query = RT_API::TimeQuery::Nearest) const;
58+
59+
std::optional<GaussianPose2D> transform_pose2d(
60+
const std::string &dest,
61+
const GaussianPose2D &pose,
62+
const std::string &orig,
63+
std::uint64_t timestamp = 0,
64+
const std::string &edge_type = "RT",
65+
RT_API::TimeQuery time_query = RT_API::TimeQuery::Nearest) const;
66+
67+
std::optional<GaussianPose3D> transform_pose3d(
68+
const std::string &dest,
69+
const GaussianPose3D &pose,
70+
const std::string &orig,
71+
std::uint64_t timestamp = 0,
72+
const std::string &edge_type = "RT",
73+
RT_API::TimeQuery time_query = RT_API::TimeQuery::Nearest) const;
74+
75+
private:
76+
struct PathStep
77+
{
78+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
79+
std::uint64_t parent_id = 0;
80+
std::uint64_t child_id = 0;
81+
Mat::RTMat edge_mean = Mat::RTMat::Identity();
82+
Cov6d edge_covariance = Cov6d::Zero();
83+
bool invert = false;
84+
};
85+
86+
using PathSteps = std::vector<PathStep, Eigen::aligned_allocator<PathStep>>;
87+
88+
DSRGraph *m_graph;
89+
std::unique_ptr<RT_API> m_rt;
90+
91+
std::optional<PathSteps> build_path_steps(
92+
const std::string &dest,
93+
const std::string &orig,
94+
std::uint64_t timestamp,
95+
const std::string &edge_type,
96+
RT_API::TimeQuery time_query) const;
97+
98+
Mat::RTMat compose_chain(const PathSteps &steps,
99+
std::optional<std::size_t> perturbed_step = std::nullopt,
100+
const Mat::Vector6d &delta = Mat::Vector6d::Zero()) const;
101+
102+
static Mat::RTMat pose_vector_to_rtmat(const Mat::Vector6d &pose);
103+
static Mat::Vector6d rtmat_to_pose_vector(const Mat::RTMat &rtmat);
104+
static Mat::RTMat local_delta_rtmat(const Mat::Vector6d &delta);
105+
static double wrap_angle(double angle);
106+
};
107+
}
108+
109+
#endif

0 commit comments

Comments
 (0)