#linuxcnc-devel | Logs for 2016-11-24

[10:35:06] <Roguish> JT-Shop: hey, what's for dinner?
[10:38:04] <JT-Shop> ham steak, lobster rolls, baked potato, cranberry sauce, gravy
[11:10:58] <Roguish> stylin'
[11:11:25] <skunkworks> zlog,
[14:53:23] <kwallace_ofcb> This looks interesting for machine modeling: https://www.youtube.com/watch?v=x0mt_2mDzlg
[14:55:53] <andypugh> I am clearly not Pythonic
[14:56:07] <andypugh> File "./python/remap.py", line 194, in g71
[14:56:07] <andypugh> g7x(71, **words)
[14:56:08] <andypugh> TypeError: g7x() takes exactly 2 arguments (1 given)
[15:00:01] <kwallace_ofcb> I usually try to look at the calling command to see what it wants. Sometimes I add a dummy argument to see what happens.
[15:00:52] <andypugh> G7x(71, **words) _is_ the calling command.
[15:01:42] <kwallace_ofcb> I wonder if **words is expected to have two arguments in it?
[15:06:07] <andypugh> I dont understand what the * really does
[15:09:59] <bpuk> ** is arbitrary number of arguments
[15:10:52] <bpuk> passes as a dictionary I think
[15:11:40] <andypugh> Yes. except when it doesn’t
[15:12:40] <bpuk> words is a dict
[15:12:43] <andypugh> Yes
[15:12:44] <bpuk> or should be
[15:12:50] <andypugh> Words is a dict.
[15:13:13] <andypugh> def g71(self, **words)
[15:13:23] <andypugh> g7x(71, **words)
[15:13:43] <andypugh> Was the plan, where:
[15:13:55] <andypugh> def g7x(self, mode, **words)
[15:14:03] <bpuk> and you've done words = {'x':1,'z':1} or similar?
[15:14:24] <andypugh> Not me, remap does that. Passes a dict of the parameters to G71
[15:14:31] <bpuk> sorry, just checking for the obvious stuff - after that my python-fu gets weak
[15:14:42] <andypugh> {'i': 0.5, 'p': 100.0, 'k': 0.5, 'd': 0.5}
[15:15:04] <bpuk> yup, that looks like a dict
[15:15:08] <andypugh> It is.
[15:15:13] <bpuk> should work
[15:15:18] <bpuk> but obviously doesnt
[15:15:32] <andypugh> But when I pass it to g7x it isn’t a dict any more.
[15:16:43] <andypugh> I have tried G7x(71, words) / g7x(71, *words) / g7x(71, ** words) and, in desperation g7x(71, ***words)
[15:17:25] <bpuk> is the third one a typo? with python and whitespace craziness...
[15:18:38] <andypugh> Actually, the first one might well be cortect, the error message might not be caused by what I thought.
[15:22:03] <bpuk> ah-ha
[15:22:45] <andypugh> Hmm, no.
[15:22:50] <andypugh> Well, yes and no
[15:22:53] <andypugh> mainly no
[15:23:57] <andypugh> G7x(71, words) passes the right number of arguments, but the “words” that g7x() gets is empty.
[15:25:30] <bpuk> bleh. I should get back onto the o-word stuff tomorrow - this week has been pretty much a write off
[15:36:22] <andypugh> Ah, that’s interesting. The dict is neog passed, but it’s going to the wrong function parameter
[16:57:31] <tinkerer> andypugh: try this:
[16:58:17] <tinkerer> $ python
[16:58:27] <tinkerer> >>> def testargs(a, *b, **c):
[16:58:48] <tinkerer> print a
[16:58:55] <tinkerer> print b
[16:59:02] <tinkerer> print c
[16:59:11] <andypugh> tinkerer: I think I got to the root of the problem, my parameter was being consumed by a spurious “self” in the function definition.
[16:59:17] <tinkerer> <enter>
[16:59:26] <tinkerer> >>> testargs( 1, 2, 4, 5, x=3, y=6)
[16:59:40] <andypugh> But I did learn a lot about what the * does in Python getting to there
[16:59:50] <tinkerer> :D
[17:01:09] <tinkerer> spurious sounds funny
[17:02:49] <tinkerer> is the function not a member of a class?
[17:03:24] <andypugh> It was but it isn’t now.
[17:04:01] <andypugh> G71 and G72 are, but they both call G7x which isn’t
[17:04:15] <tinkerer> aha
[18:08:05] <andypugh> Does a re-mapped G-code know its starting position? It is probably hidden in linuxcnc.stat somwhere, but things like joint_actual_position are the real current values, not the lookahead values.
[19:04:22] <andypugh> OK, self.params[‘_X’] etc finds the interp positions in a remap.
[19:43:02] <mozmck> For the halui.jog.x.analog pins, what is the value range? is the number the feedrate?
[19:44:01] <jepler> mozmck: the manpage says "typically set between 0 and +/-1.0"
[19:45:31] <jepler> sendJogCont(joint,(new_halui_data.jjog_speed) * (new_halui_data.jjog_analog[joint]),JOGJOINT);
[19:46:06] <jepler> so it appears +-1.0 on .analog gives +-jog_speed
[19:46:22] <mozmck> Hmm, the manpage I have (2.7) says: "pin for jogging the axis N using an float value (e.g. joystick)"
[19:47:06] <mozmck> Oh, so the jog_speed pin has to be set
[19:47:07] <jepler> master here, it may have been revised for JA merge
[19:52:20] <mozmck> thanks jepler
[20:19:03] <jepler> mozmck: glad I could help, hope the info is accurate