-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversion between FixedSizeMatrix and Jacobian #119
Comments
Currently I am doing this (toxic) trick: func testPose3SimplePriorFactor() {
let P = Vector3(3.5,-8.2,4.2)
let R = Rot3.fromTangent(Vector3(0.3, 0, 0))
let t1 = Pose3(R, P)
let I = FixedSizeMatrix<Array6<Vector6>>.identity
var val = VariableAssignments()
let id1 = val.store(t1) // should be identity matrix
let prior_factor = PriorFactor3(id1, t1)
// Change this to t2, still zero in upper left block
let actual = prior_factor.linearized(at: Tuple1(t1))
var jacobian = actual.jacobian
let voidPtr = withUnsafeMutablePointer(to: &jacobian) {
$0.withMemoryRebound(to: FixedSizeMatrix<Array6<Vector6>>.self, capacity: 1) {
(unsafePointer: UnsafeMutablePointer<FixedSizeMatrix<Array6<Vector6>>>) in
unsafePointer
}
}
// print(voidPtr.pointee)
XCTAssertEqual(voidPtr.pointee, I)
} |
One thing you could do is |
There's not a similar trick for constructing an
The APIs for dealing with stuff like clearly need improvement. Maybe it's possible to make the public field of the |
This works great :)
Yeah I think something like |
Consider the following test:
actual.jacobian
isArray6<Tuple1<Vector6>
and I isArray6<Vector6>
, so the assertion cannot compile.@marcrasi Any thoughts? Thanks in advance :)
The text was updated successfully, but these errors were encountered: