From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-01-2020 05:40 AM
Hi,
so i have a generic subVI that does a job. it takes an array of clusters with 4 numeric inputs in each row and moves a platform as I wish.
The function, as it is built right now, also take a boolean input from a push button and execute only if the button is pushed.
Now all of that works great, however with time I've realized that an extra feature is required.
I'd like to have a second button 'Start Inverse' that multiply the X values of each row and only then sends it to my subVI.
How can I do it in a clever way?
I can always make another function that multiply the X value before each use and wire the second button to it, but that is just silly programming.
I attach a test VI as my original program is richer with components. The test VI does not work at the moment, it is just a structure, uploaded to give an idea for what I have in hand.
Thanks for the helpers
Solved! Go to Solution.
11-01-2020 09:39 AM
I'm not quite sure I understand your dilemma, but maybe it is related to having one "pure" button ("Start", that does "one thing") and one "mixed" button ("Start Inverse", that needs to ??temporarily?? change X and then "Start", without it being clear, to me, what happens with the X value after you push "Start Inverse").
Maybe you need two buttons, "Start" and "Direction" -- "Start" always "starts" the movement, and "Direction" always moves, say, in the +X direction if False, and in the -X direction if True. This would not involve changing the Cluster at all, just negating its value when being read, depending on the setting of "Direction".
Bob Schor
11-01-2020 10:55 AM
Is this what you're looking for?
11-01-2020 03:28 PM
@bob:
The scheme of the buttons isnt that concrete to me really. It can be 1 button or 2, as long as it function as a button and no as a drop down list (enum).
The function takes the inputs (x,y,vel,rep) and make a certain movment. Id like to have a button that changes the values of only 1 num control in each row in the array - the X value.
Lets say we use your idea of a direction button. When the direction is pointed to 'inverse' all X values should be changed to opposite sign values (multiply by -1) and the new array (the old one with the described modification) should be sent to the function "Move Rel".
@paul:
It seems to me that you understood what i meant and possibly showed me the way, but with no labels and VI i dont understand what you did there. Can you explain?
11-01-2020 04:10 PM
@Aqua- wrote:
@paul:
It seems to me that you understood what i meant and possibly showed me the way, but with no labels and VI i dont understand what you did there. Can you explain?
In your cluster be sure that the controls/indicators HAVE UNIQUE Labels; if they have no labels then label them. Then use bundle/unbundle by name to access/change particular elements. Those functions are on the Cluster, Class, and Variant palette.
mcduff
11-02-2020 07:00 AM
@Aqua- wrote:
@bob:
The scheme of the buttons isnt that concrete to me really. It can be 1 button or 2, as long as it function as a button and no as a drop down list (enum).
The function takes the inputs (x,y,vel,rep) and make a certain movment. Id like to have a button that changes the values of only 1 num control in each row in the array - the X value.
Lets say we use your idea of a direction button. When the direction is pointed to 'inverse' all X values should be changed to opposite sign values (multiply by -1) and the new array (the old one with the described modification) should be sent to the function "Move Rel".
@paul:
It seems to me that you understood what i meant and possibly showed me the way, but with no labels and VI i dont understand what you did there. Can you explain?
The cluster constant was created from your array of clusters. "Bundle By Name" replaces the value of "X rel dist" with "X Factor". The "Multiply" function multiplies every element of the array by the cluster coming out of "Bundle By Name".
11-03-2020 10:28 AM - edited 11-03-2020 10:35 AM
Hi paul, thanks for replying again.
i till dont understand what you did there.
you've created a constant cluster that simulate my cluster within the array and set each numeric constant to 1. why? what's the purpose of it?
then you connected the numeric control to the "bundle by name" and sent it to multiply the array.
i dont quite get the flow of the code, can you elaborate?
I do get that you are creating a factor cluster and, change the x value, then want to multiply each control of the factor cluster with the respective controller in the the original 'input cluster', however i dont get why the x factor is a controller rather than a constant (with a case structure -> direction=inverse -> -1 etc...
and finally i dont get how you multiply the output cluster with the array of clusters. in my code it shoots an error since i try to connect an array of clusters to a cluster
11-04-2020 08:48 AM
@Aqua- wrote:
Hi paul, thanks for replying again.
i till dont understand what you did there.
you've created a constant cluster that simulate my cluster within the array and set each numeric constant to 1. why? what's the purpose of it?
then you connected the numeric control to the "bundle by name" and sent it to multiply the array.
i dont quite get the flow of the code, can you elaborate?
I do get that you are creating a factor cluster and, change the x value, then want to multiply each control of the factor cluster with the respective controller in the the original 'input cluster', however i dont get why the x factor is a controller rather than a constant (with a case structure -> direction=inverse -> -1 etc...
and finally i dont get how you multiply the output cluster with the array of clusters. in my code it shoots an error since i try to connect an array of clusters to a cluster
The values in the constant are set to 1 because, when multiplied, you don't want to alter "Y rel dist", "velocity", or "repetition", The '1' for "X rel dist" is irrelevant because it gets replaced.
The "Bundle By Name" replaces the value of "X rel dist" with the value from the control "X Factor". I made "X Factor" a control because I have no idea where you will be getting the factor. Wire the "X rel dist" input of "Bundle By Name" to whatever you like.
When you multiply an array by a scalar, every element of the array is multiplied by the scalar. If you're getting an error, it must be that you have a a type mismatch. Hover your wiring tool over the broken wire to see the details.
11-09-2020 10:42 AM
Hi,
im almost sure i got it right, however i realized that a 3 state button is the best option to handle the data in terms of code and UI.
i have created a slider with 3 states - Inverse movement (as you told me), normal movement, and static.
I am quite sure it works properly (will test tomorrow), but now my problem is that it does not work like a button in the sense that it wont return to default state (static) after execution.
Any idea how to do it?
i tried the INVOKE NODE --> reinitialize to default option, but i cant quite understand how to use it.
I have checked the net and most of the solutions referring to reinitialize the entire vi.
with that solved i think we're done 😆
Thanks for helping
11-09-2020 01:37 PM
Hi Aqua,
@Aqua- wrote:i tried the INVOKE NODE --> reinitialize to default option, but i cant quite understand how to use it.
I have checked the net and most of the solutions referring to reinitialize the entire vi.
Write "static" into a local variable of that slider after processing the inverse/normal request…