Welcome! Log In Create A New Profile

Advanced

Host GUI for Arduino G-code firmware

Posted by Anonymous User 
Anonymous User
Host GUI for Arduino G-code firmware
March 30, 2008 09:48PM
The G-code firmware which is being developed for the RepRap is very promising, but the host side is still a bit primitive; the Processing sketch available at present is not ideal for anything other than testing.

So, I have written a GUI in Java, which reads in G-code files and sends these to the RepRap. It is also possible to enter G-code manually, and there are jog buttons for positioning the head at the start of a job. Furthermore, there is a scrolling pane to display the progress of the job, which may be stopped and restarted.

This code is largely based on the G-code parser I posted last month, which had become largely redundant due to the new G-code firmware.

Unpack, and run repgcode.sh for Linux or repgcode.bat for Windows. Mac users will need to figure things out for themselves (probably running the .jar is sufficient).

Please note that this would likely work with any machine that accepts G-code, not just the RepRap. I've hardcoded the baud rate to 19200 but I can make this editable if people are interested.

OK, that's it for now. Any bugs or comments please please please let me know.
Attachments:
open | download - repgcode-0.2.zip (49.3 KB)
Re: Host GUI for Arduino G-code firmware
April 01, 2008 12:21PM
dude, awesome!

i'll try this out when i get home.
Re: Host GUI for Arduino G-code firmware
April 03, 2008 06:16PM
sounds good! I get this when trying to run it though

Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0x8d404767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0x8d4048b1]
#2 /usr/lib/libX11.so.6(_XReply+0xfd) [0x8caf31bd]
#3 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cbe5dce]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cbcfd77]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cbcfef3]
#6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0x8cbd0136]
#7 [0xb1425008]
#8 [0xb141eb6b]
#9 [0xb141eb6b]
#10 [0xb141c236]
#11 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb76c1eac]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb7891aa8]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb76c1cdf]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb771f7ed]
#15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb73d030d]
#16 [0xb1424898]
#17 [0xb141ea94]
#18 [0xb141c236]
#19 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb76c1eac]
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0x8d404767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0x2e) [0x8d40481e]
#2 /usr/lib/libX11.so.6 [0x8caf2518]
#3 /usr/lib/libX11.so.6(XGetVisualInfo+0x26) [0x8cae90a6]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cbcf0b9]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cbcf303]
#6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cbcffa1]
#7 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0x8cbd0136]
#8 [0xb1425008]
#9 [0xb141eb6b]
#10 [0xb141eb6b]
#11 [0xb141c236]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb76c1eac]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb7891aa8]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb76c1cdf]
#15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb771f7ed]
#16 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb73d030d]
#17 [0xb1424898]
#18 [0xb141ea94]
#19 [0xb141c236]
Exception in thread "G-code for RepRap" java.lang.NoClassDefFoundError: gnu/io/CommPortIdentifier
at com.chrismeighan.repgcode.GCodeCommunicator.(GCodeCommunicator.java:43)
at com.chrismeighan.repgcode.Main.initialiseComms(Main.java:161)
at com.chrismeighan.repgcode.Main.loadPreferences(Main.java:611)
at com.chrismeighan.repgcode.Main.(Main.java:129)
at com.chrismeighan.repgcode.Main.main(Main.java:116)
mike@mike-laptop:~/Downloads/gcodegui$ export LIBXCB_ALLOW_SLOPPY_LOCK=1
mike@mike-laptop:~/Downloads/gcodegui$ ./repgcode.sh
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0xb1280767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xb12808b1]
#2 /usr/lib/libX11.so.6(_XReply+0xfd) [0x8ca1f1bd]
#3 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8caffdce]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cae9d77]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cae9ef3]
#6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0x8caea136]
#7 [0xb1354008]
#8 [0xb134db6b]
#9 [0xb134db6b]
#10 [0xb134b236]
#11 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb75f0eac]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb77c0aa8]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb75f0cdf]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb764e7ed]
#15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb72ff30d]
#16 [0xb1353898]
#17 [0xb134da94]
#18 [0xb134b236]
#19 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb75f0eac]
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0xb1280767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0x2e) [0xb128081e]
#2 /usr/lib/libX11.so.6 [0x8ca1e518]
#3 /usr/lib/libX11.so.6(XGetVisualInfo+0x26) [0x8ca150a6]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cae90b9]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cae9303]
#6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0x8cae9fa1]
#7 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0x8caea136]
#8 [0xb1354008]
#9 [0xb134db6b]
#10 [0xb134db6b]
#11 [0xb134b236]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb75f0eac]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb77c0aa8]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so [0xb75f0cdf]
#15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb764e7ed]
#16 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb72ff30d]
#17 [0xb1353898]
#18 [0xb134da94]
#19 [0xb134b236]
Exception in thread "G-code for RepRap" java.lang.NoClassDefFoundError: gnu/io/CommPortIdentifier
at com.chrismeighan.repgcode.GCodeCommunicator.(GCodeCommunicator.java:43)
at com.chrismeighan.repgcode.Main.initialiseComms(Main.java:161)
at com.chrismeighan.repgcode.Main.loadPreferences(Main.java:611)
at com.chrismeighan.repgcode.Main.(Main.java:129)
at com.chrismeighan.repgcode.Main.main(Main.java:116)
Anonymous User
Re: Host GUI for Arduino G-code firmware
April 03, 2008 07:13PM
mellery Wrote:
-------------------------------------------------------

