ADD: updated Libraries and tests

This commit is contained in:
Henry Winkel
2023-12-19 15:51:04 +01:00
parent 22149dc61d
commit e675535586
13 changed files with 42 additions and 33 deletions

3
.gitmodules vendored
View File

@@ -1,6 +1,3 @@
[submodule "libs/SimCore"]
path = libs/SimCore
url = ssh://git@dev-gitea.ftewa.ti.unibw-hamburg.de:12000/hwinkel/SimCore.git
[submodule "libs/json"]
path = libs/json
url = https://github.com/nlohmann/json.git

View File

@@ -7,11 +7,12 @@ IF(NOT TARGET Catch2)
add_subdirectory(libs/Catch2 EXCLUDE_FROM_ALL)
include(libs/Catch2/contrib/Catch.cmake)
ENDIF()
add_compile_definitions(LOGURU_WITH_STREAMS SQLITE_THREADSAFE=2)
IF(NOT TARGET SimCore)
set(TEST_SIMCORE_LIBRARY OFF CACHE INTERNAL "")
add_subdirectory(libs/SimCore EXCLUDE_FROM_ALL)
ENDIF()
# IF(NOT TARGET SimCore)
# set(TEST_SIMCORE_LIBRARY OFF CACHE INTERNAL "")
# add_subdirectory(libs/SimCore EXCLUDE_FROM_ALL)
# ENDIF()
IF(NOT TARGET nlohmann_json)
set(JSON_BuildTests_INIT OFF CACHE INTERNAL "")
@@ -52,9 +53,9 @@ add_library(EntityLibrary STATIC
target_link_libraries(EntityLibrary
loguru
SimCore
eigen
loguru
nlohmann_json
OrderLibrary
kubecontrol

View File

@@ -16,7 +16,7 @@ function(protobuf_generate_cpp)
${ARGN})
FILE(GLOB PROTO_FILES ${protobuf_PROTO_PATH}/*.proto)
set(PROTOC ${CMAKE_BINARY_DIR}/libs/SimCore/libs/whisper-com/libs/protobuf/protoc)
set(PROTOC ${CMAKE_BINARY_DIR}/libs/OrderLibrary/libs/SimCore/libs/whisper-com/libs/protobuf/protoc)
message(STATUS "protoc path: " ${PROTOC})
FOREACH(proto ${PROTO_FILES})
@@ -29,7 +29,7 @@ function(protobuf_generate_cpp)
add_custom_command(
OUTPUT "${protoDIR}/${protoFILENAME}.pb.cc"
DEPENDS "${protoDIR}/${protoFILENAME}.proto"
COMMAND ${PROTOC} --cpp_out=${protoDIR} --proto_path=${protoDIR} --proto_path="${CMAKE_SOURCE_DIR}/libs/SimCore/include/SimCore/Messages/Protos" --proto_path="${CMAKE_SOURCE_DIR}/libs/SimCore/libs/whisper-com/libs/protobuf/src" "${protoDIR}/${protoFILENAME}.proto"
COMMAND ${PROTOC} --cpp_out=${protoDIR} --proto_path=${protoDIR} --proto_path="${CMAKE_SOURCE_DIR}/libs/OrderLibrary/libs/SimCore/include/SimCore/Messages/Protos" --proto_path="${CMAKE_SOURCE_DIR}/libs/OrderLibrary/libs/SimCore/libs/whisper-com/libs/protobuf/src" "${protoDIR}/${protoFILENAME}.proto"
)

View File

@@ -16,6 +16,8 @@
#include <string>
#include <thread>
namespace Entities {
class Sensor {

Submodule libs/SimCore deleted from d345fd5bc3

View File

@@ -10,6 +10,7 @@
#include <memory>
#include <thread>
#include <utility>
#include <loguru.hpp>
namespace Entities {

View File

@@ -23,7 +23,7 @@ class Ship : public Entities::Entity
std::uint32_t GroundTruthPort,
ushort CommandPort
):
Entity( OwnID,EntityName,ownType, EntityKind,SimCore::Side::EntitySide::FRIEND, "127.0.0.1",GroundTruthPort, CommandPort,false)
Entity( OwnID,EntityName,ownType, 10000, EntityKind,SimCore::Side::EntitySide::FRIEND, "127.0.0.1",GroundTruthPort, CommandPort,false)
{
SimCore::Position pos1;
pos1.setGeodesicPos(55, 6, 0);
@@ -33,6 +33,11 @@ class Ship : public Entities::Entity
// LOG_S(INFO)<<std::endl<<Movement_.getPosition().getGeodesicPos();
}
private:
@@ -48,6 +53,11 @@ class Ship : public Entities::Entity
// LOG_S(INFO)<<"distance from start is:" << distance;
};
void stopChild() override
{
};
};

View File

@@ -14,26 +14,26 @@ class Radar : public Entities::Sensor
Radar(SimCore::Identifier OwnID,
SimCore::Identifier ParentID,
SimCore::SensorKinds SensorKind,
std::string GroundTruthAddress,
std::uint32_t GroundTruthPort,
std::uint32_t ParentPort,
std::string ParentIPAddress,
std::string radarType):Sensor(OwnID, ParentID, SensorKind, GroundTruthPort, ParentPort, ParentIPAddress),radarType_(radarType)
std::string radarType):Sensor(OwnID, ParentID, SensorKind,GroundTruthAddress, GroundTruthPort, ParentPort, ParentIPAddress),radarType_(radarType)
{
}
private:
std::string radarType_;
void specificSensorCalculations() override
void specificSensorCalculations(std::unique_ptr<SimCore::SimTrack> track) override
{
LOG_S(INFO)<<"calculating";
};
void specificReloadCharacteristicts() override
{
LOG_S(INFO)<<"loading specifications";
};
};
@@ -46,7 +46,7 @@ SCENARIO("Testing the SimCore Sensor")
SimCore::Identifier IDParent;
SimCore::Identifier IDRadar;
Radar Radar(IDRadar,IDParent,SimCore::SensorKinds::RADAR,8000,8001,"127.0.0.1","APAR");
Radar Radar(IDRadar,IDParent,SimCore::SensorKinds::RADAR,"239.0.0.1",8000,8001,"127.0.0.1","APAR");
Radar.start();
WHEN("constructing Track Object with data")

View File

@@ -22,9 +22,8 @@ SCENARIO("Testing the SimCore Sensor")
{
GIVEN("different Attributes for a Track in different forms")
{
SimCore::Identifier OwnID;
TrackList::TrackList List(OwnID);
List.setTrackTimeout(5000);
TrackList::TrackList List;
// List.setTrackTimeout(5000);
double speed = 10;
double course = 90;
@@ -54,23 +53,23 @@ SCENARIO("Testing the SimCore Sensor")
WHEN("constructing Track Object with data")
{
List.addTrack(track,Sensor1);
List.addTrack(track);
THEN("check if Track attributes are correct")
{
REQUIRE(List.size() == 1);
REQUIRE(List.getSize() == 1);
REQUIRE(List.getTrack(id)->getPosition().getGeocentricPos() == pos.getGeocentricPos());
REQUIRE(List.getTrack(id)->Speed.getValue() == speed);
REQUIRE(List.getTrack(id)->Course.getValue() == course);
REQUIRE(List.getTrack(id)->getSensorCount() == 1);
// REQUIRE(List.getTrack(id)->getSensorCount() == 1);
track->Course.setValue(270);
List.addTrack(track,Sensor2);
List.addTrack(track);
// REQUIRE(List.getTrack(id)->Course.getValue() == 270);
REQUIRE(List.getTrack(id)->getSensorCount() == 2);
// REQUIRE(List.getTrack(id)->getSensorCount() == 2);
std::this_thread::sleep_for(std::chrono::milliseconds(5500));
REQUIRE(List.size() == 0);
REQUIRE(List.getSize() == 0);
List.stopSanitizer();
// List.stopSanitizer();