<filename>examples/216_inverse_kinematics_artist.py
import os

from compas_fab.backends.kinematics.solvers import UR5Kinematics

from compas.artists import Artist
from compas.geometry import Frame
from compas.robots import LocalPackageMeshLoader
from compas.robots import RobotModel

models_path = os.path.join(os.path.dirname(__file__), 'models')
loader = LocalPackageMeshLoader(models_path, 'ur_description')
model = RobotModel.from_urdf_file(loader.load_urdf('ur5.urdf'))
model.load_geometry(loader)

f = Frame((0.417, 0.191, -0.005), (-0.000, 1.000, 0.000), (1.000, 0.000, 0.00))

solutions = UR5Kinematics().inverse(f)

artist = Artist(model, layer='IK')

for jv in solutions:
    config = model.zero_configuration()
    config.joint_values = jv
    artist.update(config)
    artist.draw_visual()
    artist.redraw(1)
    artist.clear_layer()

<filename>examples/216_inverse_kinematics_artist.py
import os

from compas_fab.backends.kinematics.solvers import UR5Kinematics

from compas.artists import Artist
from compas.geometry import Frame
from compas.robots import LocalPackageMeshLoader
from compas.robots import RobotModel

models_path = os.path.join(os.path.dirname(__file__), 'models')
loader = LocalPackageMeshLoader(models_path, 'ur_description')
model = RobotModel.from_urdf_file(loader.load_urdf('ur5.urdf'))
model.load_geometry(loader)

f = Frame((0.417, 0.191, -0.005), (-0.000, 1.000, 0.000), (1.000, 0.000, 0.00))

solutions = UR5Kinematics().inverse(f)

artist = Artist(model, layer='IK')

for jv in solutions:
    config = model.zero_configuration()
    config.joint_values = jv
    artist.update(config)
    artist.draw_visual()
    artist.redraw(1)
    artist.clear_layer()
