# Convert 5-axis CNC motion to robotic arm motion

I have G-code generated for a 5 axis CNC machine, with a rotating and tilting table. I would like to run this code on my robotic arm and therefore thought about converting it to a rotating and tilting head movement. For better understanding, I will attach an image. This should be possible (right?), but I do not get the mathematics behind it. My aim is then to write a small script to convert the G-code.

Setup of desired G-code (left), setup of provided G-code (right):

Provided G-code example:

G1 X0.08 Y-19.33 Z88.81 B-9.96 C-13.14
G1 X0.26 Y-19.25 Z88.83 B-9.90 C-11.68
G1 X0.45 Y-19.19 Z88.85 B-9.84 C-10.22
G1 X0.63 Y-19.14 Z88.86 B-9.79 C-8.77
G1 X0.81 Y-19.10 Z88.88 B-9.73 C-7.31
G1 X0.91 Y-19.06 Z88.89 B-9.72 C-6.02

• I agree it's definitely possible, but probably not simple. IKFast is a tool for automatically calculating inverse kinematics. That might work if you don't want to do the math manually. If you want to try the math manually, I'd start by writing out the coordinate frames of each joint. Denavit–Hartenberg parameters are a standard way to do that. Jan 20 at 21:32
• Please clarify what your question is. We prefer practical, answerable questions based on actual problems that you face. Take a look at How to Ask and tour for more information on how stack exchange works, and the Robotics question checklist for details of how to write a good question. yesterday