Exemple #1
0
 def test_wrenchCollection_case1(self):
     collection = btk.btkWrenchCollection()
     collection.InsertItem(btk.btkWrench(100))
     collection.InsertItem(btk.btkWrench(200))
     collection.InsertItem(btk.btkWrench(300))
     wcdf = btk.btkWrenchCollectionDownsampleFilter()
     wcdf.SetInput(collection)
     wcdf.SetUpDownRatio(10)
     wcdf.Update()
     self.assertEqual(
         wcdf.GetOutput().GetItem(0).GetComponent(0).GetFrameNumber(), 10)
     self.assertEqual(
         wcdf.GetOutput().GetItem(0).GetComponent(1).GetFrameNumber(), 10)
     self.assertEqual(
         wcdf.GetOutput().GetItem(0).GetComponent(2).GetFrameNumber(), 10)
     self.assertEqual(
         wcdf.GetOutput().GetItem(1).GetComponent(0).GetFrameNumber(), 20)
     self.assertEqual(
         wcdf.GetOutput().GetItem(1).GetComponent(1).GetFrameNumber(), 20)
     self.assertEqual(
         wcdf.GetOutput().GetItem(1).GetComponent(2).GetFrameNumber(), 20)
     self.assertEqual(
         wcdf.GetOutput().GetItem(2).GetComponent(0).GetFrameNumber(), 30)
     self.assertEqual(
         wcdf.GetOutput().GetItem(2).GetComponent(1).GetFrameNumber(), 30)
     self.assertEqual(
         wcdf.GetOutput().GetItem(2).GetComponent(2).GetFrameNumber(), 30)
Exemple #2
0
 def test_Constructor_default(self):
     test = btk.btkWrench()
     self.assertEqual(test.GetPosition().GetLabel(), "")
     self.assertEqual(test.GetPosition().GetType(), btk.btkPoint.Marker)
     self.assertEqual(test.GetForce().GetLabel(), ".F")
     self.assertEqual(test.GetForce().GetType(), btk.btkPoint.Force)
     self.assertEqual(test.GetMoment().GetLabel(), ".M")
     self.assertEqual(test.GetMoment().GetType(), btk.btkPoint.Moment)
Exemple #3
0
 def test_Constructor_full(self):
     test = btk.btkWrench("KneeJoint", 10)
     self.assertEqual(test.GetPosition().GetLabel(), "KneeJoint")
     self.assertEqual(test.GetPosition().GetValues().shape[0], 10)
     self.assertEqual(test.GetForce().GetLabel(), "KneeJoint.F")
     self.assertEqual(test.GetForce().GetValues().shape[0], 10)
     self.assertEqual(test.GetMoment().GetLabel(), "KneeJoint.M")
     self.assertEqual(test.GetMoment().GetValues().shape[0], 10)
Exemple #4
0
 def test_GetComponent(self):
     test = btk.btkWrench()
     self.assertEqual(test.GetComponent(0).GetLabel(), "")
     self.assertEqual(test.GetComponent(0).GetType(), btk.btkPoint.Marker)
     self.assertEqual(test.GetComponent(1).GetLabel(), ".F")
     self.assertEqual(test.GetComponent(1).GetType(), btk.btkPoint.Force)
     self.assertEqual(test.GetComponent(2).GetLabel(), ".M")
     self.assertEqual(test.GetComponent(2).GetType(), btk.btkPoint.Moment)
 def test_GetComponent(self):
   test = btk.btkWrench()
   self.assertEqual(test.GetComponent(0).GetLabel(), "")
   self.assertEqual(test.GetComponent(0).GetType(), btk.btkPoint.Marker)
   self.assertEqual(test.GetComponent(1).GetLabel(), ".F")
   self.assertEqual(test.GetComponent(1).GetType(), btk.btkPoint.Force)
   self.assertEqual(test.GetComponent(2).GetLabel(), ".M")
   self.assertEqual(test.GetComponent(2).GetType(), btk.btkPoint.Moment)
