CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2)


LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 11-13-2009, 12:40 AM
 
Join Date: Nov 2006
Location: edmonton
Posts: 104
fahque99 is on a distinguished road
webcam edge finder?

Anyone know of any software for EMC that can use a webcam as a edge finder? I have seen it with mach3 but havent found anything for EMC yet.
Reply With Quote

  #2   Ban this user!
Old 06-18-2010, 09:02 PM
 
Join Date: Jun 2010
Location: U.S.A.
Posts: 2
Mechstew is on a distinguished road
Talking Webcam center finder for emc2 Ubuntu Hardy Heron

Hi, this is Mechstew! I love the EMC2 interface, and am new to milling,
and cnc control. I saw an article referring to a webcam center finder and figured it was worth a try. "After" making it, I could find no program to utilize it with EMC2 2.3.5, all of the blogs and posts i could find were also fruitless.
Having spent forty bucks on this round thing that I just finished butchering, Wal-Mart would not take it back now! I spent 2 weeks for trial and error to finally have a working 960 X 720 (pixel) window with a crosshair. I am neither a programmer nor a computer guru, I just want to make little pieces out for big pieces and this helps me to do it reliably. If you or anyone else is interested let me know and I will try to relay that information through this portal.
I am using a Logitek c300 with Ubuntu Hardy Heron, and lauch a .py file outside of EMC2 2.3.5.

P.S. I do not check my web accounts often (once/week), now its time for me to build!
Reply With Quote

  #3   Ban this user!
Old 06-19-2010, 10:18 AM
 
Join Date: Sep 2004
Location: USA
Posts: 147
Dan Falck is on a distinguished road

Hi Mechstew,
I am interested in what you did with the python program.

Thanks,
Dan
Reply With Quote

  #4   Ban this user!
Old 06-20-2010, 04:39 PM
 
Join Date: Mar 2008
Location: uk
Posts: 18
Alexthehun is on a distinguished road

Hi Mechstew,

I have been down the same path: got working webcam but no software to make use of it!
It would be great if you could share your solution!

regards
Alex
Reply With Quote

  #5   Ban this user!
Old 06-20-2010, 05:46 PM
 
Join Date: Jun 2010
Location: U.S.A.
Posts: 2
Mechstew is on a distinguished road
Talking Webcam center finder emc2 2.3.5

Hi All, I will put together the information that I have, and try to post it on Monday.

Until then, a few things to test first, with the usb webcam plugged in.

1: Open a "terminal" window, and enter the following:
xawtv -hwscan
if this package is not installed, then using a "terminal" window enter:
sudo apt-get install xawtv
, enter your login password, then follow
on screen prompts.

The xawtv -hwscan the xawtv is only used to find out the type of output
from the webcamera and if it is connected to the dev/video0 port.

2: Next, enter the following in a terminal window:
gst-launch videotestsrc ! xvideosink

A small window displaying a test pattern should be playing on the screen.
If nothing happes then the terminal window will probably tell you how to
install gstreamer.
I have read that the gts-launch command is for "testing" gstreamer
applications, which is great, since I only want to test where the location
of a hole center is in relation to the spindles center.

If the computer does not have access to the internet I will have to figure
out how to install the packages needed to run the webcamera.
You can install a windows .ini driver for a wifi connection by using the synapic package manager (SPM), listed under system, administration. Launch the SPM and search for "ndisgtk", mark the package for install, insert the Ubuntu live cd, and then apply changes in SPM. The package name is "ndisgtk", it is an interface for "ndiswrapper", ndisgtk will create a new icon(link) listed under system, administration for wireless drivers.

You will find some attached files below, the output size of the video window should match the size of the .png overlay. when first testing do not have other audio or visual elements playing, as is might be using resources you need to use for testing. I pasted the one line command series into a file named center.py, you can use any name but be sure to end it with a .py inorder to assign it a file type. Having done this, you will be able to right click the top Ubuntu panel bar in the grey area and create a new quick launch icon(button for the .py file) you may need to look at the properties of your new .py file and check the "treat as executible" so the execute option shows.
Hopefuly all is still well. You can make you own icon image for the quicklauch by using the applications/accessories/screencapture with your webcam playing.

