提交 5ec1cd59 编写于 作者: C Calvin Miao 提交者: Jiangtao Hu

Fixed a couple of security bugs

上级 c4e2db3b
......@@ -195,12 +195,22 @@ void VisualizationEngine::Preprocess(const std::string &map_folder,
std::string image_resolution_path = image_path + buf;
AINFO << "image_resolution_path: " << image_resolution_path;
EnsureDirectory(image_visual_path);
if (!EnsureDirectory(image_visual_path)) {
AERROR << "image_visual_path: " << image_visual_path
<< " cannot be created.";
return;
}
if (DirectoryExists(image_visual_resolution_path_)) {
AINFO << "image_visual_resolution_path: " << image_visual_resolution_path_
<< "already exists.";
return;
}
if (!EnsureDirectory(image_visual_resolution_path_)) {
AERROR << "image_visual_resolution_path: " << image_visual_resolution_path_
<< " cannot be created.";
return;
}
EnsureDirectory(image_visual_resolution_path_);
boost::filesystem::path image_resolution_path_boost(image_resolution_path);
// push path of map's images to vector
......@@ -256,8 +266,8 @@ void VisualizationEngine::Draw() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
subMat_[i]
[j].copyTo(big_window_(cv::Rect(j * 1024, i * 1024, 1024, 1024)));
subMat_[i][j].copyTo(
big_window_(cv::Rect(j * 1024, i * 1024, 1024, 1024)));
}
}
......@@ -491,9 +501,10 @@ void VisualizationEngine::DrawLegend() {
unsigned char b = color_table[i % 3][0];
unsigned char g = color_table[i % 3][1];
unsigned char r = color_table[i % 3][2];
cv::circle(image_window_, cv::Point(755, (15 + textSize.height) * (i + 1) -
textSize.height / 2),
8, cv::Scalar(b, g, r), 3);
cv::circle(
image_window_,
cv::Point(755, (15 + textSize.height) * (i + 1) - textSize.height / 2),
8, cv::Scalar(b, g, r), 3);
}
}
......
......@@ -800,6 +800,7 @@ void GLFWFusionViewer::keyboard(int key) {
break;
case GLFW_KEY_E: // E
draw_lane_objects_ = !draw_lane_objects_;
break;
case GLFW_KEY_F: // F
show_fusion_ = !show_fusion_;
break;
......
......@@ -26,8 +26,8 @@
#include <vector>
#include "modules/common/math/linear_interpolation.h"
#include "modules/common/math/vec2d.h"
#include "modules/common/math/polygon2d.h"
#include "modules/common/math/vec2d.h"
#include "modules/map/hdmap/hdmap_util.h"
#include "modules/map/proto/map_id.pb.h"
#include "modules/prediction/common/prediction_gflags.h"
......@@ -56,8 +56,8 @@ double PredictionMap::HeadingOnLane(std::shared_ptr<const LaneInfo> lane_info,
return lane_info->Heading(s);
}
double PredictionMap::CurvatureOnLane(
const std::string& lane_id, const double s) {
double PredictionMap::CurvatureOnLane(const std::string& lane_id,
const double s) {
std::shared_ptr<const hdmap::LaneInfo> lane_info = LaneById(lane_id);
return lane_info->Curvature(s);
}
......@@ -212,16 +212,15 @@ std::vector<std::shared_ptr<const JunctionInfo>> PredictionMap::GetJunctions(
return junctions;
}
bool PredictionMap::InJunction(
const Eigen::Vector2d& point, const double radius) {
bool PredictionMap::InJunction(const Eigen::Vector2d& point,
const double radius) {
auto junction_infos = GetJunctions(point, radius);
Vec2d vec(point[0], point[1]);
if (junction_infos.empty()) {
return false;
}
for (const auto junction_info : junction_infos) {
if (junction_info == nullptr ||
!junction_info->junction().has_polygon()) {
if (junction_info == nullptr || !junction_info->junction().has_polygon()) {
continue;
}
std::vector<Vec2d> vertices;
......@@ -244,8 +243,11 @@ double PredictionMap::PathHeading(std::shared_ptr<const LaneInfo> lane_info,
common::math::Vec2d vec_point = {point.x(), point.y()};
double s = -1.0;
double l = 0.0;
lane_info->GetProjection(vec_point, &s, &l);
return HeadingOnLane(lane_info, s);
if (lane_info->GetProjection(vec_point, &s, &l)) {
return HeadingOnLane(lane_info, s);
} else {
return M_PI;
}
}
bool PredictionMap::SmoothPointFromLane(const std::string& id, const double s,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册