Merge remote-tracking branch 'origin/main' into ObjectPerception

This commit is contained in:
Pascal Serrarens 2023-12-31 09:55:44 +01:00
commit 8246b2708a
8 changed files with 190 additions and 11 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
doxygen/html
doxygen/DoxyWarnLogfile.txt
build
.vscode

60
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,60 @@
# This file is a template, and might need editing before it works on your project.
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
# This file is a template, and might need editing before it works on your project.
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
variables:
GIT_SUBMODULE_STRATEGY: recursive
default:
image: rikorose/gcc-cmake
stages:
- test
unit-test-job:
stage: test
script:
- mkdir build
- cd build
- cmake ..
- cmake --build .
- export GTEST_OUTPUT="xml:report.xml"
- ls -la
- "./RoboidControlTest"
artifacts:
when: always
reports:
junit: build/report.xml
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml

View File

@ -1,16 +1,70 @@
cmake_minimum_required(VERSION 3.13) # CMake version check
if(ESP_PLATFORM)
set(sourcedirs
.
VectorAlgebra/src
)
set(sourcedirs
.
VectorAlgebra/src
set(includedirs
.
VectorAlgebra/include
)
idf_component_register(
SRC_DIRS ${sourcedirs}
INCLUDE_DIRS ${includedirs}
REQUIRES arduino
)
endif()
project(RoboidControl)
add_subdirectory(VectorAlgebra)
#add_subdirectory(test)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_compile_definitions(GTEST)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip
)
set(includedirs
.
VectorAlgebra/include
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
include_directories(
.
VectorAlgebra/include
)
idf_component_register(
SRC_DIRS ${sourcedirs}
INCLUDE_DIRS ${includedirs}
REQUIRES arduino
add_library(RoboidControl STATIC
"Roboid.cpp"
"Perception.cpp"
"Propulsion.cpp"
"Motor.cpp"
"DifferentialDrive.cpp"
"DistanceSensor.cpp"
"Placement.cpp"
"Sensor.cpp"
"Switch.cpp"
"Thing.cpp"
)
enable_testing()
add_executable(
RoboidControlTest
"test/Dummy_test.cc"
)
target_link_libraries(
RoboidControlTest
gtest_main
RoboidControl
VectorAlgebra
)
include(GoogleTest)
gtest_discover_tests(RoboidControlTest)

View File

@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

View File

@ -1420,7 +1420,7 @@ HTML_EXTRA_FILES =
# The default value is: AUTO_LIGHT.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE = AUTO_LIGHT
HTML_COLORSTYLE = LIGHT
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to

0
test/.gitkeep Normal file
View File

View File

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.13) # CMake version check
Project(test)
set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_compile_definitions(GTEST)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
include_directories(include)
enable_testing()
add_executable(
VectorAlgebraTest
"test/Angle_test.cc"
"test/FloatSingle_test.cc"
"test/Vector2_test.cc"
"test/Vector3_test.cc"
"test/Quaternion_test.cc"
)
include(GoogleTest)

25
test/Dummy_test.cc Normal file
View File

@ -0,0 +1,25 @@
#if GTEST
#include <gtest/gtest.h>
#include "DifferentialDrive.h"
#include "DistanceSensor.h"
#include "Roboid.h"
TEST(Dummy, Foo) {
Motor motorLeft = Motor();
Motor motorRight = Motor();
DistanceSensor sensorLeft = DistanceSensor();
DistanceSensor sensorRight = DistanceSensor();
Placement sensors[] = {Placement(&sensorLeft, -30),
Placement(&sensorRight, 30)};
Perception *perception = new Perception(sensors);
DifferentialDrive *propulsion =
new DifferentialDrive(Placement(&motorLeft, Vector3(-1, 0, 0)),
Placement(&motorRight, Vector3(1, 0, 0)));
Roboid *roboid = new Roboid(perception, propulsion);
}
#endif