Search
The goal of this task is to solve the inverse kinematic task for a general 6R mechanism using a general Groebner Basis computation. This consists of the six main elements
Groebner 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
a. Implement function rat_approx(n, tol) returning a rational approximation of the 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 exact_cs(angle, tol) returning a rational point on the unit circle, which is close to a given point defined by angle.
exact_cs(angle, tol)
angle
I/O specifications for exact_cs:
exact_cs
[c, s]
$$c^2 + s^2 = 1 \textrm{ (exactly) } \quad \& \quad \exists k \in \mathbb{Z}: |\mathrm{atan2}(s, c) - angle + 2k\pi| < tol$$
c. Implement function exact_rot(q, tol) returning an exact rotation close to the one given by quaternion q.
exact_rot(q, tol)
q
I/O specifications for exact_rot:
exact_rot
np.array
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
“theta1 offset”
“theta6 offset”
“d1”
“d6”
“a1”
“a6”
“alpha1”
“alpha6”
“cos alpha1”
“sin alpha1”
“cos alpha6”
“sin alpha6”
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 Groebner basis of the instance of IKT. It is forbidden to use the function solve from sympy library.
solve_ikt_gb_lex(gb)
I/O specifications for solve_ikt_gb_lex:
solve_ikt_gb_lex
gb
gb[0]
gb[1]
gb[11]
Upload a zip archive hw08.zip containing
hw08.zip
hw08.json
hw08.py
Creating hw08.json:
The value stored in hw08.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 dictionary. Every angle must belong to the interval $[-\pi, \pi]$. An example looks as follows:
real_sols = [{"theta1": 1.1, "theta2": 1.2, "theta3": 1.3, "theta4": 1.4, "theta5": 1.5, "theta6": 1.6}, {"theta1": 2.1, "theta2": 2.2, "theta3": 2.3, "theta4": 2.4, "theta5": 2.5, "theta6": 2.6}] import json with open("hw08.json", "w") as outfile: json.dump(real_sols, outfile)
Example of how to use the function get_ikt_gb_lex:
get_ikt_gb_lex
from sympy import symbols c1, s6 = symbols('c1, s6') eqs = [Poly(s6**2 + c1 + 1), Poly(s6 + c1 + 1)] gb = get_ikt_gb_lex(eqs) print(gb)
The output of the print(gb) command is
print(gb)
[Poly(1.0*s6**2 - 1.0*s6, s6, domain='RR'), Poly(1.0*s6 + 1.0*c1 + 1.0, s6, c1, domain='RR')]
The function get_ikt_gb_lex works only locally on your computer, don't try to upload the code with it to the upload system, it will fail.