Skip to content

Commit ad8fd11

Browse files
dgottliebdanielbotros
authored andcommitted
RSDK-11810: Remove unused deriv function. (viamrobotics#5251)
1 parent 86e55f0 commit ad8fd11

File tree

2 files changed

+0
-111
lines changed

2 files changed

+0
-111
lines changed

motionplan/armplanning/kinematic.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

motionplan/armplanning/kinematic_test.go

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/golang/geo/r3"
99
pb "go.viam.com/api/component/arm/v1"
1010
"go.viam.com/test"
11-
"gonum.org/v1/gonum/num/quat"
1211

1312
frame "go.viam.com/rdk/referenceframe"
1413
spatial "go.viam.com/rdk/spatialmath"
@@ -92,67 +91,6 @@ func TestForwardKinematics(t *testing.T) {
9291
test.That(t, spatial.PoseAlmostEqualEps(expect, pos, 0.01), test.ShouldBeTrue)
9392
}
9493

95-
const derivEqualityEpsilon = 1e-16
96-
97-
func derivComponentAlmostEqual(left, right float64) bool {
98-
return math.Abs(left-right) <= derivEqualityEpsilon
99-
}
100-
101-
func areDerivsEqual(q1, q2 []quat.Number) bool {
102-
if len(q1) != len(q2) {
103-
return false
104-
}
105-
for i, dq1 := range q1 {
106-
dq2 := q2[i]
107-
if !derivComponentAlmostEqual(dq1.Real, dq2.Real) {
108-
return false
109-
}
110-
if !derivComponentAlmostEqual(dq1.Imag, dq2.Imag) {
111-
return false
112-
}
113-
if !derivComponentAlmostEqual(dq1.Jmag, dq2.Jmag) {
114-
return false
115-
}
116-
if !derivComponentAlmostEqual(dq1.Kmag, dq2.Kmag) {
117-
return false
118-
}
119-
}
120-
return true
121-
}
122-
123-
func TestDeriv(t *testing.T) {
124-
// Test identity quaternion
125-
q := quat.Number{1, 0, 0, 0}
126-
qDeriv := []quat.Number{{0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}
127-
128-
match := areDerivsEqual(qDeriv, deriv(q))
129-
test.That(t, match, test.ShouldBeTrue)
130-
131-
// Test non-identity single-axis unit quaternion
132-
q = quat.Exp(quat.Number{0, 2, 0, 0})
133-
134-
qDeriv = []quat.Number{
135-
{-0.9092974268256816, -0.4161468365471424, 0, 0},
136-
{0, 0, 0.4546487134128408, 0},
137-
{0, 0, 0, 0.4546487134128408},
138-
}
139-
140-
match = areDerivsEqual(qDeriv, deriv(q))
141-
test.That(t, match, test.ShouldBeTrue)
142-
143-
// Test non-identity multi-axis unit quaternion
144-
q = quat.Exp(quat.Number{0, 2, 1.5, 0.2})
145-
146-
qDeriv = []quat.Number{
147-
{-0.472134934000233, -0.42654977821280804, -0.4969629339096933, -0.06626172452129245},
148-
{-0.35410120050017474, -0.4969629339096933, -0.13665473343215354, -0.049696293390969336},
149-
{-0.0472134934000233, -0.06626172452129245, -0.049696293390969336, 0.22944129454798728},
150-
}
151-
152-
match = areDerivsEqual(qDeriv, deriv(q))
153-
test.That(t, match, test.ShouldBeTrue)
154-
}
155-
15694
// Test dynamic frame systems
15795
// Since kinematics imports reference frame, this needs to be here to avoid circular dependencies.
15896
func TestDynamicFrameSystemXArm(t *testing.T) {

0 commit comments

Comments
 (0)