-
Notifications
You must be signed in to change notification settings - Fork 111
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
DATA-516 Fix GetPosition Orientation Response (RDK) #1459
Conversation
services/slam/builtin/builtin.go
Outdated
slamSvc.logger.Warnf("invalid format for quaternion returned, %v, skipping quaternion transform", q) | ||
return pInFrame, nil | ||
} | ||
slamSvc.logger.Infof("valid format for quaternion returned, %v, performing quaternion transform", q) |
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.
Logging of position has been added, however depending on the frequency at which GetPosition is called by the UI this may be removed in the future.
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.
missed that there was logging in both rdk and orbslam, probably only want to log in one of them if you know the grpc call is working
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.
If you leave this in, I would make it a debug instead of info.
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.
@JohnN193 I'll plan on removing the logging here and keeping it in orbslam
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.
LGTM, but I have not really used spacialmath at all so I cannot really comment on that
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.
LGTM besides my nit and that I think someone who is familiar with the spatial math library should be added to the review.
services/slam/builtin/builtin.go
Outdated
// 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 |
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] Can you add a link to the relevant ticket?
services/slam/builtin/builtin.go
Outdated
ori := spatialmath.QuatToOV(quat.Number{Real: valTheta.(float64), Imag: valX.(float64), Jmag: valY.(float64), Kmag: valZ.(float64)}) | ||
newPose := spatialmath.NewPoseFromOrientation(pInFrame.Pose().Point(), ori) | ||
pInFrame = referenceframe.NewPoseInFrame(pInFrame.FrameName(), newPose) | ||
|
||
} |
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.
[major] Agreed with John, might make sense to ask e.g. Peter L. for a quick glance at this.
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.
Nice work! A few comments.
services/slam/builtin/builtin.go
Outdated
slamSvc.logger.Warnf("invalid format for quaternion returned, %v, skipping quaternion transform", q) | ||
return pInFrame, nil | ||
} | ||
slamSvc.logger.Infof("valid format for quaternion returned, %v, performing quaternion transform", q) |
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.
If you leave this in, I would make it a debug instead of info.
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.
Nice!
services/slam/builtin/builtin.go
Outdated
return pInFrame, nil | ||
} | ||
slamSvc.logger.Infof("valid format for quaternion returned, %v, performing quaternion transform", q) | ||
ori := spatialmath.QuatToOV(quat.Number{Real: valTheta.(float64), Imag: valX.(float64), Jmag: valY.(float64), Kmag: valZ.(float64)}) |
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.
Since we're parsing these values out of a map[string]interface, it might be worth checking if the (float64) conversion works.
Also, instead of importing gonum.org/v1/gonum/num/quat it can be kept within RDK with
spatialmath.QuatToOV(&spatialmath.Quaternion{Real: valTheta.(float64), Imag: valX.(float64), Jmag: valY.(float64), Kmag: valZ.(float64)})
Though the two are equivalent, Quaternion wraps a quat.Number
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.
Removes need for QuatToOV too! Thanks Peter
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.
LGTM
|
A quaternion is returned to RDK from orbSLAM via a new response filed "extra". This value is then checked to see if it contains an 'quat' element, that element is then parsed into its respective elements: ox, oy, oz, and otheta. These elements are converted into a orientation vector via the QuatToOV function before being added to the new pose returned by the function.
In no value in 'extra' is found with the name 'quat' then this process is skipped and the pose is returned unaltered. This allows for flexibility between libraries and their return types if needed.
Ticket: DATA-516
Associated PR: #60
Note: This will be removed once spatial math is available in the C++ code via the Rust SDK (see ticket: DATA-531).