Python method for "jog to position"

More
30 May 2019 21:33 #135425 by blazini36
I'm trying to figure out if there is a simple method of setting up positional jog commands in Python without using Gcode/MDI. My machine basically uses alot of jog commands to move through the UI but I have portions that should be done through just telling it to move to an absolute position.

Currently my buddy who helps me with programming has this going through a somewhat convoluted method of taking the current position and calculating how far the joint needs to move to get to the next position then sending an incremental jog command of that value. Floating point errors cause issues when jogging near the limits of the machine and eventually the requested incremental move winds up being .0000000012 beyond the limit. I wasn't really aware that that was the way we were doing that particular function, but I'm not overly thrilled with doing it that way, even if it's fixable.

Jog to position is simple enough using MDI commands but I wasn't really prepared to set that up. If it's the only reasonable way I suppose I may have to look into it.

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

More
30 May 2019 21:56 #135427 by BigJohnT
The python interface only has jog continuous and increment. It can be very simple to setup MDI commands in the ini file and link them to buttons depending on which GUI your using...

JT

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

More
31 May 2019 01:32 #135441 by blazini36
Yeah, I kind of figured that. Luckily I see that the MDI history widget is all set up so I plopped it into an open config space in my GUI for testing.

Doesn't look too hard to implement to the command channel at all really.

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

More
31 May 2019 02:24 #135443 by blazini36
One thing I'm not sure about is checking for "in-position". Typically while this is running a position sequence it moves to a position, checks that it got there (through convoluted means) then waits a specified time and moves to the next.

Using MDI I would expect to send the Gcode and see the joint.in-position pin go false until it gets there. That pin stays true the entire time before it is moving, and while it's moving. I'd assume the command channels "inpos" stat were tied to this pin but I have no way of verifying that, or whether the stat behaves differently. In actual use I'm sure we would be polling the stat rather than doing anything with the hal pin.

Any insight on how I determine exactly when the move has been completed or if the inpos stat does actually behave the way I need it to?

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

More
31 May 2019 11:03 #135457 by BigJohnT
I'm using QtPyVCP to build my GUI's and inpos does work as expected for both a program and a MDI move. I also tested a short G code program with a pause and got what I expected from inpos.

JT

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

More
08 Jun 2019 03:53 #136280 by blazini36
I looked at the hal pin again for inpos and it did work as expected. I may have had the wrong mode set at first. MDI looks like it will work well once I tested and figured some things out. One thing I'm not sure about is the method of setting the offset and how to "turn it off". I'm no Gcode wizard.

Machine would typically be motion.coord-mode=false with no offset. I used "G10 L2 P1 X3 Y3" to set X and Y to 3" offset. Then G54 for redundancy to make sure I was on the Right CS. The only thing I can think of to do to turn it "off" is "G10 L2 P1 X0 Y0" or issue G55 to set the CS to one with no value. This still leaves motion.coord-mode=false which doesn't really matter but I figure there must be an easier way.

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

Time to create page: 0.125 seconds
Powered by Kunena Forum