Mimic icon indicating copy to clipboard operation
Mimic copied to clipboard

when using option "Sample keyframes only", grab all frames with either IK or FK keyframes

Open aatb-ch opened this issue 2 years ago • 0 comments

option "Sample keyframes only" was looking for IK key frames set also with an FK keyframe on axis 1. This meant that:

  • user must set both IK and FK keyframes to have these exported
  • IK only or FK only animations could not be exported via this method

This PR updates the _get_frames_using_keyframes_only function so that it will look for any ik frames set on tool_CTRL, but also will look for any FK keyframes set on the timeline on any of the 6 joint handles FK_CTRL. I initially entirely removed the check for FK keyframes but then realized FK-only animations would not be possible, or mix of FK-IK animations would also export only half the path. It nows grab any IK/FK keyframes as lists, then merge and deduplicates the frames before returning it. I also noticed if you would manually keyframe FK handles individually it was only checking for FK keyframes on joint 1, which made any manual FK keyframe set by using s shortcut while rotating the handles was missed.

Here showing an animation with beginning as IK, switch to FK with individual joint keyframed, then back to IK, all exported as one ABB RAPID program.

Screenshot 2023-11-16 at 14 08 44 Screenshot 2023-11-16 at 14 08 55
MODULE MainModule
	! Main routine
	PROC main()
		ConfL\Off;
		SingArea\Wrist;
		! Go to start position
        MoveAbsJ [[0, 0, 0, 0, 0, 0], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, fine, tool0;
		! Go to programmed positions
		MoveAbsJ [[-42.177, 40.602, 14.054, 131.997, 64.615, -154.538], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[-42.177, 22.114, -18.425, 94.062, 42.308, -95.485], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[-18.480, -4.183, -69.576, 80.857, -57.086, -130.232], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[-13.850, -8.547, -74.557, 78.135, -59.949, -129.683], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[-4.061, -16.844, -79.048, 72.206, -58.476, -125.566], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[25.530, -30.479, -70.789, 52.172, -40.368, -95.543], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[49.227, -8.698, -43.732, 24.398, 1.495, -35.295], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[-2.569, 9.156, -30.350, 13.918, 20.697, -12.838], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[-4.894, 9.555, -30.080, 13.725, 21.076, -12.838], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		MoveAbsJ [[44.764, 25.663, -18.422, -97.243, 45.223, 100.228], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, z0, tool0\WObj:=wobj0;
		! Go to end position
		MoveAbsJ [[0, 0, 0, 0, 0, 0], [9E9, 9E9, 9E9, 9E9, 9E9, 9E9]], v100, fine, tool0;
		Stop;
	ENDPROC
ENDMODULE

aatb-ch avatar Nov 16 '23 13:11 aatb-ch