Mechanism in the World Frame
This tutorial will guide you through the process of designing a mechanism with end-effector (tool) in the world frame.
Default (home) configuration
By default, the tool frame corresponds to identity pose, i.e., the end-effector is at the origin of the world frame in its home configuration.
See Optional tool frames for more details how differently specify a tool frame.
Home configuration is given when parameter \(t=\infty\) (or number like \(t=10^{12}\) or higher in practice).
To design a mechanism with a tool, the home configuration can be used in combination with the joint axes. The method
RationalMechanism.get_design() can be used to generate the needed design parameters, as it returns
the Denavit–Hartenberg parameters, axes-line connection parameters for prepared Onshape model (see
Physical modelling of Bennett mechanism), and the list of point pairs that define the axes. These point pairs are scaled
to match the size of the links specified by the method RationalMechanism.get_design() arguments.
The point pairs are a convenient way
to assembly your mechanism correctly. See the example below:
from rational_linkages import Plotter
from rational_linkages.models import bennett_ark24
m = bennett_ark24()
dh, design_params, design_points = m.get_design(return_point_homogeneous=True,
pretty_print=False)
# obtain points on joint0
base_joint0_pts = design_points[0]
# obtain points on the last joint (joint3)
base_joint3_pts = design_points[-1]
p = Plotter(m, arrows_length=0.1, backend='matplotlib')
# plot the first joint points
for i, pt in enumerate(base_joint0_pts):
p.plot(pt, label=f'j0{i}')
# plot the last joint points
for i, pt in enumerate(base_joint3_pts):
p.plot(pt, label=f'j3{i}')
p.show()
m.export_single_mesh(add_tool_frame=True,
file_name='mesh_bennett_ark24.stl')
The output will look similar like in the figure below, where the points belonging to joints 0 and 3 are plotted in the world frame, which is coincident with the tool frame at this (home) configuration. As the first and last joints are always static, they can be used to determine the position of the mechanism base link in the world frame once you start assembling the CAD model.
It can be useful to observe the visualization of the mechanism. For this purpose, the mechanism can be meshed and exported as STL or STEP file. The methods
can be used for this purpose. See tutorial CAD Modeling for more details on how to use them. The result can look like on the figure below.
See another figure bellow describing how the related attributes of the RationalMechanism class are
programmed in the background. The reason for this implementation is that the mechanisms can have more than 4 joints,
and therefore the number of joints and links is variable.
The joint axes \(\mathbf{h}_i\) and \(\mathbf{k}_i\) correspond to the dual quaterionions defined in
the Rational Motions and their Factorization section. Physically, these mechanism create LineSegment objects, i.e.
a polyline that connects the physical realization of the joint-link segments. For 4R mechanism, there are
8 segments \(\mathbf{s}_{0..7}\). The attribute RationalMechanism.segments then keeps the naming
as base link is \(\mathbf{l}_{00}\), first joint of right factorization is \(\mathbf{j}_{00}\), while
the first joint of the left factorization is \(\mathbf{j}_{10}\), etc. The last link is \(\mathbf{l}_{12}\).
Changing base frame of the mechanism
For plotting, it is possible to change the base frame of the mechanism. See the example in Quadratic interpolation of 5 points in the quadratic interpolation of 5 points how to do it.