Skip to content

Commit c3b7e2c

Browse files
tobifalkcassava
authored andcommitted
clothoid_fit: Add lane boundary clothoid fitting plugin
1 parent a2283b9 commit c3b7e2c

12 files changed

+1543
-0
lines changed

conanfile.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def cloe_requires(dep):
5050
cloe_requires("cloe-runtime")
5151
cloe_requires("cloe-models")
5252
cloe_requires("cloe-plugin-basic")
53+
cloe_requires("cloe-plugin-clothoid-fit")
5354
cloe_requires("cloe-plugin-gndtruth-extractor")
5455
cloe_requires("cloe-plugin-minimator")
5556
cloe_requires("cloe-plugin-mocks")

plugins/clothoid_fit/CMakeLists.txt

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
2+
3+
project(cloe_plugin_clothoid_fit LANGUAGES CXX)
4+
5+
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
6+
conan_basic_setup(TARGETS)
7+
8+
add_library(g1-fitting-lib STATIC
9+
src/g1_fitting.cpp
10+
)
11+
set_target_properties(g1-fitting-lib PROPERTIES
12+
CXX_STANDARD 14
13+
CXX_STANDARD_REQUIRED ON
14+
POSITION_INDEPENDENT_CODE ON
15+
)
16+
17+
include(CloePluginSetup)
18+
cloe_add_plugin(
19+
TARGET component_clothoid_fit
20+
SOURCES
21+
src/clothoid_fit.cpp
22+
LINK_LIBRARIES
23+
g1-fitting-lib
24+
CONAN_PKG::eigen
25+
CONAN_PKG::cloe-runtime
26+
CONAN_PKG::cloe-models
27+
COMPILE_DEFINITIONS
28+
PROJECT_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"
29+
)
30+
31+
option(BuildTests "Build tests?" ON)
32+
if(BuildTests)
33+
message(STATUS "-> Enable testing")
34+
enable_testing()
35+
include(GoogleTest)
36+
37+
add_executable(test-clothoid-fit
38+
src/g1_fitting_test.cpp
39+
src/clothoid_test.cpp
40+
)
41+
set_target_properties(test-clothoid-fit PROPERTIES
42+
CXX_STANDARD 14
43+
CXX_STANDARD_REQUIRED ON
44+
)
45+
target_link_libraries(test-clothoid-fit
46+
PRIVATE
47+
g1-fitting-lib
48+
CONAN_PKG::gtest
49+
CONAN_PKG::eigen
50+
CONAN_PKG::cloe-runtime
51+
CONAN_PKG::cloe-models
52+
)
53+
gtest_add_tests(TARGET test-clothoid-fit)
54+
endif()

plugins/clothoid_fit/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../../Makefile.package

plugins/clothoid_fit/conanfile.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
from pathlib import Path
2+
from conans import ConanFile, CMake, RunEnvironment, tools
3+
4+
5+
class CloeComponentClothoidFit(ConanFile):
6+
name = "cloe-plugin-clothoid-fit"
7+
url = "https://github.com/eclipse/cloe"
8+
description = "Cloe component plugin that generates clothoids from given lane boundary point lists."
9+
license = "Apache-2.0"
10+
settings = "os", "compiler", "build_type", "arch"
11+
options = {
12+
"test": [True, False],
13+
"pedantic": [True, False],
14+
}
15+
default_options = {
16+
"test": True,
17+
"pedantic": True,
18+
}
19+
generators = "cmake"
20+
no_copy_source = True
21+
exports_sources = [
22+
"src/*",
23+
"CMakeLists.txt",
24+
]
25+
requires = [
26+
"eigen/[~=3.4.0]",
27+
]
28+
29+
_cmake = None
30+
31+
def set_version(self):
32+
version_file = Path(self.recipe_folder) / "../../VERSION"
33+
if version_file.exists():
34+
self.version = tools.load(version_file).strip()
35+
else:
36+
git = tools.Git(folder=self.recipe_folder)
37+
self.version = git.run("describe --dirty=-dirty")[1:]
38+
39+
def requirements(self):
40+
self.requires(f"cloe-runtime/{self.version}@cloe/develop")
41+
self.requires(f"cloe-models/{self.version}@cloe/develop")
42+
43+
def build_requirements(self):
44+
if self.options.test:
45+
self.build_requires("gtest/[~1.10]")
46+
47+
def _configure_cmake(self):
48+
if self._cmake:
49+
return self._cmake
50+
self._cmake = CMake(self)
51+
self._cmake.definitions["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
52+
self._cmake.definitions["BuildTests"] = self.options.test
53+
self._cmake.definitions["TargetLintingExtended"] = self.options.pedantic
54+
self._cmake.configure()
55+
return self._cmake
56+
57+
def build(self):
58+
cmake = self._configure_cmake()
59+
cmake.build()
60+
if self.options.test:
61+
with tools.environment_append(RunEnvironment(self).vars):
62+
cmake.test()
63+
64+
def package(self):
65+
cmake = self._configure_cmake()
66+
cmake.install()
67+
68+
def package_id(self):
69+
del self.info.options.pedantic
70+
del self.info.options.test
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2023 Robert Bosch GmbH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
*/
18+
/**
19+
* \file clothoid_fit.cpp
20+
* \see clothoid_fit.hpp
21+
*
22+
*/
23+
24+
#include "clothoid_fit.hpp"
25+
26+
#include <cloe/component.hpp> // for Component, Json
27+
#include <cloe/component/lane_sensor.hpp> // for LaneBoundarySensor
28+
#include <cloe/plugin.hpp> // for EXPORT_CLOE_PLUGIN
29+
30+
namespace cloe {
31+
32+
namespace component {
33+
34+
DEFINE_COMPONENT_FACTORY(ClothoidFitFactory, ClothoidFitConf, "clothoid_fit",
35+
"fit clothoids to polylines")
36+
37+
DEFINE_COMPONENT_FACTORY_MAKE(ClothoidFitFactory, LaneBoundaryClothoidFit, LaneBoundarySensor)
38+
39+
} // namespace component
40+
} // namespace cloe
41+
42+
// Register factory as plugin entrypoint
43+
EXPORT_CLOE_PLUGIN(cloe::component::ClothoidFitFactory)

0 commit comments

Comments
 (0)