Replies: 7 comments 5 replies
-
There's a solution that we use in some of our setups for driving motors from Python before the real test starts, e.g. for adjusting the distance between the jaws of tensile test machines.
Well if you're allowed to share the code, I strongly recommend you to upload it on GitHub ! I might be wrong, but it's also probably a good way to share it internally in your laboratory on the long term and in a reliable and accessible way. IMO the few extra hours it would cost you are totally worth it. Weis |
Beta Was this translation helpful? Give feedback.
-
That could be a solution if we had access to the actuators, but we don't. We have access to the card and it manages the actuators, but we don't control them directly. Creating a github for that could be great to have feedback and help, but the thing is that it would have to be managed by an employee of the company, not an intern like me, but nobody knows much about coding here except me. I'll discuss it with my colleagues and see what's the best option. Another day, another problem : yesterday, since we got a working NI-DAQmx back, we tried to run some tests of my program, but can't update the drivers of the card. It's caused by mirrors problems, and no solution other than "retry in a few hours/days and it'll work" worked out. Thus, I tried coming back to windows, since it shouldn't encounter the problems faced before anymore, since Crappy is launched from another process. However, now, we get a pickling error when hitting the
|
Beta Was this translation helpful? Give feedback.
-
Sorry I didn't specify it, but the trick of instantiating Crappy objects will work with any type of object, not just Actuators. So it will also work fine with InOuts, Cameras, Tools, and even Blocks under certain conditions. With Blocks it would work only if the block doesn't need to receive or to send data. It would also work a bit differently, as you would need to call :
Regarding the bug you're encountering, I somehow managed to reproduce it although I'm not sure if it's representative of your specific situation. Here's the code raising a similar error, based on the code provided in this issue. In this example the problem is that a Process/Block to be started has a Threading object as an attribute. Only pickable objects can be passed to processes, and most Threading objects are not pickable, hence the error. So, make sure your Blocks do not have any Threading objects as attributes. If after double-checking it the error is still there, please try to provide the minimal code that raises this error. Also, check if the structure of your project is similar to the one of my example or if there are differences. Weis |
Beta Was this translation helpful? Give feedback.
-
After hours of searching and testing on different Linux distros, a colleague finally found something deeply hidden on NI's website stating that the specific DAQmx we have has no available driver on anything else than windows. So, definitively back to windows and its bugs. Nice trick to know. I'm gonna try that later, but I'm wondering : if Crappy's already running (we need a recorder for the whole thing, not just the auto-driven part of the test), wouldn't Edited : About that thread bug, the dashboard is causing it. Adding a Dashboard block makes that bug appear, even when it only has an empty list as labels. There's no thread attribute, so I don't understand Why it doesn't work. It raises the same error whether I put it in the fake_machine test or the card-driven one, and nothing changes whether it's linked or not. The only other tests I ran with a Dashboard block were on Linux, and it worked perfectly, so it must be Windows related. I'll keep digging to see if I can solve it. I've finally put my code on Github, though it's still messy. The relevant part is here :
Edited : On a side note, since we're back on windows, |
Beta Was this translation helpful? Give feedback.
-
Well, wouldn't be fun if it wasn't challenging !
We normally use it before calling Nice, it will make things way easier for both of us ! Now I've taken a quick look at your code and it's extremely hard to read and understand. I strongly advise you to subclass the Tkinter objects rather than calling them in functions, as explained in this tutorial. It would for example allow you to call
I'm not going to be working through all the termination issues anytime soon, especially on Windows. You'll need to wait a few months for that.
I had a very hard time spotting the exact cause of the problem, but I managed. First, when I'm talking about a minimal code that reproduces the bug, I was expecting something like that. The bug is specific to Windows, or more precisely to the It actually comes from the Dashboard block, which is the reason why you only had it with your You could also use the newest version of the Dashboard block that hasn't been released on PyPI yet. You could integrate it in your project as shown here. The same solution works if you choose to keep your current implementation of the Dashboard and to just move the problematic line. You would just have to change the dashboard.py file accordingly. Weis |
Beta Was this translation helpful? Give feedback.
-
Challenging, indeed. That's not my main priority, but I'll try. To be honest, it's my first project in Python, and I had to take over a 4000 lines long code with cryptic function and variable names. I've learned OOP on structured languages (mainly JAVA) but had to learn Python's ways to handle objects pretty much from scratch. This is why my code and its organization are messy, and I've still got a lot to learn on those point. Sorry about the big chunk of code, but a colleague was waiting on me to show him how the new program works, so I didn't really clean before sending it. I figured out it was the Dashboard this morning, but you got that by yourself. I'm gonna try switching that line for now, and I'll check the new Dashboard later. When I'll have time, I might check on that other block too. |
Beta Was this translation helpful? Give feedback.
-
Hello again. I've found ways to do (or circumvent) most of what I wanted to, but I'm still stuck with a few problems :
|
Beta Was this translation helpful? Give feedback.
-
(follow-up of these issues and questions)
There's still a few questions/things to discuss, so let's do it here.
I completely forgot to answer your last question :
People here are used to the old software that has one button for the pre-stretch, one for the release phase and one for the main test. It allows people to manually drive the bench (with the remote) to where they want without necessarily using the pre-stretch or release functionalities. Since these two functions aren't always used, or are sometimes used and complemented with manual driving between them and the test, I can't just append them to the main list of paths.
Displaying the shape, not exactly, but it's something I'll try to implement if I've got the time (which I doubt, at least during my internship, but maybe later). For now, we have a window showing subframes with one path each. Each subframe contains a label explaining it, such as "3 cycles of ramps : 1.2T/s for 6s, -4T/s down to 2T", a button to modify it and one to suppress it. I'll try to prepend a basic image of the shape. I can e-mail you the code now, but it's still a bit rough, or two, three weeks, if you don't need it right now.
PS : I'm pretty new to using Github actively, so didn't really know about this section.
Beta Was this translation helpful? Give feedback.
All reactions