Side Notes:
My video window can be dragged to any size and the crosshairs remain "centered", if on AV type programs are running.
My window only works at frame rates =< 10/1 fps.
I made the .png picture using Gimp, drawing the cross first, using guidelines,
then colored the remaining back ground to alpha, as the command lines I used project the webcams stream onto this alpha color region.
When all is hunky-dory, I open EMC2, then quick-launch my.py file, then right click the un-named video window seen in the lower browser-bar to select always on top, then using the lower browser-bar again, select the EMC2, to finaly use the keyboard short cuts to calibrate, then position the part.

I would not run an EMC g-code unless the video window is closed since the gst launch is "only for testing", and it could effect latency stuff.
If you run the webcam window through the terminal you will likely see a clock error iterating to infinity, but the window is still reliable and repeatable and does not lug the computer down, unlike (webcamstudio). Anyway as for myself I just want to position parts and pull splinters.

Remember to try the smaller parts then work up to the whole.



Sources:
This source started the mess.
http://noraisin.net/~jan/diary/?p=40

This source, once inverted, help finish the mess.
http://www.opensource-archive.org/sh...d.php?t=181657


Goodluck!
Mechstew
Attached Thumbnails
Click image for larger version

Name:	cross640480.png‎
Views:	115
Size:	2.1 KB
ID:	109534   Click image for larger version

Name:	cross960720.png‎
Views:	88
Size:	3.8 KB
ID:	109535  
Attached Files
File Type: doc commands.doc‎ (35.0 KB, 91 views)

Last edited by Mechstew; 06-21-2010 at 06:56 PM. Reason: Updated 6/21/2010
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 10-09-2010, 08:09 PM
 
Join Date: Nov 2005
Location: Canada
Posts: 465
chester88 is on a distinguished road

Check this out for something similar:
EMC Documentation Wiki: Axis Embed Video
Reply With Quote

  #7   Ban this user!
Old 10-10-2010, 11:48 PM
 
Join Date: May 2006
Location: United States
Posts: 117
lumberjack_jeff is on a distinguished road

That is really slick. Thanks Chester.
Reply With Quote

  #8   Ban this user!
Old 10-11-2010, 08:52 PM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

That is slick.

Now where's the Linux version of Tormach's Scan/Cad ? I'm convinced there's an existing combination of open source tools that could turn emc into a scanner, just need to find those tools.

Well...... that, plus buy a usb microscope
__________________
Anyone who says "It only goes together one way" has no imagination.
Reply With Quote

  #9   Ban this user!
Old 10-14-2010, 11:49 PM
 
Join Date: Aug 2010
Location: USA
Posts: 1
fullonMAC is on a distinguished road
Patch link dead

Chester88,

I'm 95% there... the link for the patch is busted (site gone extinct, I think).

[2] http://psha.org.ru/p/0001-Added-reparent.patch


Do you know where I might grab that patch or could you drop a copy on me?

Thanks,

John Adam in Libertyville
Reply With Quote

  #10   Ban this user!
Old 10-15-2010, 01:02 PM
 
Join Date: Nov 2005
Location: Canada
Posts: 465
chester88 is on a distinguished road

It seems to be back . Maybe it should be added to wiki as a file rather then a link.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 10-18-2010, 12:34 AM
 
Join Date: May 2006
Location: United States
Posts: 117
lumberjack_jeff is on a distinguished road

the link is dead for me too.
Reply With Quote

  #12   Ban this user!
Old 10-18-2010, 03:04 PM
kanton's Avatar  
Join Date: Jun 2003
Location: USA
Posts: 232
kanton is on a distinguished road

I get this on the link but I don't understand what it is or how to use it:

From 63942679046c9d5a2942c257651270090d6b30d5 Mon Sep 17 00:00:00 2001
From: Pavel Shramov
Date: Mon, 4 Oct 2010 00:15:06 +0400
Subject: [PATCH] Added reparent

