ME465 Lab 4
Introduction
For serial kinematic manipulators, the inverse kinematics problem is one of the most important to solve. Once the inverse kinematics solver is programmed and tested, further robot end effector locations can be specified in a Cartesian coordinate system and the corresponding set of joint angles can be found.
Robot API
For this project, you will program an inverse kinematics solver for a robot with three degrees of freedom.
The MATLAB Robot
class (available here) has a function robot.goal()
which returns a vector of size two, representing the desired x-y location of the robot’s end effector.
To help you with this, the Jacobian has already been derived and can be accessed using robot.jacobian(q)
where q
is a vector of size three containing the joint angles.
To initialize this class use robot = Robot(dt)
where dt
is the length of time between new sets of joint angles being computed.
Several other functions are also available in the Robot
class:
-
robot.pose(q)
returns the two dimensional position of the robot end effector for a set of joint anglesq
, -
robot.plot(q)
plots the robot in red, the goal location in green, and the path of the end effector in blue, -
robot.length()
returns the number of goal locations the robot should be moved to, -
robot.inc(sleep)
waits for the number of seconds specified in the argumentsleep
and instructs the robot class to provide the next goal location whenrobot.goal()
is called, and -
robot.complete()
returnstrue
only after the robot has completed its path.
For your code, use an initial set of joint angles $q=[0.45,\ -2,\ 0.3]^T$.
Initially use dt=0.1
to develop your code.
Suggested Steps
- Initialize the
Robot
class. - Create a while loop that runs until
robot.complete()
returnstrue
. - Inside the loop:
- Run the robot’s
plot
andinc
functions. - Calculate the desired robot end effector displacement.
- Get the current Jacobian.
- Calculate the Jacobian pseudo inverse using $J^\ast(JJ^\ast)^{-1}$.
- Calculate the new joint angles using the Jacobian pseudo inverse and desired displacement;
- Run the robot’s
Lab Report
After you have confirmed that your code is working, try changing dt
to 0.5 and 1.
Describe in your report what happens.
Also, change the location of the center of the circle the end effector is tracing to $[0.1,\ 1.5]^T$ using robot.set_center(0.1, 1.5)
.
Explain what is happening.