Hi everybody,I have a little question about function's. First, I will explain quickly what I want to do .So Im doing a kind of Industrial robot with PF XL Motor's + Glidewheel from Mindsensors.com and the regulation is not like I want. So I have done my own PID function and desactivated the orignial PID (open loop). This function return the power of the motor in float.

Until here, everything works fine. The problem starts when I use this function inside another function, it returns this : -1.#Q0I cannot find information about this error...

First of all, your Inte variable is constantly reinitialised, instead of maintaining its value, which is kind of the point of the I part in a PID regulator. If you make it either global or a "static" type in your function, it will not lose its value each time the function is called.Second, your ErrDiff value is assigned to OldDiff, but it wasn't assigned a value prior to that, so there's nothing to assign. Do the same thing with OldDiff as you should do with the Inte variable, make it a static variable.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum