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

feat(map_loader): use dummy projector when using local coordinates #5866

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2023 The Autoware Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LANELET2_MAP_LOADER__LANELET2_LOCAL_PROJECTOR_HPP_
#define LANELET2_MAP_LOADER__LANELET2_LOCAL_PROJECTOR_HPP_

#include <lanelet2_io/Projection.h>

namespace lanelet::projection
{

class LocalProjector : public Projector

Check warning on line 23 in map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp

View check run for this annotation

Codecov / codecov/patch

map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp#L23

Added line #L23 was not covered by tests
{
public:
LocalProjector() : Projector(Origin(GPSPoint{})) {}

BasicPoint3d forward(const GPSPoint & gps) const override // NOLINT

Check warning on line 28 in map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp

View check run for this annotation

Codecov / codecov/patch

map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp#L28

Added line #L28 was not covered by tests
{
return BasicPoint3d{0.0, 0.0, gps.ele};

Check warning on line 30 in map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp

View check run for this annotation

Codecov / codecov/patch

map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp#L30

Added line #L30 was not covered by tests
}

GPSPoint reverse(const BasicPoint3d & point) const override

Check warning on line 33 in map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp

View check run for this annotation

Codecov / codecov/patch

map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp#L33

Added line #L33 was not covered by tests
{
return GPSPoint{0.0, 0.0, point.z()};

Check warning on line 35 in map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp

View check run for this annotation

Codecov / codecov/patch

map/map_loader/src/lanelet2_map_loader/lanelet2_local_projector.hpp#L35

Added line #L35 was not covered by tests
}
};

} // namespace lanelet::projection

#endif // LANELET2_MAP_LOADER__LANELET2_LOCAL_PROJECTOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#include "map_loader/lanelet2_map_loader_node.hpp"

#include "lanelet2_local_projector.hpp"

#include <ament_index_cpp/get_package_prefix.hpp>
#include <geography_utils/lanelet2_projector.hpp>
#include <lanelet2_extension/io/autoware_osm_parser.hpp>
Expand Down Expand Up @@ -100,8 +102,7 @@ lanelet::LaneletMapPtr Lanelet2MapLoaderNode::load_map(
return map;
}
} else {
// Use MGRSProjector as parser
lanelet::projection::MGRSProjector projector{};
const lanelet::projection::LocalProjector projector;
const lanelet::LaneletMapPtr map = lanelet::load(lanelet2_filename, projector, &errors);

// overwrite local_x, local_y
Expand Down
Loading