Exemple #6
0
 def test_Constructor_fn(self):
     test = btk.btkWrench(10)
     self.assertEqual(test.GetPosition().GetLabel(), "")
     self.assertEqual(test.GetPosition().GetValues().shape[0], 10)
     self.assertEqual(test.GetForce().GetLabel(), ".F")
     self.assertEqual(test.GetForce().GetValues().shape[0], 10)
     self.assertEqual(test.GetMoment().GetLabel(), ".M")
     self.assertEqual(test.GetMoment().GetValues().shape[0], 10)
 def test_Constructor_default(self):
     test = btk.btkWrench()
     self.assertEqual(test.GetPosition().GetLabel(), "")
     self.assertEqual(test.GetPosition().GetType(), btk.btkPoint.Marker)
     self.assertEqual(test.GetForce().GetLabel(), ".F")
     self.assertEqual(test.GetForce().GetType(), btk.btkPoint.Force)
     self.assertEqual(test.GetMoment().GetLabel(), ".M")
     self.assertEqual(test.GetMoment().GetType(), btk.btkPoint.Moment)
 def test_Constructor_full(self):
   test = btk.btkWrench("KneeJoint", 10)
   self.assertEqual(test.GetPosition().GetLabel(), "KneeJoint")
   self.assertEqual(test.GetPosition().GetValues().shape[0], 10)
   self.assertEqual(test.GetForce().GetLabel(), "KneeJoint.F")
   self.assertEqual(test.GetForce().GetValues().shape[0], 10)
   self.assertEqual(test.GetMoment().GetLabel(), "KneeJoint.M")
   self.assertEqual(test.GetMoment().GetValues().shape[0], 10)
 def test_Constructor_fn(self):
   test = btk.btkWrench(10)
   self.assertEqual(test.GetPosition().GetLabel(), "")
   self.assertEqual(test.GetPosition().GetValues().shape[0], 10)
   self.assertEqual(test.GetForce().GetLabel(), ".F")
   self.assertEqual(test.GetForce().GetValues().shape[0], 10)
   self.assertEqual(test.GetMoment().GetLabel(), ".M")
   self.assertEqual(test.GetMoment().GetValues().shape[0], 10)
Exemple #10
0
 def test_wrench_case1(self):
     wrench = btk.btkWrench(100)
     wdf = btk.btkWrenchDownsampleFilter()
     wdf.SetInput(wrench)
     wdf.SetUpDownRatio(10)
     wdf.Update()
     self.assertEqual(wdf.GetOutput().GetComponent(0).GetFrameNumber(), 10)
     self.assertEqual(wdf.GetOutput().GetComponent(1).GetFrameNumber(), 10)
     self.assertEqual(wdf.GetOutput().GetComponent(2).GetFrameNumber(), 10)
 def test_wrench_case1(self):
   wrench = btk.btkWrench(100)
   wdf = btk.btkWrenchDownsampleFilter();
   wdf.SetInput(wrench)
   wdf.SetUpDownRatio(10)
   wdf.Update()
   self.assertEqual(wdf.GetOutput().GetComponent(0).GetFrameNumber(), 10)
   self.assertEqual(wdf.GetOutput().GetComponent(1).GetFrameNumber(), 10)
   self.assertEqual(wdf.GetOutput().GetComponent(2).GetFrameNumber(), 10)
 def test_wrenchCollection_case1(self):
   collection = btk.btkWrenchCollection()
   collection.InsertItem(btk.btkWrench(100))
   collection.InsertItem(btk.btkWrench(200))
   collection.InsertItem(btk.btkWrench(300))
   wcdf = btk.btkWrenchCollectionDownsampleFilter();
   wcdf.SetInput(collection)
   wcdf.SetUpDownRatio(10)
   wcdf.Update()
   self.assertEqual(wcdf.GetOutput().GetItem(0).GetComponent(0).GetFrameNumber(), 10)
   self.assertEqual(wcdf.GetOutput().GetItem(0).GetComponent(1).GetFrameNumber(), 10)
   self.assertEqual(wcdf.GetOutput().GetItem(0).GetComponent(2).GetFrameNumber(), 10)
   self.assertEqual(wcdf.GetOutput().GetItem(1).GetComponent(0).GetFrameNumber(), 20)
   self.assertEqual(wcdf.GetOutput().GetItem(1).GetComponent(1).GetFrameNumber(), 20)
   self.assertEqual(wcdf.GetOutput().GetItem(1).GetComponent(2).GetFrameNumber(), 20)
   self.assertEqual(wcdf.GetOutput().GetItem(2).GetComponent(0).GetFrameNumber(), 30)
   self.assertEqual(wcdf.GetOutput().GetItem(2).GetComponent(1).GetFrameNumber(), 30)
   self.assertEqual(wcdf.GetOutput().GetItem(2).GetComponent(2).GetFrameNumber(), 30)
