-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FCP-5: SensorDetectedObject TMX message definition #628
Conversation
} | ||
static Covariance from_tree(const message_tree_type& tree){ | ||
Covariance cov; | ||
cov.value = tree.get<std::string>(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will be double values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://usdot-carma.atlassian.net/wiki/spaces/CRMSIM/pages/2563899417/Detected+Objects+Specification
Sample value for the covariance below:
"positionCovariance" : ["a11", "a12", "a13", "a21", "a22", "a23", "a31", "a32", "a33"]
// Cartesian positiion of object. Assumed to be ENU coordinate frame. | ||
tmx::utils::Point position = tmx::utils::Point(); | ||
typedef struct Position{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth while creating separate .h files for some of these classes in the messages package. This will allow reuse of these types in future messages which I think it pretty likely. It also makes this class more readable since it will not include object definitions of nest objects amongst its own member declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add unit test covering to and from json serialization. I can provide example json payloads for testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include tests to cover to and from JSON serialization. I can provide a sample SensorDetectedObject message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have provided a sample message to test against. TMX will turn all doubles into strings during JSON serialization but other than that it should be the same.
@dan-du-car We also need to add the Messages package to the sonar properties file. It does not seem to currently be added. Because of this I do not think we are getting code smells or coverage metrics to this package. |
|
||
TEST_F(SensorDetectedObjectTest, deserialize){ | ||
auto tmxSdsmPtr2 = std::make_shared<SensorDetectedObject>(); | ||
std::string expectedStr = "{\"isSimulated\":1,\"type\":\"CAR\",\"confidence\":1.0,\"sensorId\":\"IntersectionLidar\",\"projString\":\"+proj=tmerc +lat_0=0 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +geoidgrids=egm96_15.gtx +vunits=m +no_defs\",\"objectId\":207,\"position\":{\"x\":-5.021,\"y\":64.234,\"z\":-10.297},\"positionCovariance\":[[0.04000000000000001,0.0,0.0],[0.0,0.04000000000000001,0.0],[0.0,0.0,0.04000000000000001]],\"velocity\":{\"x\":0.0,\"y\":0.0,\"z\":0.0},\"velocityCovariance\":[[0.04000000000000001,0.0,0.0],[0.0,0.04000000000000001,0.0],[0.0,0.0,0.04000000000000001]],\"angularVelocity\":{\"x\":0.0,\"y\":-0.0,\"z\":-0.0},\"angularVelocityCovariance\":[[0.010000000000000002,0.0,0.0],[0.0,0.010000000000000002,0.0],[0.0,0.0,0.010000000000000002]],\"size\":{\"length\":2.257,\"height\":1.003,\"width\":0.762},\"timestamp\":110200}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT is there a reason we are not using raw string here. Makes the input more readable.
std::string expectedStr = R"(
{
"isSimulated": 1,
"type": "CAR",
"confidence": 1,
"sensorId": "IntersectionLidar",
"projString": "+proj=tmerc +lat_0=0 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +geoidgrids=egm96_15.gtx +vunits=m +no_defs",
"objectId": 207,
"position": {
"x": -5.021,
"y": 64.234,
"z": -10.297
},
"positionCovariance": [
[
0.04000000000000001,
0,
0
],
[
0,
0.04000000000000001,
0
],
[
0,
0,
0.04000000000000001
]
],
"velocity": {
"x": 0,
"y": 0,
"z": 0
},
"velocityCovariance": [
[
0.04000000000000001,
0,
0
],
[
0,
0.04000000000000001,
0
],
[
0,
0,
0.04000000000000001
]
],
"angularVelocity": {
"x": 0,
"y": 0,
"z": 0
},
"angularVelocityCovariance": [
[
0.010000000000000002,
0,
0
],
[
0,
0.010000000000000002,
0
],
[
0,
0,
0.010000000000000002
]
],
"size": {
"length": 2.257,
"height": 1.003,
"width": 0.762
},
"timestamp": 110200
}
)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment about using raw string literals and then one additional comment. Have you looked into resolving the code smell related to typedef
vs using
.
Quality Gate passedIssues Measures |
PR Details
Description
Updating SensorDetectedObject message to allow for TMX JSON serialization/deserialization.
Related Issue
https://usdot-carma.atlassian.net/browse/FCP-5
Motivation and Context
Freight Cooperative perception
How Has This Been Tested?
Unit test
Types of changes
Checklist:
V2XHUB Contributing Guide