Jon Elson wrote: > A customer and EMC user in Brazil has asked about something I > have thought about a couple times. What he wants is a lathe > with a C axis for programmable positioning. So, sometimes he > wants to spin the spindle at some speed for normal lathe work, > and sometimes he wants to position the axis. > > As far as commands, one could envision that the axis is a speed > spindle when an M03 or M04 command is given, and when M05 is > given it turns into a C axis, and will turn to the position > specified in a C word. > > Now, I think I actually know how to do this in HAL right now, > but I'd have to go through E-stop to make the switch-over > without causing a following error or servo amp trip. Obviously, > the user would want to have this all done smoothly without > having to go into E-stop. > > When in spindle mode, you'd want to prevent the PID calculations > from seeing the C axis position changing. That could be done by > switching where the encoder info is routed through hal pretty > easily. It might be possible to give a long delay after > shutting the spindle off, and having some hal components > gradually ramping up the servo gain so that the spindle will be > smoothly brought to the last commanded C position. You probably > need to throw in a spindle sync operation so that the spindle > won't be made to unwind 10,000 revolutions to get the count back > to zero. > > Any thoughts on this? I could see using some of my servo amps > to drive small spindle motors for both spindle and positioning > modes. >
Its late and I'm a bit under the weather, so I'm not going to go digging for it, but if you look in the configs/demo_mazak directory you'll find the HAL files for the Mazak at the CNC workshop. The spindle orient function for toolchanging does pretty much exactly what you are talking about. In that case the spindle drive is an external DC drive with a 0-10V command. The HAL logic switches from a open-loop speed command to the drive, to a PID position loop using spindle encoder feedback. In that case, the position command is a constant, the proper orientation for the toolchange, but it could easily be a variable. There is a little extra complexity in there because the HAL code also does gear shifting. It corrects the open loop speed command based on whether the machine is in high or low gear, and sequences the shift from one to the other. (Slows down to 15 rpm or so, shifts to neutral, then to the new gear, then ramps back up to the target speed. Quite neat to watch. Take a look, if you need any help filtering out the gearchange stuff from the spindle orient stuff, just ask. Regards, John Kasunich ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers