Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

could you confirm that it is not possible to select video mode over the serial link

0 votes
I am helping someone with an entry to PI Wars. They have a PI zero and I thought my JeVois camera would be

ideal for the autonomous tasks as they are using a PI zero for the robot.

I have got a python script woking for the Hubble challenge which is basically to detect Red Green Blue Yellow shields in a specified order. The Object Tracker example is perfect for this, I just change the thresholds for each colour.

Video Selection at the moment is via jevois inventor.

There are other examples on the camera which are perfect for the other challenges.

What I wanted to do was run a "Hubble" script which uses the serial link to select the Object Tracker, sets thresholds etc and then as per the arduino pan/tilt tutorial uses the output from the camera to control the robot.

Then for the straight line challenge run a "Line" script which selects the Road Navigation script and again use the camera output to control the robot.

That way we do not have to connect to the camera over the USB between challenges.

If I understand this answer correctly we will have to edit initscript.cfg between challenges?

thanks

Steve
asked Jan 12, 2019 in User questions by windy54 (230 points)

1 Answer

+1 vote

There are two ways of selecting a vision module:

- either pick a resolution on a video capture software when running with USB video output

- or send a setmapping2 command when running headless (no host computer grabbing video from jevois)

If your machine vision module supports headless operation with not video out, then you can switch between modules on the fly, you just send the following commands (e.g., so select the ArUco module):

streamoff

setmapping2 YUYV 320 240 30.0 JeVois DemoArUco

streamon

Those commands can be issued at any time, not only in initscript.cfg. To see if a module supports headless operation, please see its doc page, either in the inventor or online. It is indicated near the author name, etc towards top.

In JeVois Inventor 0.5.0 we added a Preferences menu that allows to start the inventor in headless mode. You should proceed as follows:

- check the headless checkbox in preferences

- close the inventor

- disconnect and reconnect jevois

- start the inventor

If you had a setmapping2 in initscript.cfg, that module will be running headless. If you want to switch to another module, send the above commands in the console.

answered Jan 14, 2019 by JeVois (46,580 points)
Thanks for the answer, if I understand correctly video mode can only be change   via the USB interface and NOT the serial interface.
oh, the setmapping2 and streamon commands can be issued by an Arduino over the 4-pin hardware serial port, it will work the same. Just be careful about your boot sequence, likely, at power on, the Arduino will be up a few seconds before JeVois is fully booted up and operational.

Maybe we need to clarify the vocabulary a bit at this point though:
the commands I suggested will load and run a machine vision module to run headless, so there is not video out, just serial messages that describe what JeVois has detected. So to your exact question about "changing video mode" yes, video streaming is under the control of video capture software that connects to USB. But which module runs headless (no video output) can be controlled via the serial ports (serial-over-USB or 4-pin hardware serial).

Maybe check out this one which defines some useful vocabulary:

http://jevois.org/doc/Concepts.html

have a look at the differences for operation with vs without video output.
so I have edited videoparams.cfg to select the object tracker as default at 60fps.
Powered up the camera and connected using a terminal window and typed info, got some response and then streamoff, got the following output:

INFO: JeVois 1.11.0
INFO: Linux version 3.4.39
INFO: CPU: 1344MHz, 18C, load: 1.01 1.15 0.75 1/59 2772
INFO: MemTotal: 238428 kB, MemFree: 154128 kB
INFO: OUT: YUYV 320x254 @ 60fps CAM: YUYV 320x240 @ 60fps MOD: JeVois:ObjectTracker C++
OK
ERR Unsupported command [streamoff]
ERR Unsupported command [set streamoff]
ERR Unsupported command [streamoff]
ERR Unsupported command [streamon]

what am I doing wrong?
It has proved that the videoparams.cfg edit worked.

Steve
sorted, as you suggested I put the commands in initscript.cfg to select the video mode, setup serial and streamon.
Then in my script I just have to send a streamoff, setmapping2, followed by streamon.
I also need to setpar serlog None for it to work.
Now I can change between video modes from my PI
...