Skip to content

Commit

Permalink
add coordinate system definition to query
Browse files Browse the repository at this point in the history
  • Loading branch information
104H authored and mmeijerdfki committed Aug 23, 2024
1 parent 469c570 commit 54ddb0f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions seerep_msgs/core/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ struct Query
// polygon defined above
bool inMapFrame; // if false the query polygon is in geodetic coordinates,
// otherwise in map frame
std::string
coordinateSystem; // the geodetic coordinate system in which the polygon is defined
std::optional<Timeinterval> timeinterval; ///< only do temporal query if set
std::optional<std::unordered_map<std::string, std::vector<std::string>>>
label; ///< only do semantic query if set
Expand Down
1 change: 1 addition & 0 deletions seerep_msgs/fbs/query.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ table Query {
polygon:Polygon2D;
polygonSensorPosition:Polygon2D;
fullyEncapsulated:bool;
coordinateSystem:string;
inMapFrame:bool;
timeinterval:TimeInterval;
label:[LabelCategory];
Expand Down
1 change: 1 addition & 0 deletions seerep_msgs/protos/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ message Query
bool withoutdata = 10;
uint32 maxNumData = 11;
bool sortByTime = 12;
string coordinateSystem = 13;
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ class CoreFbConversion
*/
static bool fromFbQueryInMapFrame(const seerep::fb::Query* query);

static std::string fromFbQueryCoordinateSystem(const seerep::fb::Query* query);

/**
* @brief extracts the fullyEncapsulated flag of the flatbuffer query message
* @param query the flatbuffer message
Expand Down
11 changes: 11 additions & 0 deletions seerep_srv/seerep_core_fb/src/core_fb_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CoreFbConversion::fromFb(const seerep::fb::Query* query,
queryCore.polygon = fromFbQueryPolygon(query);
queryCore.polygonSensorPos = fromFbQueryPolygonSensorPosition(query);
queryCore.fullyEncapsulated = fromFbQueryFullyEncapsulated(query);
queryCore.coordinateSystem = fromFbQueryCoordinateSystem(query);
queryCore.inMapFrame = fromFbQueryInMapFrame(query);
queryCore.sortByTime = query->sortByTime();

Expand Down Expand Up @@ -562,6 +563,16 @@ CoreFbConversion::fromFbSparqlQuery(const seerep::fb::Query* query)
return std::nullopt;
}

std::string CoreFbConversion::fromFbQueryCoordinateSystem(const seerep::fb::Query* query)
{
if (flatbuffers::IsFieldPresent(query, seerep::fb::Query::VT_COORDINATESYSTEM))
{
return query->coordinateSystem()->str();
}

return "";
}

std::optional<std::string>
CoreFbConversion::fromFbOntologyURI(const seerep::fb::Query* query)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ class CorePbConversion
* @param queryCore query message in seerep core format
*/
static void fromPbInMapFrame(const seerep::pb::Query& query, seerep_core_msgs::Query& queryCore);
/**
* @brief converts the coordinate systen string of the protobuf query message to seerep core specific message
* @param query the protobuf query message
* @param queryCore query message in seerep core format
*/
static void fromPbCoordinateSystem(const seerep::pb::Query& query, seerep_core_msgs::Query& queryCore);
/**
* @brief converts the fullyEncapsulated flag of the protobuf query message to seerep core specific message
>>>>>>> bool inMapFrame in query
Expand Down
7 changes: 7 additions & 0 deletions seerep_srv/seerep_core_pb/src/core_pb_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CorePbConversion::fromPb(const seerep::pb::Query& query,
fromPbWithOutData(query, queryCore);
fromFbQueryMaxNumData(query, queryCore);
fromPbFullyEncapsulated(query, queryCore);
fromPbCoordinateSystem(query, queryCore);
fromPbInMapFrame(query, queryCore);
queryCore.sortByTime = query.sortbytime();

Expand Down Expand Up @@ -378,6 +379,12 @@ void CorePbConversion::fromPbInMapFrame(const seerep::pb::Query& query,
queryCore.inMapFrame = query.inmapframe();
}

void CorePbConversion::fromPbCoordinateSystem(const seerep::pb::Query& query,
seerep_core_msgs::Query& queryCore)
{
queryCore.coordinateSystem = query.coordinatesystem();
}

void CorePbConversion::fromPbFullyEncapsulated(
const seerep::pb::Query& query, seerep_core_msgs::Query& queryCore)
{
Expand Down

0 comments on commit 54ddb0f

Please sign in to comment.