> Exception in thread "G-code for RepRap"
> java.lang.NoClassDefFoundError:
> gnu/io/CommPortIdentifier
> at

It looks like you don't have the RXTX library installed (or not where they can be found) - I should have been clearer about this. Follow the instructions on the RepRap site at [reprap.org] for linux and [www.reprap.org] for windows

Let me know if this is not it.
emt
Re: Host GUI for Arduino G-code firmware
April 05, 2008 05:37AM
Hi Chris

I have your host running but only jogging at the moment.

If I change the jog increment to 5mm the jog fails to complete. The button stays greyed out and in the comms window a single k appears and scrolls off the screen. I have to restart the software to gain control again. Other odd things happen but this is the most obvious. Could the problem be register size as my drives are micro steppers at 2000 steps per turn and I have have fine screws?


Regards

Ian
Anonymous User
Re: Host GUI for Arduino G-code firmware
April 05, 2008 02:15PM
> If I change the jog increment to 5mm the jog fails
> to complete. The button stays greyed out and in
> the comms window a single k appears and scrolls
> off the screen. I have to restart the software to
> gain control again. Other odd things happen but
> this is the most obvious. Could the problem be
> register size as my drives are micro steppers at
> 2000 steps per turn and I have have fine screws?

Hmm. If it is the register size then that is something in the firmware, not the GUI. I do remember that with the SNAP firmware that if you tried to seek to a position over 32767 (limit of signed 16 bit integer) then it would start going haywire and reversing direction.

I don't have time to check this out with different values in the firmware today, but I'll try and have a look tomorrow.
emt
Re: Host GUI for Arduino G-code firmware
April 06, 2008 09:39AM
Thanks Chris

My numbers in firmware:-

#define X_STEPS_PER_INCH 40000
#define X_STEPS_PER_MM 1574.8031
#define X_MOTOR_STEPS 2000

All axes the same


Regards

Ian
Anonymous User
Re: Host GUI for Arduino G-code firmware
April 07, 2008 10:48AM
Ian

> My numbers in firmware:-
>
> #define X_STEPS_PER_INCH 40000
> #define X_STEPS_PER_MM 1574.8031
> #define X_MOTOR_STEPS 2000
>
> All axes the same

I have tried using these values on my own machine, although of course since I have 400 half-step motors and 0.8mm pitch M5 threads, everything moves further than it should.

