Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

DATA-516 Fix GetPosition Orientation Response (ORBSLAM) #60

Merged
13 commits merged into from Oct 11, 2022
Merged

DATA-516 Fix GetPosition Orientation Response (ORBSLAM) #60

13 commits merged into from Oct 11, 2022

Conversation

ghost
Copy link

@ghost ghost commented Oct 7, 2022

Using the new variable in the GetPositionResponse, the raw axis angles are returned to be processed on the RDK side. The axis angles are stored in a google protobuf struct: ov while the orientation values in the pose returned are set to 0.

Ticket: DATA-516
Associated PR: #1459

Note: This will be removed once spatial math is available in the C++ code via the Rust SDK (see ticket DATA-531).

@ghost ghost changed the title 10062022 fix pose orientation DATA-516 Fix GetPosition Orientation Response (RDK) Oct 7, 2022
@ghost ghost changed the title DATA-516 Fix GetPosition Orientation Response (RDK) DATA-516 Fix GetPosition Orientation Response (ORBSLAM) Oct 7, 2022
@ghost ghost requested review from tessavitabile, JohnN193 and kkufieta October 7, 2022 20:06
@ghost ghost marked this pull request as ready for review October 7, 2022 22:20
Copy link
Member

@JohnN193 JohnN193 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a comment on logging

Copy link
Contributor

@kkufieta kkufieta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd to me that changes are logged in the ORB_SLAM3 repo when that's not necessary for this PR. Can you separate those from each other and create a separate PR explaining what the changes are that need to be committed to ORB_SLAM3 and why?

Comment on lines 74 to 76
// TODO DATA-531: Remove extraction and conversion of quaternion from the
// extra field in the response once the Rust SDK is available and the
// desired math can be implemented on the orbSLAM side
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Can you add a link to the ticket?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added it but its on two lines due to line limitations

@JohnN193
Copy link
Member

that was my fault, I did not properly include the ORBSLAM3 submodule changes before and worked with Jeremy to get them added back

@kkufieta
Copy link
Contributor

In that case it's a LGTM after adding a link to the ticket as mentioned above.

Copy link
Contributor

@tessavitabile tessavitabile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A few comments.

Using the new variable in the GetPositionResponse, the raw axis angles are returned to be processed on the RDK side. The axis angles are stored in a google protobuf struct: ov while the orientation values in the pose returned are set to 0.

Just want to clarify, the quaternion coefficients are being returned, not the axis angle values.

Also, please make sure there are no submodule changes in the commit.

@@ -69,6 +70,29 @@ ::grpc::Status SLAMServiceImpl::GetPosition(ServerContext *context,
myPose->set_x(actualPose[4]);
myPose->set_y(actualPose[5]);
myPose->set_z(actualPose[6]);

// TODO DATA-531: Remove extraction and conversion of quaternion from the
// extra field in the response once the Rust SDK is available and the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this depends on the rust spatial math library (https://viam.atlassian.net/browse/RSDK-611), not the rust sdk.

// TODO DATA-531: Remove extraction and conversion of quaternion from the
// extra field in the response once the Rust SDK is available and the
// desired math can be implemented on the orbSLAM side
myPose->set_o_x(0.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the computation of o_x, o_y, o_z and theta from above.

<< "x: " << actualPose[4] << " y: " << actualPose[5]
<< " z: " << actualPose[6] << " o_theta: " << actualPose[3]
<< " o_x: " << actualPose[0] << " o_y: " << actualPose[1]
<< " o_z: " << actualPose[2];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't log these as o_x, o_y, o_z, and o_theta, since these are the quaternion coefficients, not orientation vector coefficients.

q->mutable_fields()->operator[]("otheta").set_number_value(actualPose[3]);
q->mutable_fields()->operator[]("ox").set_number_value(actualPose[0]);
q->mutable_fields()->operator[]("oy").set_number_value(actualPose[1]);
q->mutable_fields()->operator[]("oz").set_number_value(actualPose[2]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest calling these q_0, q_1, q_2, and q_3 to make it clear they are quaternion coefficients.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll use the rdk representation real, imag, jmag, kmag

@ghost ghost requested review from tessavitabile and kkufieta October 11, 2022 20:04
Copy link
Contributor

@tessavitabile tessavitabile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mod comments. Please make sure there are no submodule changes. Nice job!

slam-libraries/viam-orb-slam3/orbslam_server_v1.cc Outdated Show resolved Hide resolved
slam-libraries/viam-orb-slam3/orbslam_server_v1.cc Outdated Show resolved Hide resolved
@ghost ghost merged commit ef69b8b into viamrobotics:main Oct 11, 2022
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants