On 30 January 2011 13:15, Mark Wendt (Contractor)
<[email protected]> wrote:
> Tell me a little more about your custom
> component Andy.
Here it is, not a lot to it:
component oval "Add a spindle-position related offset to an axis for
oval turning";
pin in float encoder-pos "encoder position, should be scaled 0-1";
pin in bit disable "set high to disable, for example during homing";
pin in float pos-in "the input (axis position)";
pin in float offset "the required eccentricity";
pin out float pos-out "the modified position request";
pin in float fb-in "position feedback from joint";
pin out float fb-out "position feedback to motion";
function _ ;
license "GPL";
author "Andy Pugh";
;;
FUNCTION(_) {
static float profile[] =
{.0000, .0055, .0223, .0515, .0946, .1547, .0946, .0515, .0223,
.0055, .0000, .0055, .0223, .0515, .0946, .1547, .0946, .0515,
.0223, .0055, .0000, .0055, .0223, .0515, .0946, .1547, .0946,
.0515, .0223, .0055, .0000, .0055, .0223, .0515, .0946, .1547,
.0946, .0515, .0223, .0055, .0000, .0055, .0223, .0515, .0946,
.1547, .0946, .0515, .0223, .0055, .0000, .0055, .0223, .0515,
.0946, .1547, .0946, .0515, .0223, .0055, .0000,} ;
int i;
float f;
if (disable) {
pos_out = pos_in;
fb_out = fb_in;
return;
}
f = (encoder_pos - (int)(encoder_pos))*60.0;
i = f;
f = f-i;
pos_out = pos_in + offset*(profile[i] + f * (profile[i+1]-profile[i]));
fb_out = fb_in - (pos_out - pos_in);
}
--
atp
"Torque wrenches are for the obedience of fools and the guidance of wise men"
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users