Java教程

ikpy 示例程序调整

本文主要是介绍ikpy 示例程序调整,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

github 工程

Phylliade/ikpy: An Inverse Kinematics library aiming performance and modularity (github.com)

ikpy/Quickstart.ipynb at master · Phylliade/ikpy (github.com)

 

调整增加第一行和第25行,然后将该py文件放到tests目录下运行!

 

 

 

 

 

 

 1 #! /usr/bin/python3.6
 2 
 3 import ikpy.chain
 4 import numpy as np
 5 import ikpy.utils.plot as plot_utils
 6 
 7 my_chain = ikpy.chain.Chain.from_urdf_file("../resources/poppy_ergo.URDF")
 8 
 9 target_position = [ 0.1, -0.2, 0.1]
10 
11 print("The angles of each joints are : ", my_chain.inverse_kinematics(target_position))
12 
13 real_frame = my_chain.forward_kinematics(my_chain.inverse_kinematics(target_position))
14 print("Computed position vector : %s, original position vector : %s" % (real_frame[:3, 3], target_position))
15 
16 # Optional: support for 3D plotting in the NB
17 # If there is a matplotlib error, uncomment the next line, and comment the line below it.
18 #%matplotlib inline
19 #%matplotlib widget
20 import matplotlib.pyplot as plt
21 fig, ax = plot_utils.init_3d_figure()
22 my_chain.plot(my_chain.inverse_kinematics(target_position), ax, target=target_position)
23 plt.xlim(-0.1, 0.1)
24 plt.ylim(-0.1, 0.1)
25 plt.show()

 

这篇关于ikpy 示例程序调整的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!