Zeroing With Camera - Some Success, Some Difficulty

Discussion of linuxCNC (formerly knows as EMC2)
Post Reply
fasteddy
Posts: 67
Joined: Sun Mar 24, 2013 10:27 pm

Zeroing With Camera - Some Success, Some Difficulty

Post by fasteddy » Mon Sep 21, 2015 2:43 pm

I recently reengineered my "Shapeoko 1 + acme upgrade"-style Z axis to something more similar to the Shapeoko 2 (to allow for greater Z travel). While I was at it, I added a usb camera following the guide here. A couple of notes if you're planning on following the same guide (also on the inventables site and buried somewhere on this forum, I believe).

Under step 2, you're told to create a .NGC file. However, it doesn't specify where to save it or what to name it. You'll need to save it as

Code: Select all

~/linuxcnc/nc_files/101.ngc
Step 5 says to add the following line to your custom_postgui.hal: net remote-o101 halui.mdi-command-01 <= pyvcp.o101

However, assuming you've followed this guide and have defined no other custom MDI commands, this line should actually be:

Code: Select all

net remote-o101 halui.mdi-command-00 <= pyvcp.o101
This is because Linux-based software almost always starts counting at 0 instead of 1, so if you only have one defined MDI command, it's number 0.

Anyway, after those hiccups I managed to get the camera working with crosshairs and custom button for offsetting. However, I still have one issue. After about a minute or so, I lose the camera feed and get a green screen. The only way to fix is a reboot. Fortunately, a minute is generally long enough to home the machine and find my offset (assuming I'm organized), but it's obviously not ideal.

Has anyone else run into this? In other forums mentioning the line [EMBED_TAB_COMMAND = mplayer -wid {XID} tv://0 -vf rectangle=-1:2:-1:240,rectangle=2:-1:320:-1] as the easiest way to draw a crosshair, I've seen mention that it works well with hardware accelerated video, which I don't have set up. Could that be the problem? My system is an older AMD chip with onboard video, so hardware acceleration seems like a stretch.

Georgei
Posts: 148
Joined: Mon Dec 22, 2014 11:22 pm
Location: UK

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by Georgei » Mon Sep 21, 2015 3:45 pm

There is a ready to run program by kd-dietz called edge finder:

http://www.kd-dietz.com/klausphp/pages/ ... ption.html

It has everything you need.

fasteddy
Posts: 67
Joined: Sun Mar 24, 2013 10:27 pm

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by fasteddy » Mon Sep 21, 2015 4:02 pm

Georgei wrote:There is a ready to run program by kd-dietz called edge finder:

http://www.kd-dietz.com/klausphp/pages/ ... ption.html

It has everything you need.
Hmmm, I'm at work, so I can't really test out this program, but I'm somewhat skeptical. A glance at the download shows me that it's an .exe file, which means it's not Linux-friendly. Secondly, even if it did work in Linux (assuming I were inclined to set up Wine, for example), having a second program running doesn't really help much. I mean, I guess I could have it open as a second window in the background and minimize linuxcnc so that the 2 windows are visible (can't jog from Linuxcnc if it's not in foreground), but that hardly seems an ideal solution - the reason I found this such an interesting option was exactly because of its integration into linuxcnc. I'm also a little concerned about running additional programs and possibly introducing delays/jitters to the realtime processing.

This is not to unfairly criticize your suggestion, as I do appreciate any help, I'm just not sure it's workable.

Georgei
Posts: 148
Joined: Mon Dec 22, 2014 11:22 pm
Location: UK

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by Georgei » Mon Sep 21, 2015 6:28 pm

Also: LinuxCMC has its own camera addon. Look below:

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Adding_Camview

fasteddy
Posts: 67
Joined: Sun Mar 24, 2013 10:27 pm

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by fasteddy » Mon Sep 21, 2015 7:13 pm

Georgei wrote:Also: LinuxCMC has its own camera addon. Look below:

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Adding_Camview
Indeed, this is what I'm using. I set it up using the guide that I referenced above, but am left with the problem that the camview module seems to crash on me.

[edit: Actually, I see what you mean. I'm using mplayer rather than camview. I'll explore that tonight.]

CalebPeters
Posts: 109
Joined: Sun Nov 10, 2013 12:20 am
Contact:

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by CalebPeters » Tue Sep 22, 2015 3:06 am

Whoops, I'll fix those steps soon. Thanks for pointing them out.

I've never had the feed go to a green screen, so I don't know what's happening there.

Sorry I'm not more help, :(
Caleb
Shapeoko 2 #3164 : GRBL, NEMA 23 motors, 350W Spindle, Limit/home switches, Drag chain, X-Carve Upgrade.
DIY-Oko 3 #-1 : LinuxCNC, PC-450 with Super-Pid, Hall Effect Limit/home switches.

fasteddy
Posts: 67
Joined: Sun Mar 24, 2013 10:27 pm

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by fasteddy » Mon Apr 11, 2016 8:15 pm

This thread is pretty old, so it probably doesn't matter, but the issue turned out to be hardware-related. Specifically, the computer that I was using to run linuxcnc was on its last legs. USB and networking hardware was shot. Replaced the system with another, and now everything works perfectly.

CalebPeters
Posts: 109
Joined: Sun Nov 10, 2013 12:20 am
Contact:

Re: Zeroing With Camera - Some Success, Some Difficulty

Post by CalebPeters » Tue Apr 12, 2016 9:54 pm

fasteddy wrote:This thread is pretty old, so it probably doesn't matter, but the issue turned out to be hardware-related. Specifically, the computer that I was using to run linuxcnc was on its last legs. USB and networking hardware was shot. Replaced the system with another, and now everything works perfectly.
Glad to hear that! And, good on you for reporting how you solved the problem.
Shapeoko 2 #3164 : GRBL, NEMA 23 motors, 350W Spindle, Limit/home switches, Drag chain, X-Carve Upgrade.
DIY-Oko 3 #-1 : LinuxCNC, PC-450 with Super-Pid, Hall Effect Limit/home switches.

Post Reply