Gmoccapy mit USB Kamera

More
30 Apr 2020 08:22 #166200 by bluephoenix
Hallo,
ich bräuchte Hilfe zum Einrichten einer Kamera.
Ich würde gerne meine USB-Kamera unter Gmoccapy installieren, was mir aber bist jetzt nicht gelungen ist.
Derzeit habe ich linuxcnc 2.8 unter Linux Mint 19.1 laufen. Allerdings hatte ich sie auch schon nicht unter 2.7 mit der offiziellen Debian Wheezy zum Arbeiten überreden können. Vor längerer Zeit, wo ich unter Axis unterwegs war ging es.
Die Kamera an sich funktionert und wird auch erkannt. Die Standard Tips zur Kameraeinbindung haben alle nicht funktioniert.

Was habe ich bis jetzt getan? In der ini Datei steht

EMBED_TAB_NAME = Kamera
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = gladevcp -x {XID} camview.glade

Installiert wurde
sudo apt-get install qv4l2

qv4l2 eingegeben und das Kamerabild erscheint.

sudo apt-get install python-opencv
sudo apt-get install v4l-utils
sudo apt-get install v4l2ucp

Aber der Tab bleibt leer.

Please Log in or Create an account to join the conversation.

More
30 Apr 2020 20:25 #166249 by bluephoenix
Replied by bluephoenix on topic Gmoccapy mit USB Kamera
So, es läuft zwar nicht, aber ich bin einen Schritt weiter:
ich habe nun die Dateien
hal_python.xml
hal_pythonplugin.py
camview.py
in das Verzeichnis
/usr/lib/python2.7/dist-packages/gladevcp
gespielt.
Dann kommt die Fehlermeldung
Found an error!
The following information may be useful in troubleshooting:

Traceback (most recent call last):
File "/usr/bin/gmoccapy", line 5175, in <module>
app = gmoccapy(sys.argv)
File "/usr/bin/gmoccapy", line 174, in __init__
self.builder.add_from_file(XMLNAME)
GError: Invalid object type `SpeedControl'

Please Log in or Create an account to join the conversation.

More
More
01 May 2020 07:48 #166284 by bluephoenix
Replied by bluephoenix on topic Gmoccapy mit USB Kamera
Hi,
you can't imagine how many hours I spent searching the web and trying out things. The link above does not bring me on further.
I will now use the mplayer solution, as it was a question in the thread below.
camview

We can close this here.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
01 May 2020 08:12 #166286 by tommylight
Replied by tommylight on topic Gmoccapy mit USB Kamera
Sorry but there is not much more info about it, as you are using Gmoccapy.
There is much more info on using camera with Axis screen, but i ma not sure that is very helpful.
MFG
Tom.

Please Log in or Create an account to join the conversation.

More
01 May 2020 08:15 #166288 by bluephoenix
Replied by bluephoenix on topic Gmoccapy mit USB Kamera
Hi Tom,
I appreciate your answer.
MFG :)
Albert
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
01 May 2020 13:38 - 01 May 2020 19:37 #166311 by strahlensauger
On Buster the mplayer doesn't work on my pc, leaving a grey tab, whereas on stretch it did. (with axis)

a

ls -l /dev | grep video

delivers
crw-rw---- 1 root video 29, 0 Mai 1 20:59 fb0
crw-rw---- 1 root video 243, 0 Mai 1 21:31 media0
crw-rw----+ 1 root video 81, 1 Mai 1 21:31 video1
crw-rw----+ 1 root video 81, 2 Mai 1 21:31 video2

in my .ini there are these lines
EMBED_TAB_NAME = Camera
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = mplayer -wid {XID} tv:// -vf rectangle=-1:2:-1:240,rectangle=2:-1:320:-1
and the error I get is

Playing tv://.
TV file format detected.
Selected driver: v4l2
name: Video 4 Linux 2 input
author: Martin Olschewski <This email address is being protected from spambots. You need JavaScript enabled to view it.>
comment: first try, more to come ;-)
v4l2: unable to open '/dev/video0': No such file or directory
v4l2: ioctl set mute failed: Bad file descriptor
v4l2: 0 frames successfully processed, 0 frames dropped.

So how can I make mplayer use /dev/video1?
Last edit: 01 May 2020 19:37 by strahlensauger.

Please Log in or Create an account to join the conversation.

More
15 Jan 2021 12:02 #195427 by mantimei
Replied by mantimei on topic Gmoccapy mit USB Kamera

So, es läuft zwar nicht, aber ich bin einen Schritt weiter:
ich habe nun die Dateien
hal_python.xml
hal_pythonplugin.py
camview.py
in das Verzeichnis
/usr/lib/python2.7/dist-packages/gladevcp
gespielt.
Dann kommt die Fehlermeldung
Found an error!
The following information may be useful in troubleshooting:

Traceback (most recent call last):
File "/usr/bin/gmoccapy", line 5175, in <module>
app = gmoccapy(sys.argv)
File "/usr/bin/gmoccapy", line 174, in __init__
self.builder.add_from_file(XMLNAME)
GError: Invalid object type `SpeedControl'


