Hi There!
For my loss function, I need to calculate the forward kinematics of a robot’s end effector (the tip or hand of a robot) given joint angles returned by my network.
Basically: the network returns a vector describing the joint angle of each motor of the robot arm. I need to take those joint angles and calculate where the tip (end effector) of the robot is. The pose (position + rotation) of the end effector is then compared to a target pose in order to calculate a loss term.
for _, target_poses in dataset:
    joint_solutions = model(target_poses)
    poses_from_generated_solutions = forward_kinematics(joint_solutions)  # non-pytorch solver
    loss = fit_loss(poses_from_generated_solutions, target_poses)

The process of calculating the robots’ tip’s pose is called forward kinematics. I’m currently using a third party calculator that doesn’t use pytorch (Klampt: https://github.com/krishauser/Klampt 10).
The issue that i’m facing is that pytorch can’t calculate the gradient of the loss term w.r.t. the model parameters, because the computation chain is broken when the poses are calculated with the forwardkinematics calculator.
Questions:

Is there anyway to get around this problem and still use the same setup (external non-pytorch forward kinematics solver)?
If using a non-pytorch forward kinematics solver isn’t possible, are there any pytorch forward kinematics solvers that I can use? (I’ve looked and haven’t found any myself)
Any other feedback here?

I’ll write my own forward kinematics calulcator with pytorch if all else fails 
Thanks so much!

Jeremy