FIX: added some default values to the unpacking function

This commit is contained in:
Henry Winkel
2023-09-28 11:19:49 +02:00
parent f44e89e519
commit d060f9f2d4

View File

@@ -1,3 +1,4 @@
#include "SimCore/Position.hpp"
#include "SimCore/SimCore.hpp" #include "SimCore/SimCore.hpp"
#include "WHISPER/Messages/Message.hpp" #include "WHISPER/Messages/Message.hpp"
#include <SimCore/Messages/SimTrack.hpp> #include <SimCore/Messages/SimTrack.hpp>
@@ -181,20 +182,37 @@ namespace SimCore
if (trackMsg.has_geocentricposition()) if (trackMsg.has_geocentricposition())
{ {
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());
}else
{
Position tmpPos;
tmpPos.setGeodesicPos(0, 0, 0);
track.setPosition(tmpPos);
} }
if (trackMsg.has_contactcourse())
{
track.Course.setValue(trackMsg.contactcourse());
}else
{
track.Course.setValue(0);
}
if (trackMsg.has_contactspeed()) if (trackMsg.has_contactspeed())
{ {
track.Speed.setValue(trackMsg.contactspeed()); track.Speed.setValue(trackMsg.contactspeed());
}else
{
track.Speed.setValue(0);
} }
if (trackMsg.has_conactpitch()) if (trackMsg.has_conactpitch())
{ {
track.Pitch.setValue(trackMsg.contactspeed()); track.Pitch.setValue(trackMsg.conactpitch());
}else {
track.Pitch.setValue(0);
} }
if (trackMsg.has_contactrcs()) if (trackMsg.has_contactrcs())
{ {
track.RCS.setValue(trackMsg.contactrcs()); track.RCS.setValue(trackMsg.contactrcs());
}else }else