KEJR Posted January 26, 2011 Share Posted January 26, 2011 Hello, This is probably a fundamental question, but I can't seem to find help on it anywhere. I've now got my motors in units of inches and I can Homez and then watch the position watch window and it matches the real world in those units. When I read the Motor[].ActPos register it appears to display the position since reset. Is there a way to zero this after I do my homing routine? I basically want to use this to read position in inches, or another similar method. I'm not doing any of the canned home routines, but a custom homing prog based on torque limit and hardstop. Obviously there is a way to do it since the position watch window is displaying position correctly after I do a homez command. Thanks, ~Ken Link to comment Share on other sites More sharing options...
curtwilson Posted January 26, 2011 Share Posted January 26, 2011 For all registers of this type, subtract out the value of Motor[x].HomePos, which contains the value of the motor zero position relative to the power-up/reset position. (In Power PMAC, we cannot block interrupts like we could in Turbo PMAC, so we cannot reliably reset all of these registers for a new reference position in the same servo cycle.) Curt Link to comment Share on other sites More sharing options...
bradp Posted January 26, 2011 Share Posted January 26, 2011 The postion in the position window is a combination of several registers. For what you explain above you just need to get Motor[].ActPos and Motor[].HomePos and I think do a subtraction. In some other cases you might need to consider Motor[].MasterPos and Motor[].CompPos. Link to comment Share on other sites More sharing options...
KEJR Posted January 26, 2011 Author Share Posted January 26, 2011 On my C code this is fine, I can write a funciton to subtract these two: GetActPosRelativeToHome() ... or something like that. for motion programs is there a way to query actual position, home referenced? I suppose I could write a script subroutine as well, but is there a better way? Thanks, KEJR Link to comment Share on other sites More sharing options...
bradp Posted January 26, 2011 Share Posted January 26, 2011 It is the same anywhere, you query ActPos and subtract HomePos from it. But please tell me what you are trying to do in the motion program and why you would need this. There might be a better way. Link to comment Share on other sites More sharing options...
Sina.Sattari Posted January 26, 2011 Share Posted January 26, 2011 KEJR, The Motor[x].ActPos is only a part of position shown in position window. You have to subtract Motor[x].HomePos from Motor[x].ActPos and multiply the result by Motor[x].PosSf to get the result in position window. Here is a diagram showing all the scale factors and offsets which are used for calculating the motor/axis position: [attachment=1427:name] Link to comment Share on other sites More sharing options...
KEJR Posted January 26, 2011 Author Share Posted January 26, 2011 We have done inspection tasks where we wanted to read a sensor and a position at the same time (although we didn't need hardware capture synch). So picture moving from A-B-C-D positions and then performing fast readings while in range of positions B-C. You could do some of the triggering and such with the blended moves, but we really do want to know the actual position when we take the reading of the sensor, so in this case I think we would need the home position subtraction trick. Since this is a rare case, using blended moves and such probably gets us 95% of the way there and using the home position subtraction for these other cases is not so bad. [quote='bradp' pid='1206' dateline='1296064450'] It is the same anywhere, you query ActPos and subtract HomePos from it. But please tell me what you are trying to do in the motion program and why you would need this. There might be a better way. [/quote] Link to comment Share on other sites More sharing options...
Guest DavisG Posted May 24, 2011 Share Posted May 24, 2011 I have one customer doing the same thing - we ended up writing zeroes into motor[x].Pos and motor[x].HomePos - that seemed to handle everything - #xp comes back as 0, and motor[x].ActPos = 0. Link to comment Share on other sites More sharing options...
KEJR Posted May 24, 2011 Author Share Posted May 24, 2011 [quote='DavisG' pid='1885' dateline='1306251265'] I have one customer doing the same thing - we ended up writing zeroes into motor[x].Pos and motor[x].HomePos - that seemed to handle everything - #xp comes back as 0, and motor[x].ActPos = 0. [/quote] Can you zero these out with the motor enabled? I like this approach because you can then treat ActPos are a referenced value. KEJR Link to comment Share on other sites More sharing options...
Guest DavisG Posted May 24, 2011 Share Posted May 24, 2011 [quote='KEJR' pid='1887' dateline='1306252183'] Can you zero these out with the motor enabled? I like this approach because you can then treat ActPos are a referenced value. [/quote] Like on the Turbo, I recommend killing the motor before zeroing the position. We didn't even try it enabled, so I'm not sure what the result would be. Link to comment Share on other sites More sharing options...
Recommended Posts