ADD: updated the test function for simtrack
This commit is contained in:
@@ -35,6 +35,7 @@ namespace SimCore
|
|||||||
void setPosition(double x, double y, double z);
|
void setPosition(double x, double y, double z);
|
||||||
SimCore::Position getPosition();
|
SimCore::Position getPosition();
|
||||||
SimCore::Identifier getIdentifier();
|
SimCore::Identifier getIdentifier();
|
||||||
|
|
||||||
/// @brief
|
/// @brief
|
||||||
/// @param emission
|
/// @param emission
|
||||||
void addEmission(Emission emission);
|
void addEmission(Emission emission);
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ namespace SimCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
SimTrack::SimTrack(WHISPER::SourceType sourcetype,SimCore::EntityKind entityKind)
|
SimTrack::SimTrack(WHISPER::SourceType sourcetype,SimCore::EntityKind entityKind)
|
||||||
:ID_(SimCore::Identifier()),SourceType_(WHISPER::SourceType::SIMCOMTROLER)
|
:ID_(SimCore::Identifier()),SourceType_(sourcetype)
|
||||||
{
|
{
|
||||||
EntityKind.setValue(entityKind);
|
EntityKind.setValue(entityKind);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimTrack::SimTrack(SimCore::Identifier id ,WHISPER::SourceType sourcetype,SimCore::EntityKind entityKind )
|
SimTrack::SimTrack(SimCore::Identifier id ,WHISPER::SourceType sourcetype,SimCore::EntityKind entityKind )
|
||||||
:ID_(id),SourceType_(WHISPER::SourceType::SIMCOMTROLER)
|
:ID_(id),SourceType_(sourcetype)
|
||||||
{
|
{
|
||||||
EntityKind.setValue(entityKind);
|
EntityKind.setValue(entityKind);
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace SimCore
|
|||||||
|
|
||||||
WHISPER::Message SimTrack::buildMessage(SimCore::Identifier parentID)
|
WHISPER::Message SimTrack::buildMessage(SimCore::Identifier parentID)
|
||||||
{
|
{
|
||||||
WHISPER::Message msg(parentID.getParentNumber(), parentID.getNumber(),WHISPER::MsgTopics::TRACK , WHISPER::MsgType::GROUND_TRUTH_TRACK, WHISPER::SourceType::GATEWAY);
|
WHISPER::Message msg(parentID.getParentNumber(), parentID.getNumber(),WHISPER::MsgTopics::TRACK , WHISPER::MsgType::GROUND_TRUTH_TRACK, this->SourceType_);
|
||||||
|
|
||||||
|
|
||||||
messages::SimTrack::SimTrack SimTrack;
|
messages::SimTrack::SimTrack SimTrack;
|
||||||
@@ -118,18 +118,22 @@ namespace SimCore
|
|||||||
{
|
{
|
||||||
track.setPosition(trackMsg.mutable_geocentricposition()->x(), trackMsg.mutable_geocentricposition()->y(), trackMsg.mutable_geocentricposition()->z());
|
track.setPosition(trackMsg.mutable_geocentricposition()->x(), trackMsg.mutable_geocentricposition()->y(), trackMsg.mutable_geocentricposition()->z());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackMsg.has_contactcourse())
|
if (trackMsg.has_contactcourse())
|
||||||
{
|
{
|
||||||
track.Course.setValue(trackMsg.contactcourse());
|
track.Course.setValue(trackMsg.contactcourse());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackMsg.has_contactspeed())
|
if (trackMsg.has_contactspeed())
|
||||||
{
|
{
|
||||||
track.Speed.setValue(trackMsg.contactspeed());
|
track.Speed.setValue(trackMsg.contactspeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackMsg.has_conactpitch())
|
if (trackMsg.has_conactpitch())
|
||||||
{
|
{
|
||||||
track.Pitch.setValue(trackMsg.contactspeed());
|
track.Pitch.setValue(trackMsg.contactspeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackMsg.has_contactrcs())
|
if (trackMsg.has_contactrcs())
|
||||||
{
|
{
|
||||||
track.RCS.setValue(trackMsg.contactrcs());
|
track.RCS.setValue(trackMsg.contactrcs());
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "SimCore/Identifier.hpp"
|
||||||
#include <SimCore/Messages/SimTrack.hpp>
|
#include <SimCore/Messages/SimTrack.hpp>
|
||||||
#include <WHISPER/Messages/Message.hpp>
|
#include <WHISPER/Messages/Message.hpp>
|
||||||
#include <SimCore/SimCore.hpp>
|
#include <SimCore/SimCore.hpp>
|
||||||
@@ -14,6 +15,8 @@ SCENARIO("Testing the SimCore Track")
|
|||||||
{
|
{
|
||||||
GIVEN("different Attributes for a Track in different forms")
|
GIVEN("different Attributes for a Track in different forms")
|
||||||
{
|
{
|
||||||
|
auto OwnID = SimCore::Identifier();
|
||||||
|
|
||||||
Eigen::Vector3d GeocentPos1;
|
Eigen::Vector3d GeocentPos1;
|
||||||
GeocentPos1(SimCore::GeocentricPosition::X) = 3784014.333;
|
GeocentPos1(SimCore::GeocentricPosition::X) = 3784014.333;
|
||||||
GeocentPos1(SimCore::GeocentricPosition::Y) = 899869.779;
|
GeocentPos1(SimCore::GeocentricPosition::Y) = 899869.779;
|
||||||
@@ -52,17 +55,23 @@ SCENARIO("Testing the SimCore Track")
|
|||||||
|
|
||||||
auto idEmi = emi1.getID();
|
auto idEmi = emi1.getID();
|
||||||
track.addEmission(emi1);
|
track.addEmission(emi1);
|
||||||
// serializedMSG = track.buildMessage(parentID).serialize();
|
|
||||||
// msg = std::make_shared<WHISPER::Message>(serializedMSG);
|
|
||||||
|
|
||||||
// if (msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK) {
|
|
||||||
|
|
||||||
// trackPtr = std::make_shared<SimCore::SimTrack>(std::move(SimCore::SimTrack::unpack(*msg)));
|
serializedMSG = track.buildMessage(OwnID).serialize();
|
||||||
// }
|
|
||||||
|
msg = std::make_shared<WHISPER::Message>(serializedMSG);
|
||||||
|
|
||||||
|
if (msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK) {
|
||||||
|
|
||||||
|
LOG_S(INFO)<< msg.get()->topic_;
|
||||||
|
trackPtr = std::make_shared<SimCore::SimTrack>(std::move(SimCore::SimTrack::unpack(*msg)));
|
||||||
|
}
|
||||||
|
|
||||||
// std::string trackstring = track.buildMessage(parentID).serialize();
|
// std::string trackstring = track.buildMessage(parentID).serialize();
|
||||||
|
|
||||||
// SimCore::GroundTruthTrack trackDeserialized = SimCore::GroundTruthTrack::unpack(*msg);
|
SimCore::SimTrack trackDeserialized = SimCore::SimTrack::unpack(*msg);
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<SimCore::Emission> esm= track.getEmission(emi1.getID());
|
std::shared_ptr<SimCore::Emission> esm= track.getEmission(emi1.getID());
|
||||||
esm->packEmission();
|
esm->packEmission();
|
||||||
|
|
||||||
@@ -76,11 +85,10 @@ SCENARIO("Testing the SimCore Track")
|
|||||||
REQUIRE(track.getEmission(emi1.getID()).get()->getID() == idEmi);
|
REQUIRE(track.getEmission(emi1.getID()).get()->getID() == idEmi);
|
||||||
|
|
||||||
// REQUIRE(msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK);
|
// REQUIRE(msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK);
|
||||||
// REQUIRE(trackPtr->Speed.getValue() == speed);
|
REQUIRE(trackPtr->Speed.getValue() == speed);
|
||||||
// REQUIRE(trackPtr->getPosition().getGeocentricPos() == GeocentPos1);
|
REQUIRE(trackPtr->getPosition().getGeocentricPos() == GeocentPos1);
|
||||||
// REQUIRE(trackPtr->getIdentifier().getNumber() > 0);
|
|
||||||
// REQUIRE(trackDeserialized.getIdentifier().getNumber() > 0);
|
|
||||||
|
|
||||||
|
REQUIRE(trackDeserialized.getEmission(emi1.getID()).get()->getID() == idEmi);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user