Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate IK based on the world frame #159

Open
joel0115 opened this issue Nov 17, 2024 · 1 comment
Open

Calculate IK based on the world frame #159

joel0115 opened this issue Nov 17, 2024 · 1 comment

Comments

@joel0115
Copy link

Hi, thanks for your impressive works, sorry for my disturbing.
I used the following code to test the IK calculator.
However, when I plot the chain, I found that the chain's base is not located at the world's origin (0,0,0).
And I realized that IK is calculated based on the chain base's frame. But I want to calculate IK based on world frame.
So, is it possible to do one of the following or both?

  1. Locate my chain at the world's origin.
  2. Calculate IK based on the world's frame. i.e. [0.6042, 0.1777, 0.3502] means the coordinate w.r.t. world frame, instead of the chain base frame.

Thanks in advance!

my_chain = ikpy.chain.Chain.from_urdf_file(urdf_path)

target_position = [0.6042, 0.1777, 0.3502]
print("The angles of each joints are : ", my_chain.inverse_kinematics(target_position))

real_frame = my_chain.forward_kinematics(my_chain.inverse_kinematics(target_position))
print("Computed position vector : %s, original position vector : %s" % (real_frame[:3, 3], target_position))

fig, ax = plot_utils.init_3d_figure()
my_chain.plot(my_chain.inverse_kinematics(target_position), ax, target=target_position)
plt.xlim(-1 ,1)
plt.ylim(-1, 1)
plt.savefig("IK.png")

image

@joel0115
Copy link
Author

An additional problem is that, my chain consists of arm and finger parts, but the IK "seems" only considering the arm's end, not the finger's tool center pose (tcp).
Is it due to my urdf file or do I need to pass some parameters to let the chain realize it?
Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant