for frame in frames: artist = FrameArtist(frame, scale=0.3, layer="Frames::{}".format(frame.name)) artist.clear_layer() artist.draw() for a, b in pairwise(frames): line = Line(a.point, b.point) artist = LineArtist(line, layer="Links::{}".format(a.name)) artist.draw() tpl = Cylinder(Circle(Plane(Point(0, 0, 0), Vector(0, 0, 1)), 0.05), 0.2) for frame, axis in zip(frames, axes): point = frame.point normal = Vector(axis.x, axis.y, axis.z) plane = Plane(point, normal) frame = Frame.from_plane(plane) X = Transformation.from_frame(frame) cylinder = tpl.transformed(X) artist = CylinderArtist(cylinder, layer="Axes::{}".format(axis.name)) artist.clear_layer() artist.draw() artist = RobotModelArtist(robot, layer="Robot") artist.clear_layer() artist.update(state, collision=False) artist.draw() compas_rhino.wait()
from compas.robots import LocalPackageMeshLoader from compas.robots import RobotModel from compas_rhino.artists import FrameArtist from compas_rhino.artists import RobotModelArtist loader = LocalPackageMeshLoader('models', 'ur_description') model = RobotModel.from_urdf_file(loader.load_urdf('ur5.urdf')) model.load_geometry(loader) joints = dict(shoulder_pan_joint=0, shoulder_lift_joint=0, elbow_joint=0, wrist_1_joint=0, wrist_2_joint=0, wrist_3_joint=0) frame = model.forward_kinematics(joints) artist = FrameArtist(frame, layer='COMPAS::Robot Viz') artist.clear_layer() artist.draw() artist = RobotModelArtist(model, layer='COMPAS::Robot Viz') artist.update(joints) artist.draw_visual()