Search
The goal of this task is to solve the inverse kinematic task for a general 6R mechanism using a general Gröbner basis computation. This consists of the six main elements
Gröbner basis computation is done in exact arithmetics over rational numbers and therefore input must be provided in rational numbers. At the same time, the input must satisfy all identities on rotations, otherwise the systems would have no solution.
Steps to setup:
maple
cmaple
Forbidden modules/methods: sympy.solvers, fractions.Fraction.limit_denominator
a. Implement function rat_approx(n, tol) that returns a rational approximation of a given number n.
rat_approx(n, tol)
n
I/O specifications for rat_approx:
rat_approx
tol
Fraction
f
$$|f - n| < tol$$
b. Implement function rational_cs(angle, tol) that returns a rational point on the unit circle, which is close to a given point defined by angle.
rational_cs(angle, tol)
angle
I/O specifications for rational_cs:
rational_cs
[c, s]
$$c^2 + s^2 = 1 \textrm{ (exactly) }$$
c. Implement function rational_rot(q, tol) that returns a rational rotation close to the one given by quaternion q.
rational_rot(q, tol)
q
I/O specifications for rational_rot:
rational_rot
np.ndarray
r
$$ r^\top r = \mathrm{I}, \;\; \det{r} = 1 \textrm{ (exactly) } \quad \& \quad ||r - R(q)||_{\mathrm{F}} < tol $$ where $||\cdot||_{\mathrm{F}}$ denotes the Frobenius norm.
d. Implement function rational_mechanism(mechanism, tol) which converts the input mechanism to the rational one.
rational_mechanism(mechanism, tol)
I/O specifications for rational_mechanism:
rational_mechanism
mechanism
“theta offset”
“d”
“a”
“alpha”
“sin alpha”
“cos alpha”
e. Implement function rational_pose(pose, tol) which converts the input pose to the rational one.
rational_pose(pose, tol)
I/O specifications for rational_pose:
rational_pose
pose
“q”
“t”
f. Implement function ikt_eqs(mechanism, pose, tol) which returns the polynomial equations for the rationalized inverse kinematic task.
ikt_eqs(mechanism, pose, tol)
I/O specifications for ikt_eqs:
ikt_eqs
Poly
c1
s1
c6
s6
g. Implement function solve_ikt_gb_lex(gb) which returns the list of real solutions to a lexicographic Gröbner basis of the instance of IKT.
solve_ikt_gb_lex(gb)
I/O specifications for solve_ikt_gb_lex:
solve_ikt_gb_lex
gb
gb[0]
gb[1]
gb[11]
numpy.roots
Upload a zip archive hw07.zip containing
hw07.zip
hw07.json
hw07.py
Creating hw07.json:
The value stored in hw07.json will be a list of all real joint solutions for the mechanism and the pose specified for you in BRUTE. Every solution must be represented as a list. Every angle must belong to the interval $(-\pi, \pi]$. An example looks as follows:
real_sols = [[1.1, 1.2, 1.3, 1.4, 1.5, 1.6], [2.1, 2.2, 2.3, 2.4, 2.5, 2.6]] import json with open("hw07.json", "w") as outfile: json.dump(real_sols, outfile)
eqs2gb
from sympy import symbols x, y = symbols('x, y') eqs = [poly(x*y - 1), poly(x**2 - y)] gb = eqs2gb(eqs, [x, y], "lex") print(gb)
The output of the print(gb) command is
print(gb)
[Poly(1.0*y**3 - 1.0, y, domain='RR'), Poly(1.0*x - 1.0*y**2, x, y, domain='RR')]