On 10/21/2011 09:02 AM, Kirk Wallace wrote:
> I tried the "Set Home" button first, which simply put encoder.0.reset
> and encoder.1.reset on a pyvcp button. What happened was one encoder
> would reset a significant time latter than the other. PID would either
> see the position or the command change and try to fix it. I added the
> amp (pwm actually) enable button to disable the motion while the resets
> settle, which works fine, except for the need for the manual button and
> PID would wind up in some cases. For switching the MPG to/from
> "Carousel", the problem is very similar, the command and position need
> to change and sync on entering and leaving "Carousel". I suppose it
> would be easier to just write a component that uses "if/case" to keep
> track of ATC status, but I thought I would try to build it with existing
> components first. I just don't have my brain around using components in
> an "if/case" fashion. Too many spinning plates for me:
> http://www.youtube.com/watch?v=Zhoos1oY404

For homing, could you give the PID position command a constant ramp (use 
the integ component?) until the "home" microswitch closes. At that 
point, save whatever the position is as a constant position offset 
(sample_hold component). Feed the sum of that and the desired tool 
offset to the PID position input, to get to the desired tool.

For the question you asked, instead of resetting the encoders to zero, 
maybe just save the difference between them. Below is the guts of a 
component I wrote to multiplex between two jogwheels. It stores the 
difference between the two jogwheels whenever it switches so there's no 
glitch. I'm not sure if this is what you need either, but maybe it'll help.

Karl


variable long diff;
variable short prev_select;
if(!select) {
        // Select the first jogwheel
        if(prev_select)
                diff += in2 - in1;
        out = in1 - diff;
} else {
        // Select the second jogwheel
        if(!prev_select)
                diff += in1 - in2;
        out = in2 - diff;
}
prev_select = select;

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to