#linuxcnc Logs

Apr 02 2024

#linuxcnc Calendar

12:59 AM Deejay: moin
04:28 AM Tom_L: morning
04:49 AM JT-Cave: morning
07:16 AM lcnc-relay: <iamtherealbeef> https://jauriarts.org/_matrix/media/v3/download/jauriarts.org/YjBJbafWQdiMMRrPakytzEOe/maxresdefault.jpg
07:16 AM lcnc-relay: <iamtherealbeef> did the culprit leave a crowbar lying around?
09:05 AM lcnc-relay: <tcwilliamson> Hello!
09:05 AM lcnc-relay: <tcwilliamson> How Stable is the EtherCAT LinuxCNC implementation? Is it 'good to go' basically?
09:11 AM JT-Shop: https://forum.linuxcnc.org/ethercat
09:25 AM lcnc-relay: <tcwilliamson> how have people found the ECT60 drives / Servos for tuning / response?
09:25 AM lcnc-relay: <tcwilliamson> I'm mostly familier with Estun and Elmo
09:26 AM JT-Shop: I doubt anyone here has messed with ethercat the forum is the best place to ask about that
09:26 AM lcnc-relay: <skunkworks8841> I don't know if many here on irc/discord have done much with ethercat.
09:26 AM lcnc-relay: <skunkworks8841> What JT said
09:26 AM JT-Shop: lol
11:29 AM lcnc-relay: <perry_j1987> hey guys how's it been
12:26 PM bjorkintosh: https://github.com/AlexanderKoch-Koch/low_cost_robot?tab=readme-ov-file
12:49 PM Unterhaus_ is now known as Unterhausen
12:51 PM lcnc-relay: <perry_j1987> https://jauriarts.org/_matrix/media/v3/download/jauriarts.org/hQimHhnQIhLeHoAutBmMqpSf/IMG_0534.jpg
12:53 PM lcnc-relay: <perry_j1987> like this? https://amzn.to/43GOYoG
12:54 PM lcnc-relay: <perry_j1987> https://amzn.to/3J2gvaJ
12:54 PM lcnc-relay: <perry_j1987> just googled for hose clamp mounting brackets
12:54 PM XXCoder: there is tons of designs
12:54 PM XXCoder: including some 3d printable ones.
01:36 PM Tom_L: JT-Shop, disable logic all fixed?
01:41 PM JT-Cave: not yet
01:42 PM Tom_L: pulled what you have but i'll wait a while
01:46 PM JT-Cave: some things work as designed some still need work
01:50 PM Tom_L: i need a nap first anyway
03:54 PM Tom_L: JT-Cave, looking at the last push
03:54 PM Tom_L: should home_all be enabled during program_pause?
03:55 PM Tom_L: and what about step? it _could_ run a line if the program is paused?
03:56 PM Tom_L: maybe home if stopped but not paused?
03:57 PM Tom_L: you have the individual buttons false there
03:58 PM Tom_L: ln 184
04:00 PM JT-Cave: which file?
04:00 PM lcnc-relay: <iamtherealbeef> Did you find the answers you're looking for? I know a couple of guys who are playing with ethercat
04:00 PM Tom_L: startup
04:01 PM JT-Cave: I don't think you can step while paused but I've not checked in axis
04:01 PM Tom_L: no, ln 200 for the home all
04:02 PM Tom_L: under program_paused
04:02 PM Tom_L: i think if the program is paused you can step but i'd have to double check
04:02 PM Tom_L: looking at this in win atm
04:03 PM Tom_L: rebooting
04:03 PM JT-Cave: right now I have an issue in status interp_state that I have to work out
04:03 PM Tom_L: np
04:05 PM Tom_L: yes you can step during program pause
04:05 PM JT-Cave: ok
04:22 PM JT-Cave: it quite possible work now with a few disables yet to add
04:23 PM Tom_L: ok
04:24 PM Tom_L: this makes it easier to edit?
04:24 PM JT-Cave: still have some work to do on enables after program is ran
04:24 PM JT-Cave: yes
04:29 PM Tom_L: startup ln 260
04:29 PM Tom_L: errors
04:29 PM Tom_L: reload_pb
04:30 PM -!- #linuxcnc mode set to +v by ChanServ
04:30 PM Tom_dev: File "/usr/bin/flexgui", line 125, in __init__
04:30 PM Tom_dev: startup.setup_enables(self)
04:30 PM Tom_dev: File "/usr/lib/python3/dist-packages/libflexgui/startup.py", line 260, in setup_enables
04:30 PM Tom_dev: getattr(parent, item).setEnabled(False)
04:30 PM Tom_dev: ^^^^^^^^^^^^^^^^^^^^^
04:30 PM Tom_dev: AttributeError: 'flexgui' object has no attribute 'reload_pb'. Did you mean: 'flood_pb'?
04:34 PM solarwind: Tom_dev please tell me you're using a proper IDE like pycharm
04:35 PM solarwind: and the interactive debugger
04:35 PM solarwind: I'm really getting the hang of CAD, quite a rush
04:36 PM solarwind: fusion360 is really intuitive. I didn't even read the manual and I knew I needed to "project" features onto another surface and lo and behold, there's a "project" function that does exactly that
04:36 PM solarwind: Freecad on the other hand, what an absolute nightmare
04:37 PM solarwind: I just wish the constraints and parameters were more tabular instead of the "timeline" at the bottom
04:37 PM solarwind: I want to be able to select an object and see all of its constraints in a table somehow instead of visually hunting for them on screen
04:38 PM solarwind: and the "constraints were removed" and other messages are a bit useless. WHICH constraints were removed??
04:38 PM JT-Shop: Tom_dev, not sure how you got that error, it checks to see if it exists before doing anything
04:43 PM Tom_dev: i'll reinstall and try again
04:43 PM JT-Shop: ok
04:45 PM Tom_dev: https://paste.debian.net/1312854/
04:45 PM Tom_dev: same thing
04:46 PM Tom_dev: did you rename something?
04:46 PM JT-Shop: hmmm
04:55 PM Tom_L: i don't see it
04:56 PM JT-Shop: see what?
04:56 PM Tom_L: what may be causing the error
04:56 PM Tom_L: or a typo
04:57 PM JT-Shop: I don't see what is the issue is either
05:03 PM solarwind: expert computer systems engineer offering free help, get your free help right here!
05:17 PM JT-Shop: https://github.com/jethornton/flexgui
05:21 PM solarwind: Tom_L can you do this: add `import ipdb` at the top of startup.py
05:22 PM solarwind: Then just above line 260 add `ipdb.set_trace()`
05:22 PM solarwind: then run it again and when it brings up the debugger, do `dir(parent)
05:22 PM solarwind: `
05:23 PM solarwind: because reload_pb didn't get loaded/added in the parent
05:25 PM Tom_L: no module named ipdp
05:26 PM solarwind: just pdb then `import pdb`
05:27 PM Tom_L: nope
05:27 PM solarwind: that should always work
05:27 PM solarwind: you're telling me `import pdb` doesn't work?
05:27 PM Tom_L: no module named pdp
05:27 PM solarwind: pdb
05:27 PM solarwind: not p
05:28 PM solarwind: that's the built in debugger, it's always available
05:30 PM -!- #linuxcnc mode set to +v by ChanServ
05:30 PM Tom_dev: https://paste.debian.net/1312856/
05:30 PM solarwind: wait what
05:30 PM solarwind: pdb
05:30 PM solarwind: pdb
05:31 PM solarwind: papa delta bravo
05:31 PM Tom_dev: import pdb
05:31 PM solarwind: yes
05:31 PM Tom_dev: pdb.set_trace()
05:31 PM solarwind: yes
05:31 PM Tom_dev: that's what it was sir
05:33 PM solarwind: put pdb.set_trace() on line 254, just above the `if parent.status.file:`
05:34 PM Tom_dev: https://paste.debian.net/1312857/
05:36 PM solarwind: How are you launching the program?
05:36 PM Tom_L: not from a terminal
05:36 PM solarwind: Ok yeah try launching from a shell
05:36 PM Tom_L: linuxcnc icon
05:36 PM Tom_L: linuxcnc needs to be running
05:36 PM solarwind: that's fine, you can launch it from a shell
05:37 PM solarwind: it raises that exception when it's not connected to a TTY
05:37 PM Tom_dev: -> if parent.status.file:
05:37 PM Tom_dev: (Pdb)
05:37 PM solarwind: ok great
05:37 PM solarwind: type(parent)
05:37 PM solarwind: dir(parent)
05:38 PM solarwind: getattr( ) isn't a good way to go about accessing objects in the parent FYI
05:39 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/cnc/JT-SHOP/flexgui/parent.txt
05:40 PM Tom_L: paste.debian didn't like that
05:40 PM solarwind: type(parent)
05:40 PM Tom_dev: <class '__main__.flexgui'>
05:40 PM solarwind: ok so that is correct
05:41 PM solarwind: import inspect
05:41 PM solarwind: inspect.getmembers(parent)
05:42 PM solarwind: it'll give a lot of output
05:44 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/cnc/JT-SHOP/flexgui/inspect.txt
05:45 PM solarwind: 'file_edit_items': ['reload_pb', 'actionEdit', 'actionSave_As']
05:45 PM solarwind: find the one that does not belong
05:45 PM Tom_dev: reload_pb should be ok
05:46 PM solarwind: looks like it should be action_reload or actionReload, no?
05:46 PM Tom_dev: JT-Cave, is actionSaveas coded?
05:46 PM solarwind: actionSaveAs
05:46 PM solarwind: the naming is so bad
05:47 PM solarwind: I see actionSave_As, action_save_as
05:47 PM solarwind: the point is, `reload_pb` is a button object
05:47 PM Tom_dev: right
05:47 PM solarwind: whereas that list looks like a list of action names
05:47 PM solarwind: and reload_pb is out of place'
05:47 PM solarwind: looks like it didn't get mapped to actionReload or whatever
05:48 PM solarwind: one way to bypass this is ignore the error
05:48 PM solarwind: just wrap line 260 (the getattr line) in a try/except
05:48 PM solarwind: the code here is spaghetti, this is not how you map actions to buttons
05:49 PM Tom_dev: parent.file_edit_items = ['edit_pb', 'reload_pb', 'save_as_pb', 'actionEdit',
05:49 PM Tom_dev: 'actionReload', 'actionSave_As']
05:49 PM solarwind: yeah what in the fuck is going on there
05:49 PM solarwind: first three are button names, second three are action names
05:49 PM solarwind: if item not in parent.children:
05:49 PM solarwind: parent.file_edit_items.remove(item)
05:50 PM solarwind: looks like that is not actually removing the item
05:50 PM Tom_dev: those can work from a button or menu
05:50 PM solarwind: so it's leaving reload_pb
05:50 PM solarwind: I think that's happening because reload_pb is in a sublayout
05:50 PM solarwind: https://github.com/jethornton/flexgui/blob/315ebe1e32e7c7962ef6b08137a786603b46e051/examples/controls.ui#L31
05:50 PM solarwind: I could be wrong
05:51 PM solarwind: But for whatever reason, reload_pb is out of place, and it should not be in that list
05:51 PM solarwind: if it's meant to be removed, it's not getting removed
05:51 PM solarwind: so you can simply add a try/except around line 260
05:53 PM solarwind: replace with this: https://paste.debian.net/1312859/
05:58 PM JT-Shop: 2 bottom plow is gone
05:59 PM Tom_dev: tom@debian12:~/flexgui/flexgui/src$ ./flexgui
05:59 PM Tom_dev: > /home/tom/flexgui/flexgui/src/libflexgui/startup.py(256)setup_enables()
05:59 PM Tom_dev: -> if parent.status.file:
05:59 PM Tom_dev: (Pdb)
06:00 PM solarwind: `continue`
06:00 PM solarwind: or remove the ipdb.set_trace
06:00 PM solarwind: pdb.set_trace(), whatever
06:00 PM Tom_dev: 'flexgui' object has no attribute 'reload_pb'
06:00 PM Tom_dev: 'flexgui' object has no attribute 'actionEdit'
06:00 PM Tom_dev: 'flexgui' object has no attribute 'actionSave_As'
06:00 PM Tom_dev: 'actionSave_As'
06:01 PM Tom_dev: mouse is fcked up
06:01 PM solarwind: yeah that code is absolutely miserable
06:01 PM solarwind: it's fundamentally broken
06:02 PM solarwind: but at least it got past that point and reporting all the missing attributes now
06:03 PM * Tom_dev goes to relax a bit
06:03 PM JT-Shop: all unconstructive is ignored
06:04 PM solarwind: it's a comment on the code, not your character, that's like one of the first things to know in any software engineering work
06:04 PM JT-Shop: all unconstructive criticism is ignored
06:04 PM solarwind: but the entire mechanism of connecting the UI elements to the callbacks need to be rewritten
06:04 PM JT-Shop: left a word out...
06:05 PM solarwind: naming convention should be consistent according to python standards, which is camel case
06:05 PM JT-Shop: that's just a bunch of bs
06:05 PM solarwind: no, actually it's not
06:05 PM JT-Shop: python doesn't care
06:06 PM solarwind: and that code violates a million PEP8 rules
06:06 PM JT-Shop: and I don't care, it's readable for me and I use tabs because I can and it's more readable
06:06 PM solarwind: and that's exactly why we have linters, IDEs and standards
06:06 PM Tom_L: linuxcnc is a work of volunteers not paid professional software engineers
06:07 PM Tom_L: of various experience levels
06:07 PM JT-Shop: one tab character is easier to see than 4 spaces
06:07 PM solarwind: that's not an excuse to write garbage and get upset when correct criticism is provided
06:07 PM Tom_L: _ i'm down there
06:07 PM solarwind: actually tab vs space is completely invisible, so sight has no impact on it
06:07 PM JT-Shop: I've not seen any constructive criticism yet
06:07 PM JT-Shop: actually tabs are visible in pluma
06:08 PM solarwind: Ok moving on, so don't do what you did on line 20: children = parent.findChildren(QWidget)
06:09 PM JT-Shop: why
06:09 PM solarwind: for GUIs, programmatically trying to connect actions based on strings is more error prone than an explicit straightforward connection
06:09 PM JT-Shop: why?
06:09 PM solarwind: it's better to simply find the object by name and connect the action to it
06:10 PM JT-Shop: example?
06:10 PM solarwind: reduces complexity, vastly simplifies debugging
06:10 PM solarwind: https://www.geeksforgeeks.org/pyqt5-how-to-add-action-to-a-button/
06:10 PM solarwind: button.clicked.connect(self.clickme)
06:10 PM JT-Shop: I can't view that page
06:10 PM solarwind: if an exception occurs, it's much easier to debug along the traceback
06:11 PM solarwind: ok well just the line below the link is the important part
06:11 PM solarwind: it's better to do that explicitly for each action
06:11 PM solarwind: that's the standard way to attach callbacks to GUI elements
06:11 PM JT-Shop: perhaps you misunderstand what I'm doing... I don't know if the object exists in the ui file
06:12 PM solarwind: I understand, that's the point - in the GUI, you _must_ absolutely know what's in the UI
06:12 PM solarwind: because the functionality of the UI is static
06:12 PM JT-Shop: that's why I findChildren and see if it
06:12 PM JT-Shop: s there
06:13 PM solarwind: if you have to dynamically find what's in the layout, it indicates a major design flaw
06:13 PM solarwind: it means you're not using the GUI library correctly
06:13 PM JT-Shop: it's a design feature not a flaw
06:13 PM Tom_L: it is so the user can build their own gui and have the code follow the widget
06:14 PM JT-Shop: so it's obvious you don't understand what I'm doing
06:14 PM Tom_L: not a preselected gui
06:14 PM solarwind: No I don't know what you're doing exactly but I do know it's not written well for multiple reasons
06:15 PM JT-Shop: vague criticism is also ignored
06:15 PM solarwind: If you're building a dynamic UI builder, then why are there hardcoded actions and buttons?
06:15 PM solarwind: I promise you none of this is meant to be an insult
06:15 PM JT-Shop: if the widget is present then I need to connect it to the function
06:15 PM Tom_L: to comply with what linuxcnc is capable of doing
06:15 PM JT-Shop: if the widget is not in the ui then don't try to make a connection to a function
06:15 PM solarwind: yes, but for the widgets you _do_ know are there, connect them statically is what I'm saying
06:16 PM JT-Shop: no I have no clue if a widget is in the user's ui file
06:16 PM JT-Shop: they may only have a few widgets
06:16 PM Tom_L: check for the widget then connect as he mentioned?
06:16 PM Tom_L: idk
06:17 PM solarwind: ok so in that case, it's better to map these functions to the objects in a linear way that's more straightforward for the same reasons
06:17 PM JT-Shop: I don't provide a ui file the user creates it
06:17 PM JT-Shop: example?
06:18 PM solarwind: it's better to list them out linearly, and do an "if present in UI file": connect
06:18 PM solarwind: for each widget
06:18 PM JT-Shop: that's what I'm doing
06:19 PM solarwind: another thing is, list of strings is very very error prone
06:20 PM solarwind: it's always better to deal with objects directly
06:20 PM JT-Shop: example?
06:20 PM solarwind: at the very least, anywhere you have something like f'touchoff_pb_{item}'
06:20 PM solarwind: or run = [ 'run_pb', 'run_from_line_pb', 'step_pb',
06:21 PM solarwind: if you do use strings, they should be explicit constants at the top of the file or something
06:21 PM JT-Shop: why?
06:21 PM solarwind: but much better to find the object by name once and then deal with that
06:21 PM JT-Shop: example?
06:22 PM solarwind: because strings are untraceable, hard to debug. Can't count references to an object or even figure out what an object is
06:22 PM solarwind: ok so instead of adding the string 'run_pb' to a list, make a static reference to it by first getting it by name once at the beginning
06:23 PM solarwind: like btn_run = my_ui.find_button('run_pb') or whatever
06:23 PM solarwind: that's how it's done in pretty much every UI library ever
06:23 PM solarwind: now you have a real object btn_run that's already been validated to exist, and is now traceable
06:23 PM JT-Shop: ok, that makes sense but you're still using a string and I don't think there is a function .find_button
06:23 PM solarwind: and you can inspect/manipulate it however you want through reflection
06:24 PM solarwind: I just made up that find_button, there is definitely a similar function to do this
06:24 PM solarwind: it's a way to get an object reference to a named widget in a UI file
06:25 PM solarwind: that's actually how you're meant to use the UI file layout feature
06:25 PM solarwind: let me see if I can find it in the docs
06:25 PM JT-Shop: pyqt6 has findChild(objectName) and findChildren(widget_type)
06:25 PM solarwind: well there you have it
06:26 PM JT-Shop: it's what I use now
06:26 PM * JT-Shop calls it a day
06:27 PM solarwind: and in any kind of "builder" interface, validation is critical. So once you get a reference to an object, validate it to make sure it's the expected type. That goes for functions too, make sure they're the expected signature
06:27 PM solarwind: python has the `inspect` module and other reflection features to know anything you want to know about an object
06:36 PM solarwind: oh yeah, adding type annotations vastly improves readability and reliability of your code, especially with an IDE and MyPy
06:36 PM solarwind: it can do static analysis before you even run it to make sure types are as they should be
06:37 PM bjorkintosh: yes. because it's all spelled out.
06:37 PM solarwind: in general, the easier it is to do static analysis, the better
06:37 PM bjorkintosh: annotated, as a matter of fact.
07:14 PM -!- #linuxcnc mode set to +v by ChanServ
09:22 PM lcnc-relay: <zincboy_ca_on> It is almost like a strictly typed language has its uses! I really hate the python insistence on avoiding variable and type definition.
09:39 PM lcnc-relay: <ranga> 'transforming' type languages have a benefit, but I so much prefer strict typing personally
11:26 PM solarwind: you mean "static typic"
11:26 PM solarwind: python is strong, dynamic
11:26 PM solarwind: if you don't want that, don't use python
11:26 PM solarwind: There are plenty of excellent alternatives like C++, Rust, Go, Nim etc.
11:27 PM solarwind: I meant Zig, not Nim
11:41 PM lcnc-relay: <ranga> perhaps semantic definitions would disagree, but I see 'strict typing' as 'all variables must have a type' and 'static typing' as 'variables may have only one type'
11:41 PM lcnc-relay: <ranga> the latter is not true in C/C++
11:41 PM lcnc-relay: <ranga> as you can cast to any type you want... regardless of how insane it may be
11:42 PM lcnc-relay: <ranga> I'm also slightly unsure why you appear to be somewhat offended in your response...
11:48 PM roycroft: solarwind is not offended - he's just a curmudgeon :)