From the G-Code, create the lines in Mat-lab
Then, for each point, write a routine in Mat-lab that looks for the shortest distance between the point and the set of splines created from the G-code. This will be the maximum linear deviation from the path, with one value per point reported from the co-ordinate system.
To get fancier than this, you'd have to constrain your code (like you suggest with straight lines) so that it can be simulated vs time to do a time based comparison, but this will get messy fast (especially if propogation delays aren't constant).
I'm sure that you can find the acceleration profiles of your CNC machine/controller combo so you could even get your path simulator to take that into account when generating an estimated time path for the tool.
I'm not a CNC expert, but I am a PhD in Applied Physics.... Really, without more stuff you're somewhat constrained to do some sort of dynamic error estimate unless you intercept things like motor feeds and the like.
Also, what is your goal? Test positioning accuracy or some error that compounds over time? The output of the position system only measures where the machine thinks it is, not where it really may be. To really do this stuff well you'd want to use some sort of interferometer based system to get a very accurate absolute position information independent of the machine. It's possible that the machine position measurement system could be a error source as well (as tool diflection and the like would be if it were really cutting).
How accurate do you want to get? If it's really a high accuracy machining cell, this will be very hard to do well. The ruler has to have absolute accuracy and precision that is an order of magnatude better than the error that you're trying to measure, and this gets hard and expensive very fast.
Matt |