Design
Design
We don’t mind if you work with other students on your homeworks. However, each
student must write up and turn in their own assignment (i.e. no copy & paste). If you
worked with other students, please acknowledge who you worked with at the top
of your homework.
Question 1. (10 points)
Using your knowledge of Lagrangians, derive the equations of motion for a double
pendulum (shown below). Assume that two masses connected together by massless
links and revolute joints. Check out MLS 4.1-4.2 to get started.
Answer:
First, we find the squared velocities of the masses:
v12 = l12 θ̇12
v22 = l12 θ̇12 + l22 (θ̇1 + θ̇2 )2 + 2l1 l2 θ̇1 (θ̇1 + θ̇2 ) cos θ2
Then, we find the kinetic and potential energies:
1 1
K = m1 l12 θ̇12 + m2 (l12 θ̇12 + l22 (θ̇1 + θ̇2 )2 + 2l1 l2 θ̇1 (θ̇1 + θ̇2 ) cos θ2 )
2 2
V = −m1 gl1 cos θ1 − m2 g(l1 cos θ1 + l2 cos(θ1 + θ2 ))
1
EE106a - Spring 2016 Assignment 1
L=K −V
where
A =m1 l12 + m2 l12 + m2 l22 + 2m2 l1 l2 c2
B =m2 l22 + m2 l1 l2 c2
C =m2 l22
2
EE106a - Spring 2016 Assignment 1
X Y
x=f y=f
Z Z
where f is the focal point of the camera. As you can see, if we are just given a point in
an image, solving for the point in the real world is underdetermined.
Let’s assume we have two cameras that are taking pictures of the same object.
Suppose the change in perspective of camera 1 to camera 2 is given by a rotation R
and translation t.
Show how we can map point x1 = (x1 , y1 ) in the image from camera 1 to the image
from camera 2. Then, show how we can recover the real world coordinates (X, Y, Z).
Answer:
The key to this problem is recognizing that the point in camera 1 x1 = (x1 , y1 ) maps
to X1 = (X, Y, Z), in the coordinate frame of camera 1. That means to map this to a
point in the image plane of camera 2 you have to transform X1 to the coordinate frame
of camera 2 and then project it into the image plane. To do this, you’ll have to assume
you have an idea of what Z is, as was hinted on Piazza.
First, solve for X and Y :
X1 = Zx1 /f
Y1 = Zy1 /f
3
EE106a - Spring 2016 Assignment 1
All that is left is to project this new point into the image plane of camera 2, by using
the given relationships x2 = f X2 /Z and y2 = f Y2 /Z.
For the second part of the problem, you can derive a system of equations to solve for
the real-world point, using the relationships given for a single image, the translations
found between the two cameras, and a little algebra. Note that you could also have
solved this problem, using homography notation, as presented in Problem 3.
You may have recognized that this is part was attempting to solve the stereovision
problem (i.e. recovering depth from two cameras/perspectives), which is often used in
computer vision for robotics.
BONUS: (5 points)
You may notice that parallel lines in images converge to the same point in the image
plane. Show the mapping of this line to the image plane and show all parallel lines
converge to the same point.
Answer:
You can write a line as a point A and a direction vector D in a three dimensional space
X Ax Dx
Y = Ay + λ D y
Z Az Dz
4
EE106a - Spring 2016 Assignment 1
From this, we can see that the projection from real world point to image point is given
through a projection matrix:
X
1 0 0 0 X
0 1 0 0 Y → f ,fX Y
Z = Y
Z Z
0 0 1/f 0 Z/f
1
Now let’s consider camera perspectives again. Mapping between different perspectives
is called a homography, assuming the same center of projection. Given a point p from
one perspective, we can map this to another perspective point p0 with homography H.
Formally:
0
p 0 = Hp
wx h11 h12 h13 x
wy 0 = h21 h22 h23 y (1)
w h31 h32 1 1
Recall from class that the entry h33 affects scaling, so is generally set to 1. Using this
idea, we can do some fun things like rectify images and play with perspective (Fig. 4
and 5).
5
EE106a - Spring 2016 Assignment 1
Use MATLAB or your favorite programming language to play around with changing
perspectives of images. Provide some of the original images, how you chose your
homographies, the resulting images, and code snippets that you wrote. Briefly discuss
your implementation and observations you made. Have a little fun. Here’s a link for
some fun images to play with: www.julianbeever.net
For help getting started, see Lab 4 from EE106a on bCourses.
Answer:
Gold star for effort!
as presented in MLS 4.3. Let H = T + V to be the total energy for a rigid robot. Show
that if Ṁ − 2C is skew-symmetric, then energy is conserved, meaning that Ḣ = θ̇> τ .
6
EE106a - Spring 2016 Assignment 1
In a sentence or two, briefly discuss the importance of the passivity property for
robotic manipulators.
Answer:
Using the derivations for T and V on page 168 of MLS, we take the derivative of H:
1 1 1 ∂V
Ḣ = θ̈> M (θ)θ̇ + θ̇> Ṁ (θ)θ̇ + θ̇> Ṁ (θ)θ̈ + θ̇(θ)
2 2 2 ∂θ
1 ∂V
= θ̇> M (θ)θ̈ + θ̇> Ṁ θ̇ + θ̇> (θ)
2 ∂θ
∂V 1 ∂V
Ḣ = θ̇> (τ − C(θ, θ̇)θ̇ − (θ)) + θ̇> Ṁ θ̇ + θ̇> (θ)
∂θ 2 ∂θ
1
= θ̇> τ + θ̇> Ṁ − C(θ, θ̇) θ̇
2
= θ̇> τ
Passivity is a very important concept in controls and robotics. In robots (and generally
in mechanical systems), passivity relates to the energy dissipation of the system,
meaning that the system is not generating energy, and therefore ties into stability and
tracking, as we talked about in discussion.
Question 5. Show that the workspace version of the PD control law results in
exponential stability in terms of trajectory tracking. First, derive the workspace
dynamics and associated closed loop control. Then, prove stability.
Answer:
Following the transformations given in the book, we can represent the workspace
dynamics in the following form:
Using this, we can use our computed torque law or the augmented PD control law to
control the system.
The augmented PD law is given by:
7
EE106a - Spring 2016 Assignment 1
The book gives a proof of stability using Lyapunov arguments, which were not covered
in this class. In discussion, we showed how to find stability of the system by analyzing
the dynamics. We can apply similar techniques, but there is one trick piece here:
dealing with M̃ (θ) and C̃(θ, θ̇). If you recall, when using the computed torque law this
term was cancelled out and results in nice linear error dynamics. Since we’re not
canceling this out, we can do a few things: (1) drop dependence on θ (see MLS pg.
197) and continue solving as we would normally; or (2) linearize M̃ (.) and C̃(.) about
some operating point θ0 and proceed.
We find the following error dynamics:
d e −1 0 I e
= M̃
dt ė kp C̃ + kv ė
By analyzing how this system evolves (i.e. checking the eigenvalues of the transition
matrix), we’ll find that the errors decay away and our system is stable. In practice, the
eigenvalues of such a matrix would be computed using numerical methods such as the
Power Method or QR Algorithm described in Numerical Computation of Eigenvalues:
http://www.math.umn.edu/˜olver/num /lnqr.pdf.