Apollo 11.0
自动驾驶开放平台
plane_motion.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
17#pragma once
18
19#include <cmath>
20#include <cstdio>
21#include <list>
22#include <memory>
23#include <mutex>
24
25#include "Eigen/Dense"
26#include "Eigen/Eigen"
27#include "Eigen/Geometry"
28
30
31namespace apollo {
32namespace perception {
33namespace camera {
34
36 public:
37 explicit PlaneMotion(int s);
38
41
42 private:
43 std::list<base::VehicleStatus> raw_motion_queue_;
44 base::MotionBufferPtr mot_buffer_;
45 std::mutex mutex_;
46 int buffer_size_;
47 int time_increment_; // the time increment units in motion input
48 float time_difference_; // the time difference for each buffer input
49 base::MotionType mat_motion_sensor_ = base::MotionType::Identity();
50 // motion matrix of accumulation through high sampling CAN+IMU input sequence
51 bool is_3d_motion_;
52 void generate_motion_matrix(
53 base::VehicleStatus *vehicledata); // generate inverse motion
54 void accumulate_motion(double start_time, double end_time);
55 void update_motion_buffer(const base::VehicleStatus &vehicledata,
56 const double pre_image_timestamp,
57 const double image_timestamp);
58
59 public:
60 void cleanbuffer() {
61 if (mot_buffer_ != nullptr) {
62 mot_buffer_->clear();
63 mot_buffer_ = nullptr;
64 }
65
66 mat_motion_sensor_ = base::MotionType::Identity();
67 }
68
69 void set_buffer_size(int s) {
71 buffer_size_ = s;
72 // mot_buffer_.reserve(buffer_size_);
73 if (mot_buffer_ == nullptr) {
74 mot_buffer_.reset(new base::MotionBuffer(buffer_size_));
75 } else {
76 mot_buffer_->set_capacity(buffer_size_);
77 }
78 }
79
80 void add_new_motion(double pre_image_timestamp, double image_timestamp,
81 int motion_operation_flag,
82 base::VehicleStatus *vehicledata);
83
85 bool find_motion_with_timestamp(double timestamp, base::VehicleStatus *vs);
86 bool is_3d_motion() const { return is_3d_motion_; }
87};
88
89} // namespace camera
90} // namespace perception
91} // namespace apollo
bool find_motion_with_timestamp(double timestamp, base::VehicleStatus *vs)
void add_new_motion(double pre_image_timestamp, double image_timestamp, int motion_operation_flag, base::VehicleStatus *vehicledata)
boost::circular_buffer< VehicleStatus > MotionBuffer
std::shared_ptr< MotionBuffer > MotionBufferPtr
class register implement
Definition arena_queue.h:37