Skip to content

Commit 3387532

Browse files
committed
Tried implementing LFC
1 parent 565c480 commit 3387532

21 files changed

+20
-7
lines changed

.idea/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/TSwR_student.iml

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
159 Bytes
Binary file not shown.
536 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

controllers/feedback_linearization_controller.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ def calculate_control(self, x, q_r, q_r_dot, q_r_ddot):
1212
Please implement the feedback linearization using self.model (which you have to implement also),
1313
robot state x and desired control v.
1414
"""
15-
return NotImplementedError()
15+
inverted_M = np.linalg.inv(self.model.M(x))
16+
v = -self.model.C(x) @ inverted_M @ x[2:] + np.eye(2) @ inverted_M @ np.ones((2, 1))
17+
18+
# zeros = np.zeros((2, 2), dtype=np.float32)
19+
# A = np.concatenate([np.concatenate([zeros, np.eye(2)], 1), np.concatenate([zeros, -invM @ self.C(x)], 1)], 0)
20+
# b = np.concatenate([zeros, invM], 0)
21+
# return A @ x[:, np.newaxis] + b @ u
22+
23+
return v

flc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
"""
1616
Switch to FeedbackLinearizationController as soon as you implement it
1717
"""
18-
#controller = FeedbackLinearizationController(Tp)
19-
controller = DummyController(Tp)
18+
controller = FeedbackLinearizationController(Tp)
19+
#controller = DummyController(Tp)
2020

2121
"""
2222
Here you have some trajectory generators. You can use them to check your implementations.
2323
At the end implement Point2point trajectory generator to move your manipulator to some desired state.
2424
"""
25-
# traj_gen = ConstantTorque(np.array([0., 1.0])[:, np.newaxis])
25+
#traj_gen = ConstantTorque(np.array([0., 1.0])[:, np.newaxis])
2626
traj_gen = Sinusoidal(np.array([0., 1.]), np.array([2., 2.]), np.array([0., 0.]))
2727
#traj_gen = Poly3(np.array([0., 0.]), np.array([pi/4, pi/6]), end)
2828

160 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
154 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
153 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)