lanius / tinyik

A tiny inverse kinematics solver
MIT License
120 stars 21 forks source link

Visualization results in a blank screen #15

Closed theunkn0wn1 closed 3 years ago

theunkn0wn1 commented 3 years ago

Using tinyik off of Git, commit e34d514e214818ab3f54cc8c7bb29bb144c3e54d

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)

image

theunkn0wn1 commented 3 years ago

It seems that the visualization doesn't work with very big parts relative to whatever coordinate system tinyik uses. If i scale the model down by 1E2 (expressing the measurements in meters) I do get a visible output.

What are the units of measure that tinyik uses?

lanius commented 3 years ago

@theunkn0wn1 The specification of tinyik's visualizer follows open3d. The cause of this issue was that the thickness of the links and joints were hard-coded so that they were too thin relative to the length of the actuators they were created for, and could not be displayed properly.

I modified it so that you can explicitly specify the thickness of the links when visualizing. I've released a new version 2.2.0, so please try using it.

tinyik.visualize(arm, radius=15.)