pid

Hello,

Impossible to operate the PID service someone would have an idea Here is the script I use

Myrobotlab Version 1.0.1758

test = Runtime.createAndStart("pid","Pid")
test.setMode("x",1)
test.setOutputRange("x",-5, 5)
test.setPID("x",10.0, 0, 1.0)
test.setControllerDirection("x",0)

This returns the following error:

------Traceback (most recent call last): File string, line 2, in module at org.myrobotlab.service.Pid$PidData.access$000(Pid.java:60) at org.myrobotlab.service.Pid.setMode(Pid.java:259) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)java.lang.NullPointerException: java.lang.NullPointerException at org.python.core.Py.JavaError(Py.java:546) at org.python.core.Py.JavaError(Py.java:537) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204) at org.python.core.PyObject.__call__(PyObject.java:496) at org.python.core.PyObject.__call__(PyObject.java:500) at org.python.core.PyMethod.__call__(PyMethod.java:156) at org.python.pycode._pyx24.f$0(string:5) at org.python.pycode._pyx24.call_function(string) at org.python.core.PyTableCode.call(PyTableCode.java:167) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1386) at org.python.core.Py.exec(Py.java:1430) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:267) at org.myrobotlab.service.Python$PIThread.run(Python.java:161)Caused by: java.lang.NullPointerException at org.myrobotlab.service.Pid$PidData.access$000(Pid.java:60) at org.myrobotlab.service.Pid.setMode(Pid.java:259) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186) ... 12 more------

Mats's picture

PID

Hi

This simply has to do with the order of the commands.

The first thing that needs to execute in the pid after starting the service is the setPID method. That will create the initial PID parameters.

test = Runtime.createAndStart("pid","Pid")
test.setPID("x",10.0, 0, 1.0)
test.setMode("x",1)
test.setOutputRange("x",-5, 5)
test.setControllerDirection("x",0)
 
/Mats
steveh110's picture

Hello, a big thank-you. It

Hello,
a big thank-you. It works like this

salut,
un grand merci. Ca fonctionne parfaitement comme ca