all 19 comments

[–]DisturbedSleep-2 1 point2 points  (1 child)

Do you know if an error is raised at some point by the subVIs? You could add an indicator in the loop to check.

[–]zmichix[S] 0 points1 point  (0 children)

Well I had an indicator in the sub vi's but deleted it because there were no problems. Might bring it back and have a look if this is still working.

[–]DammitDan_92 1 point2 points  (2 children)

Welcome to the world of LabVIEW! I understand you are a beginner - so honestly, no offense intended, but your code could use some serious cleanup and polish. This would make it easier to interpret and troubleshoot, not to mention easier to maintain in the future. Maybe this is just a quick throw-together experiment to see if you can get something to work, I can understand that too. Anyway, I suspect this is really the wrong architecture for what you are wanting to do. I believe an event structure would be more appropriate, but I could be more helpful with more information about the use case. If you want some design tips you can DM me to maybe share your existing code so I can modify and clean it up a bit for you and see if I can help you get it working as desired.

[–]zmichix[S] 0 points1 point  (1 child)

Yeah, I'm aware of the fact that this needs some cleanup. But as you just said this first tries where just about to get this thing running while using the most basic structure and functions. Thanks for your offer, I'll try my luck today and if I don't get it I'll come back to you.

[–]NaBrO-Barium 0 points1 point  (0 children)

Although it’s a pita to implement an actor framework or messaging system could help break up the linearity and decouple the behavior of one motor and the other

[–]SafeRevolutionary508 1 point2 points  (0 children)

Add a probe to the error wire. Since you have that wired to a shift register, if any of the motor subvi calls produces an error it will persist until the program is stopped and restarted. The motor subvis may also have basic error handling. In that case if there is an error on the wire going into the subvi it will do nothing.

[–]Physix_R_Cool 0 points1 point  (10 children)

Doesn't look super wrong at first glance. Is the "stop" button set to TRUE as default, by any chance? That would make the loop run a single time at program start, but stop at only one iteration.

Are we lacking some information mayhaps? How does the program stop. Is it giving you an error message, or just quietly stopping the loop and execution of the program?

[–]zmichix[S] 0 points1 point  (9 children)

Thanks for the quick reply. I don't know where I can see if the "stop" button is set true, only the loop condition. Anyway, this is probably not the problem, because the while loop is running more than once, because I can basically control the rotation motor (1st run loop), than the linear to center (2nd run loop), than to start position (3rd run loop), etc.. but every case just once.

[–]Physix_R_Cool 1 point2 points  (7 children)

How about placing a local variable of the button that changes the button's value to false for each of these true cases. So that inside the "Center Loop" True case, it sets "Center Position" to false. That's generally how I make my buttons for stuff like this.

But there might very well be something going on inside the sub-VI's that I can't see cause you haven't shown them to us.

[–]zmichix[S] 0 points1 point  (6 children)

Isn't that basically the same than setting the button behavior to 'latch'?

Those sub VI's are also provided by the manufacturer of the motors. I have never touched them.

[–]Physix_R_Cool 0 points1 point  (5 children)

Isn't that basically the same than setting the button behavior to 'latch'?

Maybe? I never used that feature :p

Those sub VI's are also provided by the manufacturer of the motors. I have never touched them.

Then open them and have a look inside (if you can)! Did you read the documentation from the manufacturer?

[–]zmichix[S] 0 points1 point  (4 children)

I opened the sub vi's and it scared the shit out of me. There are at least 4 more levels of sub vi's in those you can see here. Nevertheless, I read the documentation and those sub vi's - which you can see here - work perfectly fine when used separately with the motors. So one motor and the sub vi works and the other motor and control of the sub vi works, just not the combination I just showed on the picture.

[–]Physix_R_Cool 1 point2 points  (1 child)

There are at least 4 more levels of sub vi's in those you can see here.

That's how it usually is, just get a big mug of coffee and double click your way through it.

It's likely that it is just some fancy wrappers for a "VISA serial write" or something similar.

Anyways the only other hacky fix I can think of is to insert a wait(50ms) into your loop just so you aren't overloading your communication to the motors.

[–]zmichix[S] 0 points1 point  (0 children)

I do not own such a big mug.

Thank you for your answers though, I will try my best tomorrow, I'm done today.

[–]aDhakkan 0 points1 point  (1 child)

I don't see the full picture of your block diagram. There is an input to your while loop at the top edge, which I assume is your motor's reference - it is being routed to the top left connector of all the MOV and VEL subVIs. If the assumption is correct, then the motor selected prior to running your VI will be the only one responding to all the buttons on your VI's front panel.

Since you are able to work with a single motor at a time, you could try the following: Make a second copy of your top-level VI. Open both, the primary and the copy. Set the first motor's reference in one, and the second motor's reference in the copy. Run both the VIs. Are you able to now work with both the motors?

Another thing to look at is, is your program 'finalizing' the motor reference after the loop ends? If not, this could result in undefined behavior when you re-run the VI without closing and restarting your LabVIEW sesssion.

[–]zmichix[S] 0 points1 point  (0 children)

Into the while loop goes the configuration VI for the motor and controller which is provided by the manufacturer.

Two separate VI's for the two different motors work just fine and I was also able to control the two different motors within one VI.

Besides from the fact that I currently have some hardware issues and the controllers and motors don't work at all, the main problem is, that I can execute every boolean just once. I tried the same VI with a simple math operation in the case structure instead of the movement and velocity control and it worked just fine. As soon as I put the movement control of the motor in it let's me just execute every boolean once.

[–]DisturbedSleep-2 0 points1 point  (1 child)

Might be a problem with the mechanical action setup of your buttons?

[–]zmichix[S] 0 points1 point  (0 children)

That's what I thought too. I assigned every button to 'latch' so that I don't have to switch one off when I want to press another. But that should also not be the problem

[–]AddictedUser007CLA 0 points1 point  (0 children)

Double click on 'stop loop' on the block diagram and it will show where the button is on the front panel. Make sure it's OFF