Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing potential issues #15220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/common/util/message_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bool DumpMessage(const std::shared_ptr<T>& msg,
const std::string& dump_dir = "/tmp") {
if (!msg) {
AWARN << "Message to be dumped is nullptr!";
return false;
}

auto type_name = T::descriptor()->full_name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ void SimControlManager::Restart(double x, double y) {
// reset start point for dynamic model.
if (!IsEnabled() || !model_ptr_) {
AERROR << "Sim control is invalid,Failed to restart!";
return;
}
model_ptr_->Stop();
model_ptr_->Start(x, y);
return;
}

void SimControlManager::RunOnce() { model_ptr_->RunOnce(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ void SimulationWorldUpdater::RegisterMessageHandlers() {
MonitorMessageItem::INFO, "Successfully add a routing.");
if (!default_routing_) {
AERROR << "Failed to add a routing" << std::endl;
return;
}
Json response = JsonUtil::ProtoToTypedJson("AddDefaultRoutingPath",
*default_routing_);
Expand Down
48 changes: 24 additions & 24 deletions modules/perception/inference/tensorrt/rt_net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,37 +129,37 @@ void RTNet::addConvLayer(const LayerParameter &layer_param,
convLayer->setDilation(nvinfer1::DimsHW{dilationH, dilationW});

convLayer->setNbGroups(G);
}

if ((*weight_map)[layer_param.name().c_str()].size() > 0) {
convLayer->setKernelWeights((*weight_map)[layer_param.name().c_str()][0]);
if ((*weight_map)[layer_param.name().c_str()].size() > 0) {
convLayer->setKernelWeights((*weight_map)[layer_param.name().c_str()][0]);

if ((*weight_map)[layer_param.name().c_str()].size() > 1) {
convLayer->setBiasWeights((*weight_map)[layer_param.name().c_str()][1]);
if ((*weight_map)[layer_param.name().c_str()].size() > 1) {
convLayer->setBiasWeights((*weight_map)[layer_param.name().c_str()][1]);
}
}
}
std::vector<nvinfer1::Weights> lw;
lw.resize(2);
lw[0] = convLayer->getKernelWeights();
lw[1] = convLayer->getBiasWeights();
(*weight_map)[layer_param.name().c_str()] = lw;
std::vector<nvinfer1::Weights> lw;
lw.resize(2);
lw[0] = convLayer->getKernelWeights();
lw[1] = convLayer->getBiasWeights();
(*weight_map)[layer_param.name().c_str()] = lw;

convLayer->setName(layer_param.name().c_str());
ConstructMap(layer_param, convLayer, tensor_map, tensor_modify_map);
convLayer->setName(layer_param.name().c_str());
ConstructMap(layer_param, convLayer, tensor_map, tensor_modify_map);

#if LOAD_DEBUG
auto tmp_out_dims = convLayer->getOutput(0)->getDimensions();
std::string dim_string = "input: ";
for (int i = 0; i < 3; ++i) {
absl::StrAppend(&dim_string, " ",
convLayer->getInput(0)->getDimensions().d[i]);
}
absl::StrAppend(&dim_string, " | output: ");
for (int i = 0; i < 3; ++i) {
absl::StrAppend(&dim_string, " ", tmp_out_dims.d[i]);
}
AINFO << layer_param.name() << dim_string;
auto tmp_out_dims = convLayer->getOutput(0)->getDimensions();
std::string dim_string = "input: ";
for (int i = 0; i < 3; ++i) {
absl::StrAppend(&dim_string, " ",
convLayer->getInput(0)->getDimensions().d[i]);
}
absl::StrAppend(&dim_string, " | output: ");
for (int i = 0; i < 3; ++i) {
absl::StrAppend(&dim_string, " ", tmp_out_dims.d[i]);
}
AINFO << layer_param.name() << dim_string;
#endif
}
}

void RTNet::addDeconvLayer(const LayerParameter &layer_param,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ void PointPillars::InitTRT() {
OnnxToTRTModel(rpn_onnx_file_, &rpn_engine_);
if (pfe_engine_ == nullptr || rpn_engine_ == nullptr) {
AERROR << "Failed to load ONNX file.";
return;
}

// create execution context from the engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ bool CameraBevDetectionComponent::Proc(
std::shared_ptr<apollo::perception::PerceptionObstacles> out_message(
new (std::nothrow) apollo::perception::PerceptionObstacles);
apollo::common::ErrorCode error_code = apollo::common::OK;
if (cambackmsg == nullptr) {
AERROR << "camera_back msg is not ready!";
return false;
}
const double msg_timestamp =
cambackmsg->measurement_time() + timestamp_offset_;

Expand Down Expand Up @@ -313,10 +317,6 @@ bool CameraBevDetectionComponent::Proc(
pipeline::DataFrame data_frame_cambr;
data_frame_cambr.camera_frame = &cambr_frame;

if (cambackmsg == nullptr) {
AERROR << "camera_back msg is not ready!";
return false;
}
camera::CameraFrame &camb_frame = camera_frames_[5];
const std::string &camb_name = camera_names_[5];
FillCamMessage(cambackmsg, camb_name, &camb_frame);
Expand Down
1 change: 1 addition & 0 deletions modules/planning/planner/lattice/lattice_planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ Status LatticePlanner::PlanOnReferenceLine(
std::dynamic_pointer_cast<LatticeTrajectory1d>(trajectory_pair.first);
if (!lattice_traj_ptr) {
ADEBUG << "Dynamically casting trajectory1d ptr. failed.";
return Status(ErrorCode::PLANNING_ERROR, "Failed to cast trajectory");
}

if (lattice_traj_ptr->has_target_position()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1208,12 +1208,12 @@ bool OpenSpaceRoiDecider::GetParkAndGoBoundary(
bool OpenSpaceRoiDecider::GetParkingSpot(Frame *const frame,
std::array<Vec2d, 4> *vertices,
Path *nearby_path) {
const auto &routing_request = frame->local_view().routing->routing_request();
auto plot_type = routing_request.parking_info().parking_space_type();
if (frame == nullptr) {
AERROR << "Invalid frame, fail to GetParkingSpotFromMap from frame. ";
return false;
}
const auto &routing_request = frame->local_view().routing->routing_request();
auto plot_type = routing_request.parking_info().parking_space_type();

LaneInfoConstPtr nearest_lane;
// Check if last frame lane is available
Expand Down