Den gleichen Fehler hatte ich unter LinuxCNC 2.8 auch.
Er entsteht durch das überschreiben der im System vorhandenen Datei "hal_pythonplugin.py" durch die Datei aus dem Package.
Lösung:
Die Datei "hal_pythonplugin.py" nicht in die angegeben Verzeichnisse kopieren, sondern die Originaldatei auf dem System im Editor mit sudo öffnen, und den Eintrag für Camview an der richtigen Stelle einsetzen und abspeichern (einfach mal beide Dateien nebeneinander öffnen und die Unterschiede ansehen, dass ist klar, was gemeint ist).

Gruß Markus

Please Log in or Create an account to join the conversation.

More
16 Jan 2021 17:01 #195551 by bluephoenix
Replied by bluephoenix on topic Gmoccapy mit USB Kamera
Hallo Markus,

das war die Rettung. Ich war nachdem ich nicht weiterkam mit dem mplayer unterwegs, was auch lief. Nur bin ich vor 2-3 Wochen auf 2.8.1 umgestiegen, unter Debian 10 und da lief der mplayer plötzlich nicht mehr.
Dank deines Tips, läuft aber jetzt camview wieder. Echt super, danke!
Ich hänge mal auf Deutsch und Englisch die Schritte an, die man machen muss, als Hilfe für andere.


Schritte um eine USB Kamera unter Gmoccapy zum Laufen zu bringen.
Getestet mit linuxcnc 2.8.1 unter Debian 10 Buster PREEMPT-RT

Zuerst muss Video for Linux installiert werden.
sudo apt-get install qv4l2
qv4l2 eingeben und schauen, ob die Kamera erkannt wird. (Livebild starten).
sudo apt-get install python-opencv
sudo apt-get install v4l2-utils
sudo apt-get install v4l2ucp

camview.glade gehört in das Config Verzeichnis (wo auch die maschine.ini ist)

Die Dateien
camview.py
hal_python.xml
habe ich nach /usr/lib/pymodules/python2.7/gladevcp gespielt

Entgegen anderer Anleitungen, darf die Datei hal_pythonplugin.py im Verzeichnis /usr/lib/pymodules/python2.7/gladevcp NICHT überschrieben werden!

Vielmehr muss sie als root mit z.B. sudo gedit hal_pythonplugin.py geöffnet werden und der Eintrag

from camview import CamView

eingefügt werden. Ich habe ihn nach der Zeile "from jogwheel..." eingefügt, so wie es auch in der Originaldatei ist.

from jogwheel import JogWheel
from camview import CamView
from speedcontrol import SpeedControl
from hal_dial import Hal_Dial


Dann noch die Einträge in der Maschine.ini machen, wobei Maschine hier synonym für den eigenen Namen der ini-Datei steht.

EMBED_TAB_NAME = Kamera
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = gladevcp -x {XID} camview.glade

Jetzt sollte die Geschichte laufen :), zumindest tat es das bei mir.


##################################################
Steps to get a USB camera running with Gmoccapy.
Has been tested with linuxcnc 2.8.1 and Debian 10 Buster PREEMT-RT

First install video for linux
sudo apt-get install qv4l2
start qv4l2 in the command window and check if the camera is recognized (start life picture). Then
sudo apt-get install python-opencv
sudo apt-get install v4l2-utils
sudo apt-get install v4l2ucp

copy camview.glade into your config directory (where your machine.ini is)

Copy the files
camview.py
hal_python.xml
to /usr/lib/pymodules/python2.7/gladevcp

Do NOT copy(overwrite) the file hal_pythonplugin.py to /usr/lib/pymodules/python2.7/gladevcp

Instead open the existing file /usr/lib/pymodules/python2.7/gladevcp/hal_pythonplugin.py as root and insert the following line

from camview import CamView

I inserted this line after "from jogwheel...", as it is the case in the file supplied by camview.

e.g.
from jogwheel import JogWheel
from camview import CamView
from speedcontrol import SpeedControl
from hal_dial import Hal_Dial


Then do the entries in your machine.ini

EMBED_TAB_NAME = Camera
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = gladevcp -x {XID} camview.glade

That's it! Things should be running now, at least they did on my machine.

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum