Apollo 10.0
自动驾驶开放平台
apollo::perception::camera::PlaneMotion类 参考

#include <plane_motion.h>

apollo::perception::camera::PlaneMotion 的协作图:

Public 类型

enum  { ACCUM_MOTION = 0 , ACCUM_PUSH_MOTION , PUSH_ACCUM_MOTION , RESET }
 

Public 成员函数

 PlaneMotion (int s)
 
 ~PlaneMotion ()
 
void cleanbuffer ()
 
void set_buffer_size (int s)
 
void add_new_motion (double pre_image_timestamp, double image_timestamp, int motion_operation_flag, base::VehicleStatus *vehicledata)
 
base::MotionBuffer get_buffer ()
 
bool find_motion_with_timestamp (double timestamp, base::VehicleStatus *vs)
 
bool is_3d_motion () const
 

详细描述

在文件 plane_motion.h35 行定义.

成员枚举类型说明

◆ anonymous enum

anonymous enum

构造及析构函数说明

◆ PlaneMotion()

apollo::perception::camera::PlaneMotion::PlaneMotion ( int  s)
explicit

在文件 plane_motion.cc28 行定义.

28 {
30 if (mat_motion_sensor_.rows() == 3 && mat_motion_sensor_.cols() == 3) {
31 is_3d_motion_ = false;
32 } else if (mat_motion_sensor_.rows() == 4 && mat_motion_sensor_.cols() == 4) {
33 is_3d_motion_ = true;
34 } else {
35 AERROR << "Unknow motion matrix size : " << mat_motion_sensor_.rows() << " "
36 << mat_motion_sensor_.cols();
37 }
38}
#define AERROR
Definition log.h:44

◆ ~PlaneMotion()

apollo::perception::camera::PlaneMotion::~PlaneMotion ( )

在文件 plane_motion.cc40 行定义.

40 {
41 if (mot_buffer_ != nullptr) {
42 mot_buffer_->clear();
43 mot_buffer_ = nullptr;
44 }
45}

成员函数说明

◆ add_new_motion()

void apollo::perception::camera::PlaneMotion::add_new_motion ( double  pre_image_timestamp,
double  image_timestamp,
int  motion_operation_flag,
base::VehicleStatus vehicledata 
)

在文件 plane_motion.cc160 行定义.

163 {
164 while (!raw_motion_queue_.empty() &&
165 vehicledata->time_ts < raw_motion_queue_.back().time_ts) {
166 raw_motion_queue_.pop_back();
167 ADEBUG << "pop ts : back ts" << vehicledata->time_ts << " "
168 << raw_motion_queue_.back().time_ts << " "
169 << raw_motion_queue_.size();
170 }
171
172 if (motion_operation_flag != RESET) {
173 generate_motion_matrix(vehicledata);
174 raw_motion_queue_.push_back(*vehicledata);
175 if (static_cast<int>(raw_motion_queue_.size()) > buffer_size_ * 10) {
176 AWARN << "MotionQueue is too large, try sync motion/image timestep";
177 }
178
179 switch (motion_operation_flag) {
180 case ACCUM_MOTION:
181 // do nothing
182 break;
184 accumulate_motion(pre_image_timestamp, image_timestamp);
185 update_motion_buffer(*vehicledata, pre_image_timestamp,
186 image_timestamp);
187 break;
188 default:
189 AERROR << "motion operation flag:wrong type";
190 return;
191 }
192 } else {
193 mot_buffer_->clear();
194 vehicledata->time_d = 0;
195 vehicledata->time_ts = image_timestamp;
196 vehicledata->motion = base::MotionType::Identity();
197 mot_buffer_->push_back(*vehicledata);
198 ADEBUG << "pop and rest raw_buffer, mot_buffer: "
199 << raw_motion_queue_.size();
200 }
201}
#define ADEBUG
Definition log.h:41
#define AWARN
Definition log.h:43

◆ cleanbuffer()

void apollo::perception::camera::PlaneMotion::cleanbuffer ( )
inline

在文件 plane_motion.h60 行定义.

60 {
61 if (mot_buffer_ != nullptr) {
62 mot_buffer_->clear();
63 mot_buffer_ = nullptr;
64 }
65
66 mat_motion_sensor_ = base::MotionType::Identity();
67 }

◆ find_motion_with_timestamp()

bool apollo::perception::camera::PlaneMotion::find_motion_with_timestamp ( double  timestamp,
base::VehicleStatus vs 
)

在文件 plane_motion.cc140 行定义.

141 {
142 std::lock_guard<std::mutex> lock(mutex_);
143 ADEBUG << "mot_buffer_->size(): " << mot_buffer_->size();
144
145 for (auto rit = mot_buffer_->rbegin(); rit != mot_buffer_->rend(); ++rit) {
146 if (std::abs(rit->time_ts - timestamp) <
147 std::numeric_limits<double>::epsilon()) {
148 *vs = *rit;
149 return true;
150 }
151 }
152 return false;
153}

◆ get_buffer()

base::MotionBuffer apollo::perception::camera::PlaneMotion::get_buffer ( )

在文件 plane_motion.cc155 行定义.

155 {
156 std::lock_guard<std::mutex> lock(mutex_);
157 return *mot_buffer_;
158}

◆ is_3d_motion()

bool apollo::perception::camera::PlaneMotion::is_3d_motion ( ) const
inline

在文件 plane_motion.h86 行定义.

86{ return is_3d_motion_; }

◆ set_buffer_size()

void apollo::perception::camera::PlaneMotion::set_buffer_size ( int  s)
inline

在文件 plane_motion.h69 行定义.

69 {
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 }
boost::circular_buffer< VehicleStatus > MotionBuffer

该类的文档由以下文件生成: