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

(DO NOT MERGE)feat(lanelet2_map_preprocessor): port lanelet2_map_preprocessor from Autoware.Universe #3

Closed
wants to merge 2 commits into from

Conversation

mitsudome-r
Copy link
Member

THIS IF FOR TESTING UPDATED CI
DO NOT MERGE THIS PULL REQUEST!!!!

Copy link

codecov bot commented Feb 9, 2024

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@mitsudome-r mitsudome-r closed this Feb 9, 2024
@mitsudome-r mitsudome-r reopened this Feb 9, 2024
@mitsudome-r mitsudome-r changed the title feat(lanelet2_map_preprocessor): port lanelet2_map_preprocessor from Autoware.Universe (DO NOT MERGE)feat(lanelet2_map_preprocessor): port lanelet2_map_preprocessor from Autoware.Universe Feb 9, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/12)

#include <unordered_set>
#include <vector>

using lanelet::utils::getId;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ misc-unused-using-decls ⚠️
using decl getId is unused

#include <vector>

using lanelet::utils::getId;
using lanelet::utils::to2D;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ misc-unused-using-decls ⚠️
using decl to2D is unused

using lanelet::utils::getId;
using lanelet::utils::to2D;

bool loadLaneletMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
bool loadLaneletMap(
bool load_lanelet_map(

lanelet::LaneletMapPtr llt_map_ptr(new lanelet::LaneletMap);
lanelet::projection::MGRSProjector projector;

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
if (!load_lanelet_map(llt_map_path, llt_map_ptr, projector)) {


bool exists(std::unordered_set<lanelet::Id> & set, lanelet::Id element)
{
return std::find(set.begin(), set.end(), element) != set.end();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-inefficient-algorithm ⚠️
this STL algorithm call should be replaced with a container method

Suggested change
return std::find(set.begin(), set.end(), element) != set.end();
return set.find(element) != set.end();

return std::find(set.begin(), set.end(), element) != set.end();
}

lanelet::Lanelets convertToVector(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertToVector

Suggested change
lanelet::Lanelets convertToVector(lanelet::LaneletMapPtr & lanelet_map_ptr)
lanelet::Lanelets convert_to_vector(lanelet::LaneletMapPtr & lanelet_map_ptr)

}
void fixTags(lanelet::LaneletMapPtr & lanelet_map_ptr)
{
auto lanelets = convertToVector(lanelet_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertToVector

Suggested change
auto lanelets = convertToVector(lanelet_map_ptr);
auto lanelets = convert_to_vector(lanelet_map_ptr);

lanelet::Lanelets convertToVector(lanelet::LaneletMapPtr & lanelet_map_ptr)
{
lanelet::Lanelets lanelets;
for (lanelet::Lanelet lanelet : lanelet_map_ptr->laneletLayer) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-for-range-copy ⚠️
loop variable is copied but only used as const reference; consider making it a const reference

Suggested change
for (lanelet::Lanelet lanelet : lanelet_map_ptr->laneletLayer) {
for (const lanelet::Lanelet& lanelet : lanelet_map_ptr->laneletLayer) {

}
return lanelets;
}
void fixTags(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function fixTags

Suggested change
void fixTags(lanelet::LaneletMapPtr & lanelet_map_ptr)
void fix_tags(lanelet::LaneletMapPtr & lanelet_map_ptr)

return EXIT_FAILURE;
}

fixTags(llt_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function fixTags

Suggested change
fixTags(llt_map_ptr);
fix_tags(llt_map_ptr);

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (2/12)

void fixTags(lanelet::LaneletMapPtr & lanelet_map_ptr)
{
auto lanelets = convertToVector(lanelet_map_ptr);
lanelet::traffic_rules::TrafficRulesPtr trafficRules =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable trafficRules

Suggested change
lanelet::traffic_rules::TrafficRulesPtr trafficRules =
lanelet::traffic_rules::TrafficRulesPtr traffic_rules =

lanelet::traffic_rules::TrafficRulesFactory::create(
lanelet::Locations::Germany, lanelet::Participants::Vehicle);
lanelet::routing::RoutingGraphUPtr routingGraph =
lanelet::routing::RoutingGraph::build(*lanelet_map_ptr, *trafficRules);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable trafficRules

Suggested change
lanelet::routing::RoutingGraph::build(*lanelet_map_ptr, *trafficRules);
lanelet::routing::RoutingGraph::build(*lanelet_map_ptr, *traffic_rules);

lanelet::traffic_rules::TrafficRulesPtr trafficRules =
lanelet::traffic_rules::TrafficRulesFactory::create(
lanelet::Locations::Germany, lanelet::Participants::Vehicle);
lanelet::routing::RoutingGraphUPtr routingGraph =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable routingGraph

Suggested change
lanelet::routing::RoutingGraphUPtr routingGraph =
lanelet::routing::RoutingGraphUPtr routing_graph =

lanelet::routing::RoutingGraph::build(*lanelet_map_ptr, *trafficRules);

for (auto & llt : lanelets) {
if (!routingGraph->conflicting(llt).empty()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable routingGraph

Suggested change
if (!routingGraph->conflicting(llt).empty()) {
if (!routing_graph->conflicting(llt).empty()) {

continue;
}
llt.attributes().erase("turn_direction");
if (!!routingGraph->adjacentRight(llt)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable routingGraph

Suggested change
if (!!routingGraph->adjacentRight(llt)) {
if (!!routing_graph->adjacentRight(llt)) {

if (!!routingGraph->adjacentRight(llt)) {
llt.rightBound().attributes()["lane_change"] = "yes";
}
if (!!routingGraph->adjacentLeft(llt)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable routingGraph

Suggested change
if (!!routingGraph->adjacentLeft(llt)) {
if (!!routing_graph->adjacentLeft(llt)) {

#include <unordered_set>
#include <vector>

bool loadLaneletMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
bool loadLaneletMap(
bool load_lanelet_map(


pcl::PointCloud<pcl::PointXYZ>::Ptr pcd_map_ptr(new pcl::PointCloud<pcl::PointXYZ>);

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
if (!load_lanelet_map(llt_map_path, llt_map_ptr, projector)) {

return true;
}

bool loadPCDMap(const std::string & pcd_map_path, pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadPCDMap

Suggested change
bool loadPCDMap(const std::string & pcd_map_path, pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr)
bool load_pcd_map(const std::string & pcd_map_path, pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr)

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
return EXIT_FAILURE;
}
if (!loadPCDMap(pcd_map_path, pcd_map_ptr)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadPCDMap

Suggested change
if (!loadPCDMap(pcd_map_path, pcd_map_ptr)) {
if (!load_pcd_map(pcd_map_path, pcd_map_ptr)) {

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (3/12)

return true;
}

double getMinHeightAroundPoint(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function getMinHeightAroundPoint

Suggested change
double getMinHeightAroundPoint(
double get_min_height_around_point(

pcl_pt.y = pt.y();
pcl_pt.z = pt.z();
double min_height =
getMinHeightAroundPoint(pcd_map_ptr, kdtree, pcl_pt, search_radius3d, search_radius2d);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function getMinHeightAroundPoint

Suggested change
getMinHeightAroundPoint(pcd_map_ptr, kdtree, pcl_pt, search_radius3d, search_radius2d);
get_min_height_around_point(pcd_map_ptr, kdtree, pcl_pt, search_radius3d, search_radius2d);

pcl_pt.y = pt.y();
pcl_pt.z = pt.z();
double min_height =
getMinHeightAroundPoint(pcd_map_ptr, kdtree, pcl_pt, search_radius3d, search_radius2d);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function getMinHeightAroundPoint

Suggested change
getMinHeightAroundPoint(pcd_map_ptr, kdtree, pcl_pt, search_radius3d, search_radius2d);
get_min_height_around_point(pcd_map_ptr, kdtree, pcl_pt, search_radius3d, search_radius2d);

const pcl::KdTreeFLANN<pcl::PointXYZ> & kdtree, const pcl::PointXYZ & search_pt,
const double search_radius3d, const double search_radius2d)
{
std::vector<int> pointIdxRadiusSearch;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable pointIdxRadiusSearch

const double search_radius3d, const double search_radius2d)
{
std::vector<int> pointIdxRadiusSearch;
std::vector<float> pointRadiusSquaredDistance;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable pointRadiusSquaredDistance

Suggested change
std::vector<float> pointRadiusSquaredDistance;
std::vector<float> point_radius_squared_distance;

std::vector<float> pointRadiusSquaredDistance;
if (
kdtree.radiusSearch(
search_pt, search_radius3d, pointIdxRadiusSearch, pointRadiusSquaredDistance) <= 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for variable pointRadiusSquaredDistance

Suggested change
search_pt, search_radius3d, pointIdxRadiusSearch, pointRadiusSquaredDistance) <= 0) {
search_pt, search_radius3d, pointIdxRadiusSearch, point_radius_squared_distance) <= 0) {

kdtree.radiusSearch(
search_pt, search_radius3d, pointIdxRadiusSearch, pointRadiusSquaredDistance) <= 0) {
std::cout << "no points found within 3d radius " << search_radius3d << std::endl;
return search_pt.z;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

Comment on lines +76 to +77
for (std::size_t i = 0; i < pointIdxRadiusSearch.size(); i++) {
std::size_t pt_idx = pointIdxRadiusSearch.at(i);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ modernize-loop-convert ⚠️
use range-based for loop instead

Suggested change
for (std::size_t i = 0; i < pointIdxRadiusSearch.size(); i++) {
std::size_t pt_idx = pointIdxRadiusSearch.at(i);
for (unsigned long pt_idx : pointIdxRadiusSearch) {

for (std::size_t i = 0; i < pointIdxRadiusSearch.size(); i++) {
std::size_t pt_idx = pointIdxRadiusSearch.at(i);
const auto pt = pcd_map_ptr->points.at(pt_idx);
if (pt.z > min_height) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

if (pt.z > min_height) {
continue;
}
double distance2d = std::hypot(pt.x - search_pt.x, pt.y - search_pt.y);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (4/12)

if (pt.z > min_height) {
continue;
}
double distance2d = std::hypot(pt.x - search_pt.x, pt.y - search_pt.y);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

if (pt.z > min_height) {
continue;
}
double distance2d = std::hypot(pt.x - search_pt.x, pt.y - search_pt.y);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

if (pt.z > min_height) {
continue;
}
double distance2d = std::hypot(pt.x - search_pt.x, pt.y - search_pt.y);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

double distance2d = std::hypot(pt.x - search_pt.x, pt.y - search_pt.y);
if (distance2d < search_radius2d) {
found = true;
min_height = pt.z;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

}
}
if (!found) {
min_height = search_pt.z;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead


bool exists(std::unordered_set<lanelet::Id> & set, lanelet::Id element)
{
return std::find(set.begin(), set.end(), element) != set.end();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-inefficient-algorithm ⚠️
this STL algorithm call should be replaced with a container method

Suggested change
return std::find(set.begin(), set.end(), element) != set.end();
return set.find(element) != set.end();

return std::find(set.begin(), set.end(), element) != set.end();
}

void adjustHeight(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function adjustHeight

Suggested change
void adjustHeight(
void adjust_height(

return EXIT_FAILURE;
}

adjustHeight(pcd_map_ptr, llt_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function adjustHeight

Suggested change
adjustHeight(pcd_map_ptr, llt_map_ptr);
adjust_height(pcd_map_ptr, llt_map_ptr);

continue;
}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

continue;
}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from double to float

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (5/12)

}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from double to float

pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
pcl_pt.z = pt.z();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
pcl_pt.z = pt.z();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from double to float

continue;
}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

continue;
}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from double to float

}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

}
pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from double to float

pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
pcl_pt.z = pt.z();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

pcl::PointXYZ pcl_pt;
pcl_pt.x = pt.x();
pcl_pt.y = pt.y();
pcl_pt.z = pt.z();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from double to float

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (6/12)

#include <unordered_set>
#include <vector>

using lanelet::utils::getId;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ misc-unused-using-decls ⚠️
using decl getId is unused

using lanelet::utils::getId;
using lanelet::utils::to2D;

bool loadLaneletMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
bool loadLaneletMap(
bool load_lanelet_map(

lanelet::LaneletMapPtr llt_map_ptr(new lanelet::LaneletMap);
lanelet::projection::MGRSProjector projector;

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
if (!load_lanelet_map(llt_map_path, llt_map_ptr, projector)) {


bool exists(std::unordered_set<lanelet::Id> & set, lanelet::Id element)
{
return std::find(set.begin(), set.end(), element) != set.end();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-inefficient-algorithm ⚠️
this STL algorithm call should be replaced with a container method

Suggested change
return std::find(set.begin(), set.end(), element) != set.end();
return set.find(element) != set.end();

return std::find(set.begin(), set.end(), element) != set.end();
}

lanelet::LineStrings3d convertLineLayerToLineStrings(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertLineLayerToLineStrings

Suggested change
lanelet::LineStrings3d convertLineLayerToLineStrings(lanelet::LaneletMapPtr & lanelet_map_ptr)
lanelet::LineStrings3d convert_line_layer_to_line_strings(lanelet::LaneletMapPtr & lanelet_map_ptr)


void mergeLines(lanelet::LaneletMapPtr & lanelet_map_ptr)
{
auto lines = convertLineLayerToLineStrings(lanelet_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertLineLayerToLineStrings

Suggested change
auto lines = convertLineLayerToLineStrings(lanelet_map_ptr);
auto lines = convert_line_layer_to_line_strings(lanelet_map_ptr);

return lines;
}

lanelet::ConstPoint3d get3DPointFrom2DArcLength(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function get3DPointFrom2DArcLength

Suggested change
lanelet::ConstPoint3d get3DPointFrom2DArcLength(
lanelet::ConstPoint3d get3_d_point_from2_d_arc_length(

{
auto arc_coordinate = lanelet::geometry::toArcCoordinates(to2D(line), to2D(search_point));
std::cout << arc_coordinate.length << " " << arc_coordinate.distance << std::endl;
return get3DPointFrom2DArcLength(line, arc_coordinate.length).basicPoint();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function get3DPointFrom2DArcLength

Suggested change
return get3DPointFrom2DArcLength(line, arc_coordinate.length).basicPoint();
return get3_d_point_from2_d_arc_length(line, arc_coordinate.length).basicPoint();

double ratio = (s - accumulated_distance2d) / distance2d;
auto interpolated_pt = prev_pt.basicPoint() * (1 - ratio) + pt.basicPoint() * ratio;
std::cout << interpolated_pt << std::endl;
return lanelet::ConstPoint3d(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ modernize-return-braced-init-list ⚠️
avoid repeating the return type from the declaration; use a braced initializer list instead

prev_pt = pt;
}
RCLCPP_ERROR(rclcpp::get_logger("merge_close_lines"), "interpolation failed");
return lanelet::ConstPoint3d();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ modernize-return-braced-init-list ⚠️
avoid repeating the return type from the declaration; use a braced initializer list instead

Suggested change
return lanelet::ConstPoint3d();
return {};

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (7/12)

return lanelet::ConstPoint3d();
}

double getLineLength(const lanelet::ConstLineString3d & line)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function getLineLength

Suggested change
double getLineLength(const lanelet::ConstLineString3d & line)
double get_line_length(const lanelet::ConstLineString3d & line)


double getLineLength(const lanelet::ConstLineString3d & line)
{
return boost::geometry::length(line.basicLineString());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from typename default_length_result<vector<Matrix<double, 3, 1, 0>>>::type (aka long double) to double

return boost::geometry::length(line.basicLineString());
}

bool areLinesSame(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function areLinesSame

Suggested change
bool areLinesSame(
bool are_lines_same(

auto line_i = lines.at(i);
for (size_t j = 0; j < i; j++) {
auto line_j = lines.at(j);
if (areLinesSame(line_i, line_j)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function areLinesSame

Suggested change
if (areLinesSame(line_i, line_j)) {
if (are_lines_same(line_i, line_j)) {

sum_distance += boost::geometry::distance(pt.basicPoint(), line1);
}

double avg_distance = sum_distance / (line1.size() + line2.size());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from unsigned long to double

Comment on lines +118 to +122
if (avg_distance < 1.0) {
return true;
} else {
return false;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-simplify-boolean-expr ⚠️
redundant boolean literal in conditional return statement

Suggested change
if (avg_distance < 1.0) {
return true;
} else {
return false;
}
return avg_distance < 1.0;

std::cout << line1 << " " << line2 << " " << avg_distance << std::endl;
if (avg_distance < 1.0) {
return true;
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-else-after-return ⚠️
do not use else after return

}
}

lanelet::BasicPoint3d getClosestPointOnLine(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function getClosestPointOnLine

Suggested change
lanelet::BasicPoint3d getClosestPointOnLine(
lanelet::BasicPoint3d get_closest_point_on_line(

lanelet::Points3d new_points;
for (const auto & p1 : line1) {
lanelet::BasicPoint3d p1_basic_point = p1.basicPoint();
lanelet::BasicPoint3d p2_basic_point = getClosestPointOnLine(p1, line2);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function getClosestPointOnLine

Suggested change
lanelet::BasicPoint3d p2_basic_point = getClosestPointOnLine(p1, line2);
lanelet::BasicPoint3d p2_basic_point = get_closest_point_on_line(p1, line2);

return get3DPointFrom2DArcLength(line, arc_coordinate.length).basicPoint();
}

lanelet::LineString3d mergeTwoLines(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function mergeTwoLines

Suggested change
lanelet::LineString3d mergeTwoLines(
lanelet::LineString3d merge_two_lines(

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (8/12)

for (size_t j = 0; j < i; j++) {
auto line_j = lines.at(j);
if (areLinesSame(line_i, line_j)) {
auto merged_line = mergeTwoLines(line_i, line_j);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function mergeTwoLines

Suggested change
auto merged_line = mergeTwoLines(line_i, line_j);
auto merged_line = merge_two_lines(line_i, line_j);

{
lanelet::Points3d new_points;
for (const auto & p1 : line1) {
lanelet::BasicPoint3d p1_basic_point = p1.basicPoint();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-unnecessary-copy-initialization ⚠️
the variable p1_basic_point is copy-constructed from a const reference but is only used as const reference; consider making it a const reference

Suggested change
lanelet::BasicPoint3d p1_basic_point = p1.basicPoint();
const lanelet::BasicPoint3d& p1_basic_point = p1.basicPoint();

lanelet::Point3d new_point(lanelet::utils::getId(), new_basic_point);
new_points.push_back(new_point);
}
return lanelet::LineString3d(lanelet::utils::getId(), new_points);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ modernize-return-braced-init-list ⚠️
avoid repeating the return type from the declaration; use a braced initializer list instead

return lanelet::LineString3d(lanelet::utils::getId(), new_points);
}

void copyData(lanelet::LineString3d & dst, lanelet::LineString3d & src)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function copyData

Suggested change
void copyData(lanelet::LineString3d & dst, lanelet::LineString3d & src)
void copy_data(lanelet::LineString3d & dst, lanelet::LineString3d & src)

Comment on lines +166 to +167
copyData(line_i, merged_line);
copyData(line_j, merged_line);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function copyData

Suggested change
copyData(line_i, merged_line);
copyData(line_j, merged_line);
copy_data(line_i, merged_line);
copy_data(line_j, merged_line);

}
}

void mergeLines(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function mergeLines

Suggested change
void mergeLines(lanelet::LaneletMapPtr & lanelet_map_ptr)
void merge_lines(lanelet::LaneletMapPtr & lanelet_map_ptr)

return EXIT_FAILURE;
}

mergeLines(llt_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function mergeLines

Suggested change
mergeLines(llt_map_ptr);
merge_lines(llt_map_ptr);

}
}

int main(int argc, char * argv[])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ bugprone-exception-escape ⚠️
an exception may be thrown in function main which should not throw exceptions

#include <unordered_set>
#include <vector>

bool loadLaneletMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
bool loadLaneletMap(
bool load_lanelet_map(

lanelet::LaneletMapPtr llt_map_ptr(new lanelet::LaneletMap);
lanelet::projection::MGRSProjector projector;

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
if (!load_lanelet_map(llt_map_path, llt_map_ptr, projector)) {

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (9/12)


bool exists(std::unordered_set<lanelet::Id> & set, lanelet::Id element)
{
return std::find(set.begin(), set.end(), element) != set.end();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-inefficient-algorithm ⚠️
this STL algorithm call should be replaced with a container method

Suggested change
return std::find(set.begin(), set.end(), element) != set.end();
return set.find(element) != set.end();

return std::find(set.begin(), set.end(), element) != set.end();
}

lanelet::Points3d convertPointsLayerToPoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertPointsLayerToPoints

Suggested change
lanelet::Points3d convertPointsLayerToPoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
lanelet::Points3d convert_points_layer_to_points(lanelet::LaneletMapPtr & lanelet_map_ptr)


void mergePoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
{
const auto & points = convertPointsLayerToPoints(lanelet_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertPointsLayerToPoints

Suggested change
const auto & points = convertPointsLayerToPoints(lanelet_map_ptr);
const auto & points = convert_points_layer_to_points(lanelet_map_ptr);

// return lanelet::LineString3d(lanelet::utils::getId(), new_points);
// }

void mergePoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function mergePoints

Suggested change
void mergePoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
void merge_points(lanelet::LaneletMapPtr & lanelet_map_ptr)

return EXIT_FAILURE;
}

mergePoints(llt_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function mergePoints

Suggested change
mergePoints(llt_map_ptr);
merge_points(llt_map_ptr);

}
}

int main(int argc, char * argv[])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ bugprone-exception-escape ⚠️
an exception may be thrown in function main which should not throw exceptions

#include <unordered_set>
#include <vector>

bool loadLaneletMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
bool loadLaneletMap(
bool load_lanelet_map(

lanelet::LaneletMapPtr llt_map_ptr(new lanelet::LaneletMap);
lanelet::projection::MGRSProjector projector;

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
if (!load_lanelet_map(llt_map_path, llt_map_ptr, projector)) {


bool exists(std::unordered_set<lanelet::Id> & set, lanelet::Id element)
{
return std::find(set.begin(), set.end(), element) != set.end();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-inefficient-algorithm ⚠️
this STL algorithm call should be replaced with a container method

Suggested change
return std::find(set.begin(), set.end(), element) != set.end();
return set.find(element) != set.end();

return std::find(set.begin(), set.end(), element) != set.end();
}

lanelet::Points3d convertPointsLayerToPoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertPointsLayerToPoints

Suggested change
lanelet::Points3d convertPointsLayerToPoints(lanelet::LaneletMapPtr & lanelet_map_ptr)
lanelet::Points3d convert_points_layer_to_points(lanelet::LaneletMapPtr & lanelet_map_ptr)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (10/12)

return points;
}

lanelet::LineStrings3d convertLineLayerToLineStrings(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function convertLineLayerToLineStrings

Suggested change
lanelet::LineStrings3d convertLineLayerToLineStrings(lanelet::LaneletMapPtr & lanelet_map_ptr)
lanelet::LineStrings3d convert_line_layer_to_line_strings(lanelet::LaneletMapPtr & lanelet_map_ptr)

return lines;
}

void removeUnreferencedGeometry(lanelet::LaneletMapPtr & lanelet_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function removeUnreferencedGeometry

Suggested change
void removeUnreferencedGeometry(lanelet::LaneletMapPtr & lanelet_map_ptr)
void remove_unreferenced_geometry(lanelet::LaneletMapPtr & lanelet_map_ptr)

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
return EXIT_FAILURE;
}
removeUnreferencedGeometry(llt_map_ptr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function removeUnreferencedGeometry

Suggested change
removeUnreferencedGeometry(llt_map_ptr);
remove_unreferenced_geometry(llt_map_ptr);

void removeUnreferencedGeometry(lanelet::LaneletMapPtr & lanelet_map_ptr)
{
lanelet::LaneletMapPtr new_map(new lanelet::LaneletMap);
for (auto llt : lanelet_map_ptr->laneletLayer) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-for-range-copy ⚠️
loop variable is copied but only used as const reference; consider making it a const reference

Suggested change
for (auto llt : lanelet_map_ptr->laneletLayer) {
for (const auto& llt : lanelet_map_ptr->laneletLayer) {

#include <unordered_set>
#include <vector>

bool loadLaneletMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
bool loadLaneletMap(
bool load_lanelet_map(


pcl::PointCloud<pcl::PointXYZ>::Ptr pcd_map_ptr(new pcl::PointCloud<pcl::PointXYZ>);

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadLaneletMap

Suggested change
if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
if (!load_lanelet_map(llt_map_path, llt_map_ptr, projector)) {

return true;
}

bool loadPCDMap(const std::string & pcd_map_path, pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadPCDMap

Suggested change
bool loadPCDMap(const std::string & pcd_map_path, pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr)
bool load_pcd_map(const std::string & pcd_map_path, pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr)

if (!loadLaneletMap(llt_map_path, llt_map_ptr, projector)) {
return EXIT_FAILURE;
}
if (!loadPCDMap(pcd_map_path, pcd_map_ptr)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function loadPCDMap

Suggested change
if (!loadPCDMap(pcd_map_path, pcd_map_ptr)) {
if (!load_pcd_map(pcd_map_path, pcd_map_ptr)) {

return true;
}

void transformMaps(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function transformMaps

Suggested change
void transformMaps(
void transform_maps(

node->declare_parameter<std::string>("mgrs_grid", projector.getProjectedMGRSGrid());
std::cout << "using mgrs grid: " << mgrs_grid << std::endl;

transformMaps(pcd_map_ptr, llt_map_ptr, affine);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function transformMaps

Suggested change
transformMaps(pcd_map_ptr, llt_map_ptr, affine);
transform_maps(pcd_map_ptr, llt_map_ptr, affine);

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (11/12)


void transformMaps(
pcl::PointCloud<pcl::PointXYZ>::Ptr & pcd_map_ptr, lanelet::LaneletMapPtr & lanelet_map_ptr,
const Eigen::Affine3d affine)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ performance-unnecessary-value-param ⚠️
the const qualified parameter affine is copied for each invocation; consider making it a reference

Suggested change
const Eigen::Affine3d affine)
const Eigen::Affine3d& affine)


{
for (auto & pt : pcd_map_ptr->points) {
Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead


{
for (auto & pt : pcd_map_ptr->points) {
Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead


{
for (auto & pt : pcd_map_ptr->points) {
Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

for (auto & pt : pcd_map_ptr->points) {
Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
auto transformed_pt = affine * eigen_pt;
pt.x = transformed_pt.x();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

for (auto & pt : pcd_map_ptr->points) {
Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
auto transformed_pt = affine * eigen_pt;
pt.x = transformed_pt.x();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0>, 1>::Scalar (aka double) to float

Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
auto transformed_pt = affine * eigen_pt;
pt.x = transformed_pt.x();
pt.y = transformed_pt.y();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

Eigen::Vector3d eigen_pt(pt.x, pt.y, pt.z);
auto transformed_pt = affine * eigen_pt;
pt.x = transformed_pt.x();
pt.y = transformed_pt.y();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0>, 1>::Scalar (aka double) to float

auto transformed_pt = affine * eigen_pt;
pt.x = transformed_pt.x();
pt.y = transformed_pt.y();
pt.z = transformed_pt.z();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-pro-type-union-access ⚠️
do not access members of unions; use (boost::)variant instead

auto transformed_pt = affine * eigen_pt;
pt.x = transformed_pt.x();
pt.y = transformed_pt.y();
pt.z = transformed_pt.z();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-narrowing-conversions ⚠️
narrowing conversion from Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0>, 1>::Scalar (aka double) to float

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (12/12)

}
}

Eigen::Affine3d createAffineMatrixFromXYZRPY(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function createAffineMatrixFromXYZRPY

Suggested change
Eigen::Affine3d createAffineMatrixFromXYZRPY(
Eigen::Affine3d create_affine_matrix_from_xyzrpy(

if (!loadPCDMap(pcd_map_path, pcd_map_ptr)) {
return EXIT_FAILURE;
}
Eigen::Affine3d affine = createAffineMatrixFromXYZRPY(x, y, z, roll, pitch, yaw);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-identifier-naming ⚠️
invalid case style for function createAffineMatrixFromXYZRPY

Suggested change
Eigen::Affine3d affine = createAffineMatrixFromXYZRPY(x, y, z, roll, pitch, yaw);
Eigen::Affine3d affine = create_affine_matrix_from_xyzrpy(x, y, z, roll, pitch, yaw);

return trans * rot;
}

int main(int argc, char * argv[])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ bugprone-exception-escape ⚠️
an exception may be thrown in function main which should not throw exceptions

@mitsudome-r mitsudome-r closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant