Skip to content

Commit

Permalink
feat(map_loader): use dummy projector when using local coordinates (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#5866)

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

Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>

* fix build warning

Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>

* fix runtime error

Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>

* fix reverse function

Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>

---------

Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>
  • Loading branch information
isamu-takagi authored and karishma1911 committed May 26, 2024
1 parent 8470ea8 commit d779793
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
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
{
public:
LocalProjector() : Projector(Origin(GPSPoint{})) {}

BasicPoint3d forward(const GPSPoint & gps) const override // NOLINT
{
return BasicPoint3d{0.0, 0.0, gps.ele};
}

GPSPoint reverse(const BasicPoint3d & point) const override
{
return GPSPoint{0.0, 0.0, point.z()};
}
};

} // 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

0 comments on commit d779793

Please sign in to comment.