Converting object data with keyframing to gcode

Hello! I have a motion-control camera & miniature rig running on a cnc board and I need to create custom gcode utilizing the animation window and python. I found a bit of code online and it works near perfectly, except some axes are being written even though I haven’t moved them.

Here is the code:
import bpy
import os
import math

def radians_to_degrees(rad):
deg = rad * 180 / math.pi
return deg

#getting X, U, and V values for every frame
scn = bpy.context.scene
camObj = bpy.data.objects[‘Camera’]
miniatureObj = bpy.data.objects[‘Body’]

#xVal = camObj.location.x
#yVal = camObj.rotation_euler[1]
#zVal = camObj.rotation_euler[2]

#aVal = miniatureObj.rotation_euler[1]
#bVal = miniatureObj.rotation_euler[2]
#cVal = miniatureObj.rotation_euler[0]

data =

for f in range(scn.frame_start, scn.frame_end):
bpy.context.scene.frame_set(f)
data.append([camObj.location.x,math.degrees(camObj.rotation_euler[1]),math.degrees(camObj.rotation_euler[2]),math.degrees(miniatureObj.rotation_euler[1]),math.degrees(miniatureObj.rotation_euler[2]),math.degrees(miniatureObj.rotation_euler[0])])

print(data)

#TODO: offset all numbers so they’re oriented correctly

#-----------------
#converting each frame into a line of GCODE, and exporting to txt file
#-----------------

f = open(“animation.gcode”,“w”)

#add gcode header
header = “;Generated by Stephen Hawes’ Moco Blender Gcode Exporter\nG90 ; absolute positioning\nG92 X0 Y0 Z90 A0 B0 C0 ; setting current position to 0,0,0\nG1 F250 ; set travel speed\n”

f.write(header)

#add all the actual toolpaths
for i in range(0, len(data)): #for each frame of the animation stored to the data list
xVal = str(data[i][0]*1000)

yVal = 0
zVal = 0

aVal = 0
bVal = 0
cVal = 0

yVal = str(data[i][1]-90.00000250447816)
zVal = str(data[i][2])
    
aVal = str(data[i][1]-90.00000250447816)
bVal = str(data[i][2])
cVal = str(data[i][0])

line = "G0 X" + xVal + " Y" + yVal + " Z" + zVal + " A" + aVal + " B" + (bVal) + " C" + (cVal) + "\n"
f.write(line)

f.close()

So I created a scene where I purely move the x-axis on the camera, which is the xVal. When looking at the gcode, the x-values clearly change, but for some reason my cVal is also changing even though I haven’t moved and set any keyframes on it:

So it seems that regardless of what object I create, setting a variable equal to the x,y z location or rotation data is shared amongst every object for some reason. So my camObj’s x location is sharing the same data with my miniature Obj’s rotation x (which is labelled c), despite the fact they are two completely separate objects with their own unique axes. So clearly calling x y z for either location or rotation is not calling the local axes of that object, but the global axes. So I do I only select the local axes when I call a specific axis?

What am I doing wrong?