ADD: updated tests
This commit is contained in:
@@ -12,15 +12,6 @@
|
|||||||
namespace Entities
|
namespace Entities
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Movement
|
class Movement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Submodule libs/nlohmannJSON updated: 5d2754306d...58d6aa5831
@@ -19,11 +19,11 @@ class Ship : public Entities::Entity
|
|||||||
Ship(SimCore::Identifier OwnID,
|
Ship(SimCore::Identifier OwnID,
|
||||||
std::string EntityName,
|
std::string EntityName,
|
||||||
WHISPER::SourceType ownType,
|
WHISPER::SourceType ownType,
|
||||||
SimCore::EntityKind EntityKind,
|
SimCore::Kind::EntityKind EntityKind,
|
||||||
std::uint32_t GroundTruthPort,
|
std::uint32_t GroundTruthPort,
|
||||||
std::uint32_t CommandPort
|
ushort CommandPort
|
||||||
):
|
):
|
||||||
Entity( OwnID,EntityName,ownType, EntityKind, GroundTruthPort, CommandPort,false)
|
Entity( OwnID,EntityName,ownType, EntityKind,SimCore::Side::EntitySide::FRIEND, "127.0.0.1",GroundTruthPort, CommandPort,false)
|
||||||
{
|
{
|
||||||
SimCore::Position pos1;
|
SimCore::Position pos1;
|
||||||
pos1.setGeodesicPos(55, 6, 0);
|
pos1.setGeodesicPos(55, 6, 0);
|
||||||
@@ -59,7 +59,7 @@ SCENARIO("Testing the SimCore Sensor")
|
|||||||
GIVEN("different Attributes for a Track in different forms")
|
GIVEN("different Attributes for a Track in different forms")
|
||||||
{
|
{
|
||||||
SimCore::Identifier ID1;
|
SimCore::Identifier ID1;
|
||||||
Ship Ship(ID1,"FGSHamburg",WHISPER::SourceType::ENTITY,SimCore::EntityKind::SURFACE,8000,8001);
|
Ship Ship(ID1,"FGSHamburg",WHISPER::SourceType::ENTITY,SimCore::Kind::EntityKind::SURFACE,8000,8001);
|
||||||
Ship.start();
|
Ship.start();
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
|
||||||
Ship.stop();
|
Ship.stop();
|
||||||
|
|||||||
@@ -11,8 +11,39 @@
|
|||||||
#include <loguru.hpp>
|
#include <loguru.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
struct KinVec{
|
||||||
|
double x,y,z;
|
||||||
|
}
|
||||||
|
struct MovementVec{
|
||||||
|
double dSpd,dClb,dCrs;
|
||||||
|
}
|
||||||
|
KinVec Generate_Kin_Vect(MovementVec Mov_Dat, LLA_Rad LLA_rCoord)
|
||||||
|
{
|
||||||
|
KinVec Result;
|
||||||
|
|
||||||
|
//Transform Mov_Dat to topocentric vector
|
||||||
|
UVW UVW_Coord;
|
||||||
|
|
||||||
|
UVW_Coord.dU = Mov_Dat.dSpd * cos(Mov_Dat.dClb) * sin(Mov_Dat.dCrs);
|
||||||
|
UVW_Coord.dV = Mov_Dat.dSpd * cos(Mov_Dat.dClb) * cos(Mov_Dat.dCrs);
|
||||||
|
UVW_Coord.dW = Mov_Dat.dSpd * sin(Mov_Dat.dClb);
|
||||||
|
|
||||||
|
//Transform topocentric vector to geocentric vector
|
||||||
|
|
||||||
|
Result.x = -UVW_Coord.dU * sin(LLA_rCoord.dLon) -
|
||||||
|
UVW_Coord.dV * sin(LLA_rCoord.dLat) * cos(LLA_rCoord.dLon) +
|
||||||
|
UVW_Coord.dW * cos(LLA_rCoord.dLat) * cos(LLA_rCoord.dLon);
|
||||||
|
|
||||||
|
Result.y = UVW_Coord.dU * cos(LLA_rCoord.dLon) -
|
||||||
|
UVW_Coord.dV * sin(LLA_rCoord.dLat) * sin(LLA_rCoord.dLon) +
|
||||||
|
UVW_Coord.dW * cos(LLA_rCoord.dLat) * sin(LLA_rCoord.dLon);
|
||||||
|
|
||||||
|
Result.z = UVW_Coord.dV * cos(LLA_rCoord.dLat) +
|
||||||
|
UVW_Coord.dW * sin(LLA_rCoord.dLat);
|
||||||
|
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
SCENARIO("Testing the SimCore Sensor")
|
SCENARIO("Testing the SimCore Sensor")
|
||||||
@@ -61,6 +92,10 @@ SCENARIO("Testing the SimCore Sensor")
|
|||||||
i += 0.5;
|
i += 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MovementVec movc;
|
||||||
|
movc.dSpd = 10;
|
||||||
|
movc.dClb = 0;
|
||||||
|
movc.dCrs = 0;
|
||||||
// LOG_S(INFO)<< mov.getEulerAngles();
|
// LOG_S(INFO)<< mov.getEulerAngles();
|
||||||
|
|
||||||
THEN("check if Track attributes are correct")
|
THEN("check if Track attributes are correct")
|
||||||
|
|||||||
@@ -25,32 +25,6 @@ SCENARIO("Testing the SimCore Sensor")
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
SimCore::Identifier OwnID;
|
|
||||||
SimCore::IdentifierMaker IDMaker;
|
|
||||||
auto RadarID = IDMaker.getNewIdentifier(1,SimCore::INTERNAL);
|
|
||||||
auto TrackID1 = IDMaker.getNewIdentifier(1,SimCore::INTERNAL);
|
|
||||||
LOG_S(INFO)<<TrackID1->serialize();
|
|
||||||
|
|
||||||
TrackList::TrackList InternalTracklist(OwnID);
|
|
||||||
TrackList::SensorData sensor1;
|
|
||||||
sensor1.sensorID = *RadarID.get();
|
|
||||||
sensor1.Sensorname = "TRS-3D";
|
|
||||||
|
|
||||||
LOG_S(INFO)<<"making radar track";
|
|
||||||
auto Track1 = std::make_shared<SimCore::SimTrack>(*TrackID1.get(),"test",SimCore::EntityKind::SURFACE);
|
|
||||||
|
|
||||||
SimCore::Position pos1 ;
|
|
||||||
pos1.setGeodesicPos(55, 6, 0);
|
|
||||||
Track1->setPosition(pos1);
|
|
||||||
|
|
||||||
LOG_S(INFO)<<"adding radar track";
|
|
||||||
|
|
||||||
InternalTracklist.addTrack(Track1, sensor1);
|
|
||||||
|
|
||||||
|
|
||||||
LOG_S(INFO)<<"radar track added";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -60,25 +34,7 @@ SCENARIO("Testing the SimCore Sensor")
|
|||||||
THEN("check if Track attributes are correct")
|
THEN("check if Track attributes are correct")
|
||||||
{
|
{
|
||||||
|
|
||||||
REQUIRE(InternalTracklist.size() == 1);
|
|
||||||
REQUIRE(InternalTracklist.getTrack(Track1->getIdentifier())->getSpeed() == 0);
|
|
||||||
|
|
||||||
LOG_S(INFO)<<"add same track again";
|
|
||||||
|
|
||||||
Track1->Speed.setValue(10);
|
|
||||||
|
|
||||||
InternalTracklist.addTrack(Track1, sensor1);
|
|
||||||
REQUIRE(InternalTracklist.getTrack(Track1->getIdentifier())->getSpeed() == 10);
|
|
||||||
|
|
||||||
REQUIRE(InternalTracklist.size() == 1);
|
|
||||||
|
|
||||||
// std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
|
||||||
// REQUIRE(InternalTracklist.size() == 1);
|
// REQUIRE(InternalTracklist.size() == 1);
|
||||||
// std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
|
||||||
// REQUIRE(InternalTracklist.size() == 1);
|
|
||||||
|
|
||||||
|
|
||||||
InternalTracklist.stopSanitizer();
|
|
||||||
|
|
||||||
|
|
||||||
} //THEN
|
} //THEN
|
||||||
|
|||||||
Reference in New Issue
Block a user