Exemple #13
0
 def test_SetComponent(self):
     test = btk.btkWrench()
     p = btk.btkPoint("KneeJointCenter", 1)
     f = btk.btkPoint("KneeJointForce", 1)
     m = btk.btkPoint("KneeJointMoment", 1)
     test.SetPosition(p)
     test.SetForce(f)
     test.SetMoment(m)
     test.SetFrameNumber(10)
     self.assertEqual(test.GetPosition().GetLabel(), "KneeJointCenter")
     self.assertEqual(test.GetPosition().GetType(), btk.btkPoint.Marker)
     self.assertEqual(test.GetPosition().GetValues().shape[0], 10)
     self.assertEqual(test.GetForce().GetLabel(), "KneeJointForce")
     self.assertEqual(test.GetForce().GetType(), btk.btkPoint.Force)
     self.assertEqual(test.GetForce().GetValues().shape[0], 10)
     self.assertEqual(test.GetMoment().GetLabel(), "KneeJointMoment")
     self.assertEqual(test.GetMoment().GetType(), btk.btkPoint.Moment)
     self.assertEqual(test.GetMoment().GetValues().shape[0], 10)
     self.assertEqual(p.GetType(), btk.btkPoint.Marker)
     self.assertEqual(p.GetValues().shape[0], 10)
     self.assertEqual(f.GetType(), btk.btkPoint.Force)
     self.assertEqual(f.GetValues().shape[0], 10)
     self.assertEqual(m.GetType(), btk.btkPoint.Moment)
     self.assertEqual(m.GetValues().shape[0], 10)
 def test_SetComponent(self):
   test = btk.btkWrench()
   p = btk.btkPoint("KneeJointCenter",1)
   f = btk.btkPoint("KneeJointForce",1)
   m = btk.btkPoint("KneeJointMoment",1)
   test.SetPosition(p);
   test.SetForce(f);
   test.SetMoment(m);
   test.SetFrameNumber(10);
   self.assertEqual(test.GetPosition().GetLabel(), "KneeJointCenter")
   self.assertEqual(test.GetPosition().GetType(), btk.btkPoint.Marker)
   self.assertEqual(test.GetPosition().GetValues().shape[0], 10)
   self.assertEqual(test.GetForce().GetLabel(), "KneeJointForce")
   self.assertEqual(test.GetForce().GetType(), btk.btkPoint.Force)
   self.assertEqual(test.GetForce().GetValues().shape[0], 10)
   self.assertEqual(test.GetMoment().GetLabel(), "KneeJointMoment")
   self.assertEqual(test.GetMoment().GetType(), btk.btkPoint.Moment)
   self.assertEqual(test.GetMoment().GetValues().shape[0], 10)
   self.assertEqual(p.GetType(), btk.btkPoint.Marker)
   self.assertEqual(p.GetValues().shape[0], 10)
   self.assertEqual(f.GetType(), btk.btkPoint.Force)
   self.assertEqual(f.GetValues().shape[0], 10)
   self.assertEqual(m.GetType(), btk.btkPoint.Moment)
   self.assertEqual(m.GetValues().shape[0], 10)
Exemple #15
0
 def test_SetFrameNumber(self):
     test = btk.btkWrench(10)
     test.SetFrameNumber(20)
     self.assertEqual(test.GetPosition().GetValues().shape[0], 20)
     self.assertEqual(test.GetForce().GetValues().shape[0], 20)
     self.assertEqual(test.GetMoment().GetValues().shape[0], 20)
 def test_SetFrameNumber(self):
   test = btk.btkWrench(10)
   test.SetFrameNumber(20);
   self.assertEqual(test.GetPosition().GetValues().shape[0], 20)
   self.assertEqual(test.GetForce().GetValues().shape[0], 20)
   self.assertEqual(test.GetMoment().GetValues().shape[0], 20)