I can't reproduce the problem you are having. When I set jog to 5mm it works OK. Therefore I don't think it is anything to do with the firmware or the GUI. There are a few possibilities;

1. Have you set a reasonable jog feed rate? If mine is too high the motors squeal but don't move.
2. Is SENSORS_INVERTING set properly in _init.pde? For most people it should be 0. I had set it to 1 (since my sensors are active low), and this has accidentally made it into SVN.

A few questions;

1. Are you using an Arduino Diecimila (as I am) or other board with a direct USB connection, or a USB->serial converter, or indeed just a regular serial cable? If it's a comms issue then here might be the source of the problem. The G-code firmware is a bit simpler because it does not have the packet exchange protocol of the SNAP firmware, but it could be that this would cause problems for non-USB links.
2. Does this happen when you use the serial monitor in the Arduino environment? Try sending;

G21
G91
G1 X5 F50

(that's metric mode, incremental, move +5 X at 50 mm/minute)

Hope this helps.
emt
Re: Host GUI for Arduino G-code firmware
April 08, 2008 12:16PM
Hi Chris

Jog rate 200 units set in mm.

SENSORS_INVERTING set correctly and those switches I can check work OK.

I am using an Arduino Diecimila

G21
G91
G1 X5 F50 sent line at a time work fine.

If I set jog button increment above 3 the progamme hangs.

From start up with increment set to 3 I can jog everything except Z+

Checking with logic probe
If I jog Z+ the direction output changes but no step pulses appear. If I jog Z- I see pulses and it works so I must have the correct Pins set

What is the name of you host config file? I could send you a copy of mine or delete it in case it is corrupt and try again.

I can confirm that if I set increments to 5 and jog X+ it moves possibly the correct distance BUT the button stays greyed out and a single "k" is echoed on the screen as below.

C:\GCodeHost>java -jar C:\GCodeHost\repgcode-0.2.jar
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7






k

This scrolls off the screen and the window keeps scrolling.


Regards

Ian
Anonymous User
Re: Host GUI for Arduino G-code firmware
April 08, 2008 08:59PM
> What is the name of you host config file? I could
> send you a copy of mine or delete it in case it is
> corrupt and try again.

Windows:
%USERPROFILE%\.repgcode\repgcode.properties

Where %USERPROFILE% is C:\Documents and Settings\chris or something similar

Linux:
$HOME/.repgcode/repgcode.properties

Where $HOME is /home/chris or something similar
-Does- the RepRap host software work with G Code? This is such a big system to learn (to me). Maybe some of you guys can help clear things up.

If you use the G Code firmware then you just use the Arduino/GCode_Interpreter directory and ignore all the PIC stuff, correct???

Why is there no Makefile, this is so confusing. WIth a makefile I could find the dependencies and figure out what the main file is. The readme that comes with the firmware (from subversion) is out of date . . . it reports that what you want to use is 'Single_Arduino_SNAP'. I take it what I really want is 'Single_Arduino_SNAP_v2'. I understand that Arduino has its own software which compiles things for you and that is why there's no makefile...

Now I may be wrong here but what does SNAP have to do with anything when there's just one arduino connected to a PC? Do you even need SNAP any more if that's all you have? Or do you use PICs still when you have a single arduino ??

Finally (I know I ask a lot of questions), is the 'single arduino snap v2' thing going to work? Does it have bad bugs or is it workable? What is this G code thing and does the host even support it?

All this SNAP stuff makes sense, it's a lot like a token ring for PICs, right? So if I use the G Code firmware . . . what happens to SNAP??

Your help greatly appreciated,
Willow
Re: Host GUI for Arduino G-code firmware
April 11, 2008 08:57AM
--Willow

Yes, RepRap does has a subversion that works with Gcode

Yes, you can ignore the PIC stuff if you use the Arduino Gcode interpreter

With the arduino Gcode software, I think that the SNAP protocol has been eliminated.

Concerning the Gcode, right now I think that it is a subversion, so it hasn't officially been accepted even though the arduino is the new dircetion of developement.

Also, the host software creates its own gcode out of the 3d models that are imported to it; but Chris Meighan wrote another GUI in which one can just import their own Gcode to it.


Jay
Re: Host GUI for Arduino G-code firmware
April 11, 2008 03:07PM
Willow Schlanger Wrote:
-------------------------------------------------------
> If you use the G Code firmware then you just use
> the Arduino/GCode_Interpreter directory and ignore
> all the PIC stuff, correct???

we have 2 things:

1. a firmware for the Arduino that interprets GCode commands and executes them on the steppers, etc.

2. a branch of the host software that takes a 3D file, and outputs a gcode file (or sends it to your arduino) this is under development, and i'll be porting it back into trunk ASAP.

> Why is there no Makefile, this is so confusing.
> WIth a makefile I could find the dependencies and
> figure out what the main file is. The readme that
> comes with the firmware (from subversion) is out
> of date . . . it reports that what you want to use
> is 'Single_Arduino_SNAP'. I take it what I really
> want is 'Single_Arduino_SNAP_v2'. I understand
> that Arduino has its own software which compiles
> things for you and that is why there's no
> makefile...

you open those files with the Arduino and hit upload. then its on your Arduino and running. follow the instructions and you'll have no problems. not having a Makefile is a good thing here. =)

> Now I may be wrong here but what does SNAP have to
> do with anything when there's just one arduino
> connected to a PC? Do you even need SNAP any more
> if that's all you have? Or do you use PICs still
> when you have a single arduino ??

SNAP is just a serial protocol. The old PIC stuff was setup in a token ring, and the new Arduino has a firmware that emulates that in order to remain compatible. Its not token ring specific, but it is serial specific.

> Finally (I know I ask a lot of questions), is the
> 'single arduino snap v2' thing going to work? Does
> it have bad bugs or is it workable? What is this G
> code thing and does the host even support it?

That was something I created a couple days ago. It doesnt compile, and it doesnt do anything. I was just toying with ideas for the next generation protocol. No support at all.

> All this SNAP stuff makes sense, it's a lot like a
> token ring for PICs, right?

Nope, its just a protocol. Token ring works, because each node just passes the packets along. You can easily just use it as CPU <-> Arduino as well.

> So if I use the G Code
> firmware . . . what happens to SNAP??

Nothing... GCode is just straight text that gets sent over the serial link, so no SNAP is needed. If you have gcode you want to run, or you want to get around the segment pausing in the V1 of the protocol, you can use GCode.

If you want to use the RepRap host software, there is SNAP. Same Arduino/Electronics setup, just a different firmware for different purposes =)

> Your help greatly appreciated,
> Willow

You're welcome =)
Re: Host GUI for Arduino G-code firmware
August 29, 2008 10:00AM
Chris,

I'm glad to see that you've written this piece of software. I'm having some problems with it though.

I've been trying your g-code feeder to mill a PCB. A friend and me have made an attachment for the RepRap so we can use a Dremel multi-tool (33k RPM). Using the + and - buttons on the RepRap host software allows us to make relatively precise traces, so in theory we should be able to mill PCBs. Right now I'm trying to get the arduino to run G-Code. I'm using reprap-arduino-firmware-1.3 (gcode version, and not the experimental one). The newer version from SVN didn't work.

When I use your program (repgcode v. 0.3.jar) get this output at the console:
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
start

I hear the stepper coils become energized, but after that the software hangs (no significant CPU usage). There are no windows that show up. The first time, when I configured it (with setup) it hung when I chose ttyUSB0 and pressed OK. The dialog then becomes messy.


Regards,

Erik de Bruijn
[Ultimaker.com] - [blog.erikdebruijn.nl]
Sorry, only registered users may post in this forum.

Click here to login