Adding Auxiliary Position Feedback Using Servo Serial

21 Apr 2022 04:24 #240779 by drose
I'm configuring a SCARA-type CNC arm using Linux-CNC on a pi-4 and using some Allen Bradley Ultra3000 servo drives to control each axis. While the arm is working great when running normal jog operations, I'd like to add a feature such that when the drives are disabled the joint position is updated in Linux-CNC. The idea here is for a user to be able to position each joint by hand (After homing and disabling the drives), then re-enable each drive and maintain an accurate position in Linux-CNC.

Currently I have each drive configured as a simple follower which takes the step-gen input from Linux-CNC which has been working adequately. This means the drives are essentially running "open-loop" in regards to Linux-CNC and are entirely responsible for keeping track of the motor positions, which works fine so long as each joint remains enabled. 

When the drives are disabled (motors turn freely but the drives are still on and counting encoder pulses) I am planning on communicating with the drives over serial to get the encoder position from the drives directly as opposed to trying to count pulses with the Pi. This communication has been working pretty well using the Pi UART port (with an RS485 phy) but it's fairly slow and would not be suitable to maintain position feedback while actively moving the joints.

My question here is what HAL component should I inject this position feedback into to get this kind of behavior while the drives are disabled to update the joint position in Linux-CNC at a relatively slow rate (10-100hz or slower)?

Currently my thoughts have been to use the motor-pos-fb HAL pin for each joint and inject the position queried from the drives while the motors are disabled, and then switch it back to the step-gen feedback while the motors are enabled. This way the motor-pos-fb pin gets the fast feedback needed for smooth machine operation but still gets updated while the machine is not being driven.

Is this a reasonable approach or am I missing something here? Is there a simpler approach to this?

File Attachment:


Please Log in or Create an account to join the conversation.

21 Apr 2022 16:30 #240802 by andypugh
Have you tried this? Generally if you turn off LinuxCNC then you can move things freely, and LinuxCNC will update the positions on-screen according to the encoder. Then when you re-enable LinuxCNC it will hold those positions (as feedback is copied in to command on re-enable)

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum