Apollo  v5.5.0
Open source self driving car software
pose.h
Go to the documentation of this file.
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 <string>
20 
21 #include "Eigen/Core"
22 
24 
25 namespace apollo {
26 namespace perception {
27 namespace camera {
28 
29 // @brief Car's Pose
30 class CarPose {
31  public:
32  CarPose() = default;
33  ~CarPose() = default;
34 
35  bool Init(double ts, const Eigen::Matrix4d& pose);
36 
37  const Eigen::Matrix4d getCarPose() const;
38  const Eigen::Vector3d getCarPosition() const;
39 
40  void ClearCameraPose(const std::string& camera_name);
41  void SetCameraPose(const std::string& camera_name,
42  const Eigen::Matrix4d& c2w_pose);
43  bool GetCameraPose(const std::string& camera_name,
44  Eigen::Matrix4d* c2w_pose) const;
45 
46  void setTimestamp(double ts) { timestamp_ = ts; }
47  double getTimestamp() const { return timestamp_; }
48 
49  Eigen::Matrix4d pose_; // car(novatel) to world pose
50  std::map<std::string, Eigen::Matrix4d> c2w_poses_; // camera to world poses
51  double timestamp_;
52 
53  private:
54  friend std::ostream& operator<<(std::ostream& os, const CarPose&);
55 };
56 
57 std::ostream& operator<<(std::ostream& os, const CarPose& pose);
58 
59 } // namespace camera
60 } // namespace perception
61 } // namespace apollo
Definition: blob.h:72
void setTimestamp(double ts)
Definition: pose.h:46
const Eigen::Vector3d getCarPosition() const
Eigen::Matrix4d pose_
Definition: pose.h:49
void SetCameraPose(const std::string &camera_name, const Eigen::Matrix4d &c2w_pose)
double getTimestamp() const
Definition: pose.h:47
friend std::ostream & operator<<(std::ostream &os, const CarPose &)
bool Init(double ts, const Eigen::Matrix4d &pose)
double timestamp_
Definition: pose.h:51
bool GetCameraPose(const std::string &camera_name, Eigen::Matrix4d *c2w_pose) const
std::map< std::string, Eigen::Matrix4d > c2w_poses_
Definition: pose.h:50
void ClearCameraPose(const std::string &camera_name)
const Eigen::Matrix4d getCarPose() const