Added ability to embed into other X-window when called with -w/--window
parametere.

Signed-off-by: Pavel Shramov
---
camview/camview.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/camview/camview.c b/camview/camview.c
index e479512..228dd53 100644
--- a/camview/camview.c
+++ b/camview/camview.c
@@ -7,6 +7,8 @@
#include

#include
+#include
+#include

#include
#include
@@ -25,6 +27,7 @@ typedef struct _state_t {
char *xml_fname;
char *extra_plugin_path;
int use_gui;
+ int window_id;

GtkWindow *window;
GtkWidget *manager_frame;
@@ -194,7 +197,10 @@ on_save_menu_item_activate (GtkWidget *widget, void * user)
static void
setup_gtk (state_t *self)
{
- self->window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+ GtkWindowType type = GTK_WINDOW_TOPLEVEL;
+ if (self->window_id)
+ type = GTK_WINDOW_POPUP;
+ self->window = GTK_WINDOW (gtk_window_new (type));
gtk_window_set_title(self->window, "Camview");
gtk_window_set_resizable(self->window, TRUE);
gtk_window_set_default_size(self->window, 1000, 540);
@@ -316,6 +322,19 @@ setup_gtk (state_t *self)

gtk_widget_show_all (GTK_WIDGET (self->window));

+ if (self->window_id) {
+ Window xid = GDK_WINDOW_XID (GTK_WIDGET(self->window)->window);
+ long info[2] = { 0, 1 << 0 /*XEMBED_MAPPED*/ };
+ Display * dpy = GDK_WINDOW_XDISPLAY(GTK_WIDGET(self->window)->window);
+ Atom atom = XInternAtom(dpy, "_XEMBED_INFO", 1);
+ printf("Reparent %d (%p)\n", xid, dpy);
+ XChangeProperty(dpy, xid, atom, atom, 32, PropModeReplace, (unsigned char *)&info, 2);
+ XReparentWindow(dpy, xid, self->window_id, 0, 0);
+ XSync(dpy, 0);
+ XMapWindow(dpy, xid);
+ XSync(dpy, 0);
+ }
+
g_timeout_add(250, decay_fps, self);
}

@@ -390,6 +409,7 @@ usage()
"chains. It uses GTK+ 2.0, OpenGL, and libcamunits.\n"
"\n"
"Options:\n"
+ " -w, --window WID Embed in window with id WID\n"
" -c, --chain NAME Load chain from file NAME\n"
" --no-gui Run without a GUI. If --no-gui is specified,\n"
" then -c is required.\n"
@@ -405,11 +425,12 @@ int main (int argc, char **argv)
state_t * self = (state_t*) calloc (1, sizeof (state_t));
self->use_gui = 1;

- char *optstring = "hc:";
+ char *optstring = "hc:w:";
int c;
struct option long_opts[] = {
{ "help", no_argument, 0, 'h' },
{ "chain", required_argument, 0, 'c' },
+ { "window", required_argument, 0, 'w' },
{ "plugin-path", required_argument, 0, 'p' },
{ "no-gui", no_argument, 0, 'u' },
{ 0, 0, 0, 0 }
@@ -418,6 +439,9 @@ int main (int argc, char **argv)
while ((c = getopt_long (argc, argv, optstring, long_opts, 0)) >= 0)
{
switch (c) {
+ case 'w':
+ self->window_id = atoi (optarg);
+ break;
case 'c':
self->xml_fname = strdup (optarg);
break;
--
1.7.1
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Webcam centre / edge / hole finder alan T Quickstep 20 09-07-2011 11:18 AM
My DIY Edge Finder multiplex DIY-CNC Router Table Machines 40 05-25-2010 11:46 AM
Edge Finder Ashish B CNC Machining Centers 14 09-13-2009 03:51 AM
Edge finder eggo Australia, New Zealand Club house 3 08-04-2008 10:57 AM
Has anyone used this edge finder? l u k e General Metalwork Discussion 34 03-19-2008 01:52 PM




All times are GMT -5. The time now is 05:13 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361