lanius / tinyik Goto Github PK
View Code? Open in Web Editor NEWA tiny inverse kinematics solver
License: MIT License
A tiny inverse kinematics solver
License: MIT License
Hi. I work on the CNC/CAM workbench in FreeCAD. I want to add basic 4th and 5th axis capability and I need a very simple inverse kinematics solver. I'd really like to have a longer conversation/chat with you about whether tinyik can meet our needs.
If you'd be willing to chat, please email me at shopinthewoods 'at' gmail.com, reply here, or find me on the FreeCAD/Path gitter page at https://gitter.im/FreeCAD/Path.
To give a little context of what I'm trying to achieve, check the XYZAC-TRT diagram on this page:
https://linuxcnc.org/docs/2.8/html/motion/5-axis-kinematics.html
Hi @lanius, thanks for this cool repo!
I would like to add a joint that can rotate about all axes (i.e., a 3-DoF joint).
How can this be done?
Thanks!
Hi lanius,
The current version is implemented for absolute axis 'x', 'y', 'z'. Is it possible to provide option for relative axis, i.e. Flexion, Abduction, Twist? Thanks!
Hi,
is it possible to set the initial angles and positions of the joints of the arm?
if so can you please tell how to do that?
Thanks
Hello. I'm trying to run the examples with visualization feature, as shown in Readme.md. But I'm having the following error message:
module 'tinyik' has no attribute 'visualize'
In fact, "visualize" function was not found at tinyik code.
P.S.: I've installed the package using the command "pip install tinyik[viz]" at cmd. During installation, I've received the following:
WARNING: tinyik 1.2.0 does not provide the extra 'viz'
How to get the visualization feature? I'm using Python 3.8.3 over Windows 10 64bits.
It looks like the ee() method will always return the position, but not the orientation of the end effector. How can I get the full pose (X/Y/Z/Yaw/Pitch/Roll) of the end effector on a 6DOF system?
Hello
When three classes are built from this library at the same time, the calculations for the third class are not done correctly.
self.brush_arm= Actuator(['y', [0., 0., 0.01], 'x', [0., 0., 1.11], 'x', [0., 0., 1.225]])
self.left_leg = Actuator(['x', [0., 0., 1.175], 'x', [0., 0., 1.225],'x', [0., 0., .001] ])
self.right_leg = Actuator(['x', [0., 0., 1.175], 'x', [0., 0., 1.225],'x', [0., 0., .001] ])
Good day!
I'm new to Python and especially on the Inverse Kinematics topic. If I may ask, is it possible to give angle limits to each joint since I'm using servo motors.
Thanks!
How can I go about transforming my known DH Parameters into the coordinate system that's expected by this solver? In general, some more examples or documentation about the coordinate system used would be super helpful. Thanks!
Really great work!
Lines 3 to 6 in e32a25e
Why do this? Initially, I didn't install with pip install tinyik[viz]
and was confused what o3d
was when I got an error about not begin able to import it. Suggest removing this since you are bypassing the check and potentially leading to a confusing error for the user.
Hello!
First off, this project is awesome! The fact that is it so simple and the code is easy to understand is great.
The problem I have is that when some links are drawn along the Z-axis, the cylinders aren't displayed in the visualizer.
Here's the configuration I'm working with:
tinyik.Actuator(['z', [0, 0, 180.7], 'y', [-612.7, 0, 0], 'y', [-571.55, 0, 0], 'y', [0, -174.15, 0], 'z', [0, 0, -119.85], 'y', [0, -116.55, 0]])
Here's a screenshot from the visualizer:
(FYI, I'm using a radius of 10)
Do you know of a workaround for this problem?
Thanks!
Is there a prismatic joint support in this library?
I am following this simple example:
import tinyik
arm = tinyik.Actuator(['z', [1., 0., 0.], 'z', [1., 0., 0.]])
arm.ee = [2 / np.sqrt(2), 2 / np.sqrt(2), 0.]
arm.angles
array([ 7.85398147e-01, 3.23715739e-08])
np.round(np.rad2deg(arm.angles))
array([ 45., 0.])
In my case I am using 3 links which look like this:
Red is the root (say, shoulder joint), green is parented to it (i.e. elbow) and blue is parented to green (i.e. wrist).
The yellow dot is the end effector.
So in my code I do something like:
arm = tinyik.Actuator(['z',[red.x, red.y, 0], 'z',[green.x, green.y, 0], 'z',[blue.x, blue.y, 0]])
red.angle = np.rad2deg(arm.angles[0])
green.angle = np.rad2deg(arm.angles[1])
blue.angle = np.rad2deg(arm.angles[2])
When I apply the above example and move the end effector to x=1.5, y=1.5 I get this:
Looks promising but doesn't seem very close to what I expected (i.e. the blue joint reaching to be as close to the end effector as possible).
When I move the end effector even closer to the left, i.e. x=1.0, y=1.5 it gets worse:
I'm sure I'm doing something wrong but don't know what it is.
Can you help?
Thanks,
frank
Thanks for this great tool.
However, when I try to visualize my chain, it does not work well. Would you please help me find the reason? My code is shown below:
import tinyik
import numpy as np
left_arm_idx = [15, 16, 17]
left_arm_bone1 = source_joints[ left_arm_idx[1],: ] - source_joints[ left_arm_idx[0],: ]
left_arm_bone2 = source_joints[ left_arm_idx[2],: ] - source_joints[ left_arm_idx[1],: ]
leftarm = tinyik.Actuator(['x','y','z', left_arm_bone1, 'x','y','z', left_arm_bone2])
tinyik.visualize(leftarm)
The values of the two bones are:
left_arm_bone1 = [-0.77607921, 2.00528251, -3.82166443]
left_arm_bone2 = [-4.19961586, -0.31558648, 0.79598167]
The visualization is not as expected. The direction of the bone is wrong.
Using tinyik
off of Git, commit e34d514
I am trying to implement a model of the robot arm used in one of my projects,
before I can evaluate how well the IK provided by this library works the first step is to ensure I can represent the arm in a form that this library can understand.
I modified the example in the readme with the dimensions of my arm, though the visualizer seems to draw a blank.
import tinyik
import numpy
raw_list = [
# [0.0, 0.0, 0.0],
# turret rotation is at IK root.
# "z",
# offset to pivot of upper arm joint
[84.62, (31.62 + 47.76), 0.0],
# which pivots on the Y axis
"y",
# offset ot pivot of lower "forearm" joint
[265.96+267.44, 0, 0],
# which is Also a Y axis Joint
"y",
# leads to the EE pitch joint
[0, -1 * (239.48+239.92), 0.0],
"y"
]
arm = tinyik.Actuator(raw_list
)
# leg = tinyik.Actuator([[.3, .0, .0], 'z', [.3, .0, .0], 'x', [.0, -.5, .0], 'x', [.0, -.5, .0]])
# leg.angles = numpy.deg2rad([30, 45, -90])
# tinyik.visualize(leg)
print(arm.components)
tinyik.visualize(arm)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.