Apollo 11.0
自动驾驶开放平台
transform_server.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16#pragma once
17
18#include <map>
19#include <set>
20#include <string>
21#include <vector>
22
23#include "Eigen/Geometry"
24
26
27namespace apollo {
28namespace perception {
29namespace camera {
30
31struct Transform {
32 double timestamp;
33 double qw;
34 double qx;
35 double qy;
36 double qz;
37 double tx;
38 double ty;
39 double tz;
40};
41
43 public:
46
47 inline const std::set<std::string> &vertices() { return vertices_; }
48
49 bool Init(const std::vector<std::string> &camera_names,
50 const std::string &params_path);
51
52 bool AddTransform(const std::string &child_frame_id,
53 const std::string &frame_id,
54 const Eigen::Affine3d &transform);
55
56 bool QueryTransform(const std::string &child_frame_id,
57 const std::string &frame_id, Eigen::Affine3d *transform);
58
59 void print();
60
61 bool LoadFromFile(const std::string &tf_input, float frequency = 200.0f);
62
63 bool QueryPos(double timestamp, Eigen::Affine3d *pose);
64
65 private:
66 struct Edge {
67 std::string child_frame_id;
68 std::string frame_id;
69 Eigen::Affine3d transform;
70
71 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
72 };
73
74 std::vector<Transform> tf_;
75
76 double error_limit_ = 1.0;
77 // frame ids
78 std::set<std::string> vertices_;
79
80 // multimap from child frame id to frame id
82
83 bool FindTransform(const std::string &child_frame_id,
84 const std::string &frame_id, Eigen::Affine3d *transform,
85 std::map<std::string, bool> *visited);
86};
87
88} // namespace camera
89} // namespace perception
90} // namespace apollo
bool AddTransform(const std::string &child_frame_id, const std::string &frame_id, const Eigen::Affine3d &transform)
bool LoadFromFile(const std::string &tf_input, float frequency=200.0f)
bool QueryTransform(const std::string &child_frame_id, const std::string &frame_id, Eigen::Affine3d *transform)
const std::set< std::string > & vertices()
bool QueryPos(double timestamp, Eigen::Affine3d *pose)
bool Init(const std::vector< std::string > &camera_names, const std::string &params_path)
std::multimap< T, EigenType, std::less< T >, Eigen::aligned_allocator< std::pair< const T, EigenType > > > EigenMultiMap
Definition eigen_defs.h:44
class register implement
Definition arena_queue.h:37