Giter Club home page Giter Club logo

ur_ikfast's Introduction

IKFast for Universal Robots

IKFast libraries for UR3, UR5, and UR10 both the CB and e-series.

Inspired by https://github.com/andyzeng/ikfastpy

Installation

Easy to install and use:

  1. install dependencies
sudo apt-get install libblas-dev liblapack-dev
pip install --user numpy Cython
  1. install using pip
git clone https://github.com/cambel/ur_ikfast.git
cd ur_ikfast
pip install -e .

It takes a few minutes to compile the IKfast libraries.

Example

from ur_ikfast import ur_kinematics

ur3e_arm = ur_kinematics.URKinematics('ur3e')

joint_angles = [-3.1, -1.6, 1.6, -1.6, -1.6, 0.]  # in radians
print("joint angles", joint_angles)

pose_quat = ur3e_arm.forward(joint_angles)
pose_matrix = ur3e_arm.forward(joint_angles, 'matrix')

print("forward() quaternion \n", pose_quat)
print("forward() matrix \n", pose_matrix)

# print("inverse() all", ur3e_arm.inverse(pose_quat, True))
print("inverse() one from quat", ur3e_arm.inverse(pose_quat, False, q_guess=joint_angles))

print("inverse() one from matrix", ur3e_arm.inverse(pose_matrix, False, q_guess=joint_angles))

For a new robot just create the ikfast database (.cpp) following one of these tutorials:

ur_ikfast's People

Contributors

cambel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ur_ikfast's Issues

No solutions for axis-aligned orientations

Hi, thanks for your work.

I was trying to use the IKFast IK for the UR3e, but I noticed that for axis-aligned orientations, the solver does not return a joint configuration, although there clearly are joint configurations available.

Have you also encountered this? And have you by any chance found a solution? I've found that adding some noise on the quaternion (which results in non-zero values for all components) seems to overcome this, but that's quite an ugly hack imo.

you can recreate this yourself using following snippet:

if __name__ == "__main__":
    ur3e_arm = ur_kinematics.URKinematics('ur3e')

    """
    IKFast seems to struggle with quaternions along axis?
    also note that the order for the wrapper is w,x,y,z!
    """
    pose_quat =  [-0.2,-0.2,0.2,  0.0,1.0,0.0,0] # top-down EEF
    print("inverse() one from quat", ur3e_arm.inverse(pose_quat, False, q_guess=joint_angles))

    pose_quat[4:] += np.random.randn(3) * 0.01
    print("inverse() one from noisy quat", ur3e_arm.inverse(pose_quat, False, q_guess=joint_angles))

cc1plus: fatal error: ur3e_ikfast_wrapper.cpp: No such file or directory

Hi, thank you for this practical and so-far-nice-working repo :)
Today I was trying to build this module on my brand new ubuntu (22.04) OS and got the error below. I thought it might be related to gcc version because it is 9.4.0 on other pc that I built the module flawlessly and now I am trying to build it on new pc which has 11.4.0. After installing gxx=9.4.0 on a mamba environment nothing changed.
What should I check, what do you say?

ur3e/ur3e_ikfast61.cpp:107156:8: warning: unused variable ‘gconst69’ [-Wunused-variable]
107156 | IkReal gconst69=((3.14159265358979)+(((-1.0)*x15683)));
       |        ^~~~~~~~
ur3e/ur3e_ikfast61.cpp:107123:8: warning: unused variable ‘gconst69’ [-Wunused-variable]
107123 | IkReal gconst69=((3.14159265358979)+(((-1.0)*x15679)));
       |        ^~~~~~~~
ur3e/ur3e_ikfast61.cpp:107086:8: warning: unused variable ‘gconst69’ [-Wunused-variable]
107086 | IkReal gconst69=((3.14159265358979)+(((-1.0)*(x15675.value))));
       |        ^~~~~~~~
ur3e/ikfast_wrapper.cpp: In member function ‘std::vector<float> robots::Kinematics::forward(std::vector<float>)’:
ur3e/ikfast_wrapper.cpp:114:33: warning: comparison of integer expressions of different signedness: ‘std::vector<float>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  114 |         if( joint_config.size() != num_of_joints ) {
      |             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
ur3e/ikfast_wrapper.cpp:121:33: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
  121 |         for (unsigned int i=0; i<num_of_joints; i++)
      |                                ~^~~~~~~~~~~~~~
cc1plus: fatal error: ur3e_ikfast_wrapper.cpp: No such file or directory
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with

UR5 end effector

What is the name of the link or the joint which is used as end effector for the UR5 arm and is the frame of the "base_link" still used as reference frame?

ikfast61.cpp generation error for ur5

The links provided for .cpp file generation (using universal robot ur_description urdf) is generating error. Can u share the urdf file ? In your ur5 folder the urdf or dae is not shared.

I skipped the moveit_ikfast round off to 5 decimal place.

Did you also use ur5.xml format (from https://github.com/andyzeng/ikfastpy) to generate ikfast61.cpp file ?

[Question] Does the reference frame match the UR base frame?

Hi @cambel,

I noticed today that the FK of the zero-joint configuration does not seem to match the frame of the base on the ur controller.

On the ur controller, the pose of the zero-configuration for the joints has a negative X and Y value when expressed in the base frame (Y along the power cable, z up).

However, the following script

    zero_joint_pose = URKinematics("ur3").forward(np.zeros(6))
    print(zero_joint_pose)

returns [ 0.4569 0.19425 0.06655 0.70710678 0.70710678 -0. -0. ]

Am I doing something wrong or is a transform required to use the IK on a real robot?

can not get same rotation matrixs in ros

Thank you for your work.
we want to use your code to creat the solutions for ur5. But we get different solutions when we calculate the rotation matrixs between from ROS and your code.
for examp,we get the rotation matrixs from quaternion in ros:
[ 9.44e-05 1 9.762e-05 -1.0915e-01
-1.56e-04 9.76e-05 -9.999e-01 6.04687e-01
-1 9.440e-05 1.5637e-04 4.318e-01 ]

but your code from jiont angle is :
rotation matrixs:
[ 1 9.746e-05 -9.446e-5 -1.0915e-01
9.76e-05 -9.999e-01 1.56e-04 6.04687e-01

  • 9.440e-05 -1.56e-04 -1 4.318e-01]

We can see the two rotation matrixs have same position information,but the rotation part seem to be in other coordinate system

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.