![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#2
| |||
| |||
| 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! |
|
#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 Last edited by Mechstew; 06-21-2010 at 06:56 PM. Reason: Updated 6/21/2010 |
| Sponsored Links |
|
#6
| |||
| |||
| Check this out for something similar: EMC Documentation Wiki: Axis Embed Video |
|
#8
| |||
| |||
| 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. |
|
#9
| |||
| |||
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 |
|
#12
| ||||
| ||||
| 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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
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 |