How about the following function? You would just need to get your ascii data to match the XYZ/RXRYRZ.
import bpy
import bpy.types
import time
from mathutils import *
# positions and rotates an object (globally) and create a keyframe
# at the given frame#
# Change the rotation mode to your liking.
def animate_object( obj, x, y, z, rx, ry, rz, frame_number ):
obj.location = Vector((x,y,z))
obj.rotation_mode = 'XYZ'
obj.rotation_euler = Euler((rx,ry,rz))
obj.keyframe_insert(data_path="location", frame=frame_number)
obj.keyframe_insert(data_path="rotation_euler", frame=frame_number)
ex:
cam_positions = (
( 1.56,3.13,-1.83, -4.20,-2.58,-3.48 ),
( 1.74,3.19,-1.63, -4.40,-1.95,-3.67 ),
#...
( 2.01,3.03,-1.57, -4.32,-1.61,-3.64 )
)
cam = bpy.data.objects["Camera"]
frame_number = 1
for frame_number, cp in enumerate(cam_positions):
animate_object(cam, *cp, frame_number + 1)