Forward KinematicsMike [email protected] State Universitymjb – September 23, 2014Oregon State UniversityComputer GraphicsForward Kinematics:You Start with Separate Pieces, all Defined in their Own Local Coordinate System321mjb – September 23, 2014Oregon State UniversityComputer GraphicsForward Kinematics:Hook the Pieces Together, Change Parameters, Things Move(All Children Understand This)321mjb – September 23, 2014Oregon State UniversityComputer GraphicsForward Kinematics: Where do the Pieces Move To?Locations?3321212Ground1mjb – September 23, 2014Oregon State UniversityComputer GraphicsPositioning Part #1 With Respect to Ground1. Rotate by Θ12Translate byT2.Translate by T1/GWrite it1/ 1/ 1*GGMTRSay it1/ 1/ 1GGMTRmjb – September 23, 2014Oregon State UniversityComputer GraphicsyWhy Do We Say it Right-to-Left?It’s because in the matrix notes, we adopted the con ention that the coordinates arethe convention that the coordinates are multiplied on the right side of the matrix:''xxx 1/ 1/ 1'**'11 1GGyy yMTRzz z So the right-most transformation in themjb – September 23, 2014Oregon State UniversityComputer Graphics So the rightmost transformation in the sequence multiplies the (x,y,z,1) first and the left-most transformation multiples it lastPositioning Part #2 With Respect to Ground1Rotate byΘ2Wi i1.Rotate by Θ22. Translate the length of part 13. Rotate by Θ 14. Translate by T1/GWrite ity1/G***MTRTR2/ 1/ 1 2/1 2***GGMTRTR 2/ 1/ 2/1*GGMMMmjb – September 23, 2014Oregon State UniversityComputer GraphicsSay itPositioning Part #3 With Respect to Ground1. Rotate by Θ32. Translate the length of part 23Rotate byΘ23.Rotate by Θ24. Translate the length of part 15. Rotate by Θ16.Translate byT1/GWrite it6.Translate by T1/G*****MTRTRTR3/ 1/ 1 2 /1 2 3/2 3*****GGMTRTRTR 3/ 1/ 2 /1 3/2**GGMMMMmjb – September 23, 2014Oregon State UniversityComputer GraphicsSay itSample Program33212121Ground1mjb – September 23, 2014Oregon State UniversityComputer GraphicsGou dSample Program, using OpenGL’s Automatic Transformation ConcatenationBUTTLENGTH_11DrawLinkOne( )THICKNESS{glColor3f( 1., 0., 0. ); // red, green blueglBegin( GL_QUADS );glVertex2f( -BUTT, -THICKNESS/2 );g(,/)glVertex2f( LENGTH_1, -THICKNESS/2 );glVertex2f( LENGTH_1, THICKNESS/2 );glVertex2f( -BUTT, THICKNESS/2 );glEnd();mjb – September 23, 2014Oregon State UniversityComputer GraphicsglEnd( );}DrawMechanism( float 1, float 2, float 3 )Sample Program{glPushMatrix( );glRotatef( 1, 0., 0., 1. );glColor3f( 1., 0., 0. );glColor3f( 1., 0., 0. );DrawLinkOne( );glTranslatef( LENGTH_1, 0., 0. );lRttf(2001)Write itglRotatef( 2, 0., 0., 1. );glColor3f( 0., 1., 0. );DrawLinkTwo( );Write itSay itglTranslatef( LENGTH_2, 0., 0. );glRotatef( 3, 0., 0., 1. );glColor3f( 0., 0., 1. );DrawLinkThree( );DrawLinkThree( );glPopMatrix( );}mjb – September 23, 2014Oregon State UniversityComputer GraphicsSample ProgramWhere in the glViewport( 100, 100, 500, 500 );glMatrixMode( GL_PROJECTION );lL dId tit()Where in the window to display (pixels)glLoadIdentity( );gluPerspective( 90., 1.0, 1., 10. );glMatrixMode( GL_MODELVIEW );Viewing Info: field of view angle x:y aspect _glLoadIdentity( );done = FALSE;while( ! done )angle, x:y aspect ratio, near, farwhile( ! done ){<< Determine 1, 2, 3 >>glPushMatrix();lL kAt(Whatever interaction is being used to getgluLookAt( eyex, eyey, eyez,centerx, centery, centerz,upx, upy, upz );DrawMechanism( 1, 2, 3 );being used to getthe eye positionSet themjb – September 23, 2014Oregon State UniversityComputer GraphicsglPopMatrix();}eye positionSample ProgramIn Project #4, you won’t be able to do this.fYou will need to create each full matrix separately using your own Matrix class methods.mjb – September 23, 2014Oregon State UniversityComputer
View Full Document