Ask Your Question

Problem with VisualStates trying to use Color Filter

asked 2018-01-22 06:49:59 -0600

jsaizc gravatar image

Hi everyone,

I'm trying to use the new jderobot component, Visual States, that works perfectly on my computer. I tried all the examples successfully, but when I enter my code, which works out of visual states, everything goes fine until it reaches the part of the color flter to make the visual landing, I have entered in the canfiguracion of Visual States (.xml) the module of the ArDrone camera but it still does not work for me. I do not know if it is because the camera does not recognize it correctly or if I am not getting it right the module. If someone has any ideas or has done some color filter from the drone camera, it would be very helpful. Thank you very much.

The error: jsaizc@jsaizc:~/jderobotGIT/src/examples/visualStates/jderobotcomm/ice/ArDrone$ python2 ./ prueba1.yml --displaygui=true loading Config file ./prueba1.yml Receiving prueba1.myCamera Image from ICE interfaces myCamera is connected Publishing prueba1.myCMDVel with ICE interfaces myCMDVel is connected Receiving prueba1.myPose3d from ICE interfaces myPose3d is connected Publishing prueba1.myDroneExtra with ICE interfaces myDroneExtra is connected runtime gui enabled ('Baliza', 1) ('Baliza', 2) ('Baliza', 3) ('Baliza', 4) ('Baliza', 5) ('Baliza', 6) Trayectoria Aterrizaje Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python2.7/", line 801, in bootstrapinner File "/usr/lib/python2.7/", line 754, in run*self.args, **self.kwargs) File "/home/jsaizc/jderobotGIT/src/examples/visualStates/jderobotcomm/ice/ArDrone/codegen/python/", line 101, in run self.currentState.runCode() File "./", line 47, in runCode hsv = cv2.cvtColor(inputimage, cv2.COLOR_BGR2HSV) TypeError: src is not a numpy array, neither a scalar

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2018-01-22 17:23:12 -0600

jmplaza gravatar image

Hi @jsaizc,

maybe you can start debugging with a check that the image is properly accessible from the code of that state. Perhaps writing in console the RGB values of the central pixel of the image. From the trace:

Receiving prueba1.myCamera Image from ICE interfaces myCamera is connected

it seems that that is working fine.

Could you put a dummy simpler example with VisualStates and a camera somewhere on your github repository so we can take a look at it? The whole component is very complex to track, try to replicate the problem in a simpler automata....

edit flag offensive delete link more

answered 2018-01-23 13:55:10 -0600

jsaizc gravatar image

Hi @jmplaza,

The error may be due to the fact that the libraries have not been imported well (in this case cv2), there is no example made with library dependencies so I do not know if it can be done. When it generates the .py file, it seems that it is good so I do not know what other error may be due.

I have put in my Git another example of Visual States, prueba_cam.xml, more simple, in order to locate the problem.

edit flag offensive delete link more

answered 2018-01-24 08:05:47 -0600

okanasik gravatar image

updated 2018-01-24 08:49:00 -0600

Dear all,

I have checked the problem. The error you have taken is due to the type returned by the getImage() method. It is defined here: Therefore, you can solve the problem by replacing input_image with

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-01-22 06:49:59 -0600

Seen: 41 times

Last updated: Jan 24 '18