Aqueti / mantis_examples

Example software to demonstrate functionality of the Aqueti MantisAPI
https://aqueti.tv/api
MIT License
5 stars 2 forks source link

V2 receive no data #1

Closed anl13 closed 7 years ago

anl13 commented 7 years ago

My environment is Ubuntu16.04. Before I run V2, I use

ubuntu@ubuntu-Mantis2-Render:~/mantis_cam2$ ./start.sh

to start cameras, and it succeed. And I use V1 to view the stitched image, it works well.

But when I run V2, I find that the server receives no data. The whole output is shown below:

ubuntu@ubuntu-Mantis2-Render:~/mantis_cam2$ ./V2 -c sync.cfg -m model.json --dirs 1 data_2 
===============================================
    Welcome to V2, the Aqueti Visual Cortex
===============================================
Using host file: sync.cfg
Using model file: model.json
using 1 storage directories: 
    data_2
Command server listening on port 9999
using data_2/camera_1181053543
Command server listening on port 10000
Command server listening on port 10001
Command server listening on port 10002
Command server listening on port 10003
No clip file found
Command server listening on port 10004
Command server listening on port 10005
Command server listening on port 10006
Command server listening on port 10007
Command server listening on port 10008
Command server listening on port 10009
Command server listening on port 10010
Command server listening on port 10011

Microcamera metrics:
    Currently receiving data: false
    mcam 1031700042:    received: 0    added: 0
    mcam 1031700043:    received: 0    added: 0
    mcam 1031700044:    received: 0    added: 0
    mcam 1031700045:    received: 0    added: 0
    mcam 1031700046:    received: 0    added: 0
    mcam 1031700047:    received: 0    added: 0
    mcam 1031700048:    received: 0    added: 0
    mcam 1031700049:    received: 0    added: 0
    mcam 1031700050:    received: 0    added: 0
    mcam 1031700051:    received: 0    added: 0
    mcam 1031700052:    received: 0    added: 0
    mcam 1031700053:    received: 0    added: 0
    mcam 1031700054:    received: 0    added: 0
    mcam 1031700055:    received: 0    added: 0

Command server listening on port 10012
Command server listening on port 10013
Command server listening on port 10014

Microcamera metrics:
    Currently receiving data: false
    mcam 0:     received: 0    added: 0
    mcam 1031700042:    received: 0    added: 0
    mcam 1031700043:    received: 0    added: 0
    mcam 1031700044:    received: 0    added: 0
    mcam 1031700045:    received: 0    added: 0
    mcam 1031700046:    received: 0    added: 0
    mcam 1031700047:    received: 0    added: 0
    mcam 1031700048:    received: 0    added: 0
    mcam 1031700049:    received: 0    added: 0
    mcam 1031700050:    received: 0    added: 0
    mcam 1031700051:    received: 0    added: 0
    mcam 1031700052:    received: 0    added: 0
    mcam 1031700053:    received: 0    added: 0
    mcam 1031700054:    received: 0    added: 0
    mcam 1031700055:    received: 0    added: 0
    mcam 1031700056:    received: 0    added: 0
    mcam 1031700057:    received: 0    added: 0
    mcam 1031700058:    received: 0    added: 0
    mcam 1031700059:    received: 0    added: 0
    mcam 1031700060:    received: 0    added: 0

What does these output indicate? And why it says 'No clip file found'? Is it common to get 'Currently receiving data: false'?

And after that, I run a simple example python script, shown below:

ubuntu@ubuntu-Mantis2-Render:/usr/python/mantis$ python ConnectToCamera.py 
Traceback (most recent call last):
  File "ConnectToCamera.py", line 1, in <module>
    import MantisPyAPI as api
  File "/usr/python/mantis/MantisPyAPI.py", line 28, in <module>
    _MantisPyAPI = swig_import_helper()
  File "/usr/python/mantis/MantisPyAPI.py", line 24, in swig_import_helper
    _mod = imp.load_module('_MantisPyAPI', fp, pathname, description)
ImportError: dynamic module does not define init function (init_MantisPyAPI)

ConnectToCamera.py is an example file under directory mantis where MantisPyAPI.py exists. So why importError occurs?

camerongivler commented 7 years ago

These are two separate issues. The first issue with V2 is that you are not currently receiving data. There is an API command to start and stop receiving called toggleReceivingData. Check it out in the example code at http://aqueti.tv/api/#get-frames.

The second issue means the API was not installed correctly. Try uninstalling the mantis api debian package with sudo dpkg -r mantisapi then reinstalling with sudo dpkg -i mantisapi-0.1.0.1_dev.deb when you're in the directory that contains the .deb package. This should install _MantisPyAPI.so and MantisPyAPI.py in /usr/lib/python3/dist-packages/mantis.

anl13 commented 7 years ago

Thanks. I solved the second issue.

For the first issue, if I want to use toggleReceivingData, I need to get a cameraList to determine at least one camera for toggleReceivingData. But after I use api.setNewCameraCallback(newCameraCallback) just as the sample code do, the cameraList is still empty. According to http://aqueti.tv/api/#get-frames, when I use setNewCameraCallback, it

calls the callback function for each Mantis camera that has already been discovered at the time of setting the callback.

I have defined newCameraCallback as the sample code do. And V2 is running. So what's wrong with what I have done? And how to solve this problem?

camerongivler commented 7 years ago

It sounds like you're doing things right. Are you sure you're connecting to the correct IP and port on V2? The port is configurable as a command line parameter. I believe it defaults to 11000. Run ./V2 -h to see the options.