jacobiantest.cpp
Go to the documentation of this file.
00001 #include "jacobiantest.hpp"
00002 #include <kinfam_io.hpp>
00003 #include <Eigen/Core>
00004 
00005 CPPUNIT_TEST_SUITE_REGISTRATION(JacobianTest);
00006 
00007 using namespace KDL;
00008 
00009 void JacobianTest::setUp(){}
00010 void JacobianTest::tearDown(){}
00011 
00012 void JacobianTest::TestChangeRefPoint(){
00013     //Create a random jacobian
00014     Jacobian j1(5);
00015     j1.data.setRandom();
00016     //Create a random Vector
00017     Vector p;
00018     random(p);
00019     
00020     Jacobian j2(5);
00021     CPPUNIT_ASSERT(changeRefPoint(j1,p,j2));
00022     CPPUNIT_ASSERT(j1!=j2);
00023     Jacobian j3(4);
00024     CPPUNIT_ASSERT(!changeRefPoint(j1,p,j3));
00025     j3.resize(5);
00026     CPPUNIT_ASSERT(changeRefPoint(j2,-p,j3));
00027     CPPUNIT_ASSERT_EQUAL(j1,j3);
00028 
00029 }
00030 
00031 void JacobianTest::TestChangeRefFrame(){
00032     //Create a random jacobian
00033     Jacobian j1(5);
00034     j1.data.setRandom();
00035     //Create a random frame
00036     Frame f;
00037     random(f);
00038     
00039     Jacobian j2(5);
00040     CPPUNIT_ASSERT(changeRefFrame(j1,f,j2));
00041     CPPUNIT_ASSERT(j1!=j2);
00042     Jacobian j3(4);
00043     CPPUNIT_ASSERT(!changeRefFrame(j1,f,j3));
00044     j3.resize(5);
00045     CPPUNIT_ASSERT(changeRefFrame(j2,f.Inverse(),j3));
00046     CPPUNIT_ASSERT_EQUAL(j1,j3);
00047 }
00048 
00049 void JacobianTest::TestChangeBase(){
00050     //Create a random jacobian
00051     Jacobian j1(5);
00052     j1.data.setRandom();
00053     //Create a random rotation
00054     Rotation r;
00055     random(r);
00056     
00057     Jacobian j2(5);
00058     CPPUNIT_ASSERT(changeBase(j1,r,j2));
00059     CPPUNIT_ASSERT(j1!=j2);
00060     Jacobian j3(4);
00061     CPPUNIT_ASSERT(!changeBase(j1,r,j3));
00062     j3.resize(5);
00063     CPPUNIT_ASSERT(changeBase(j2,r.Inverse(),j3));
00064     CPPUNIT_ASSERT_EQUAL(j1,j3);
00065 }
00066 
00067 void JacobianTest::TestConstructor(){
00068     //Create an empty Jacobian
00069     Jacobian j1(2);
00070     //Get size
00071     CPPUNIT_ASSERT_EQUAL(j1.rows(),(unsigned int)6);
00072     CPPUNIT_ASSERT_EQUAL(j1.columns(),(unsigned int)2);
00073     //Create a second Jacobian from empty
00074     Jacobian j2(j1);
00075     //Get size
00076     CPPUNIT_ASSERT_EQUAL(j2.rows(),(unsigned int)6);
00077     CPPUNIT_ASSERT_EQUAL(j2.columns(),(unsigned int)2);
00078     Jacobian j3=j1;
00079     //Get size
00080     CPPUNIT_ASSERT_EQUAL(j3.rows(),(unsigned int)6);
00081     CPPUNIT_ASSERT_EQUAL(j3.columns(),(unsigned int)2);
00082 
00083     //Test resize
00084     j1.resize(5);
00085     //Get size
00086     CPPUNIT_ASSERT_EQUAL(j1.rows(),(unsigned int)6);
00087     CPPUNIT_ASSERT_EQUAL(j1.columns(),(unsigned int)5);
00088 
00089     j2=j1;
00090     //Get size
00091     CPPUNIT_ASSERT_EQUAL(j2.rows(),(unsigned int)6);
00092     CPPUNIT_ASSERT_EQUAL(j2.columns(),(unsigned int)5);
00093 }
00094 
00095 void JacobianTest::TestGetSetColumn(){}
00096 
00097 


orocos_kdl
Author(s):
autogenerated on Mon Oct 6 2014 03:11:16