コード例 #1
0
 def __init__(self, urdf_mode_path):
     urdf = open(urdf_mode_path).read()
     urdf = urdf.replace('encoding="utf-8"',
                         '').replace('encoding=\'utf-8\'', '')
     self.chain = kp.build_chain_from_urdf(urdf)
     self.njoints = len(self.chain.get_joint_parameter_names())
     self.end_link = "end_effector"  # "link{}".format(self.njoints)
コード例 #2
0
ファイル: ros_snake.py プロジェクト: incud/ElaboratoRobotica
 def __init__(self, from_rosparam=False):
     if from_rosparam:
         try:
             urdf = rospy.get_param('/robot_description')
         except:
             urdf = open("modello.urdf").read()
     else:
         urdf = open("modello.urdf").read()
     
     urdf = urdf.replace('encoding="utf-8"', '').replace('encoding=\'utf-8\'', '')
     self.chain = kp.build_chain_from_urdf(urdf)
     self.njoints = len( self.chain.get_joint_parameter_names() )
     self.end_link = "end_effector" # "link{}".format(self.njoints)
     self.ik_solver = IK("link0", self.end_link, urdf_string=urdf)
コード例 #3
0
import kinpy as kp

chain = kp.build_chain_from_urdf(
    open("/home/frank/Documents/can_motor/two_arm_neck/two_arm_neck.urdf").
    read())
print(chain)
コード例 #4
0
 def __init__(self):
     self.chain = kp.build_chain_from_urdf(open("modello.urdf").read())
     self.njoints = len(self.chain.get_joint_parameter_names())
     self.end_link = "link{}".format(self.njoints)
     print("End link is: ", self.end_link)
コード例 #5
0
ファイル: gyms.py プロジェクト: incud/ElaboratoRobotica
 def __init__(self):
     self.chain = kp.build_chain_from_urdf(
         open(SnakeGym.URDF_MODEL_PATH).read())
     self.N_JOINTS = len(self.chain.get_joint_parameter_names())
     self.JOINT_LIMITS = np.array(self.N_JOINTS * [SnakeGym.JOINT_LIMIT])
     self.reset()
コード例 #6
0
"""Test that displays an arm configuration using kinpy.

Written by Simon Kapen '24 in Fall 2021.
"""

import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import art3d
from arm_node import Node
import kinpy as kp

chain = kp.build_chain_from_urdf(
    open("models/SimpleArmModelforURDF.URDF").read())
chain = kp.build_serial_chain_from_urdf(
    open("models/SimpleArmModelforURDF.URDF").read(), "hand_1", "base_link")

angle_config = kp.ik.inverse_kinematics(chain,
                                        kp.Transform(pos=[0.2, 0.2, 0.2]))
ret = chain.forward_kinematics(angle_config, end_only=False)
print(ret)

node = Node.from_point([.2, .2, .2])
print(node.joint_positions)

# # Generate locations of each joint. Input angles here.
# th = {'Rev2': 0, 'Rev3': 0, 'Rev4': 0, 'Rev5': 0, 'Rev6': math.pi/2}
# ret = chain.forward_kinematics(th)
#
# print(chain.get_joint_parameter_names())
# print(chain)
# print(ret)