LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Servo Motor VI 5001 error

Hello,

 

I am getting a 5001 error for this labview Vi I have created and I can't figure out why. The three loops are for a load cell (top), servo motor (middle) and MPU-6050. I am trying to get a three running at the same time but keep getting this error. Another thing I am trying to do in relate the reading of the load to stop the whole program if it reaches 110 or -110 for safety in both the Static and Dynamic VI's.

 

The other part to this is trying to maintain a specific  torque throughout the move in the Dynamic VI and I am unsure how to do this with Linx. Help will be appreciated.

 

Kind Regards,

ARD

Download All
0 Kudos
Message 1 of 15
(4,445 Views)

Regarding the "Static" VI:

  • You can use an array of pulse width values and an autoindexing For loop to drastically reduce the width of the middle loop. All of the other settings are the same, so you only need to write them once (and just index the changing value from the array you create)
  • You can use the In Range and Coerce function to check if a value is in between two limits (you don't need the coerced output, just the boolean)
  • Your Stop button won't work for any of the loops because the loops will only start after the button has been read (this is dataflow!). The stop button must be inside a loop to be checked each iteration to be able to stop the loop. Either use multiple stop buttons, use local variables (this gets more ugly because you can't use a latching control) or look at something like a series of Event Driven State Machines.

The same applies to your "Dynamic" VI, but in that case the top loop will stop if there isn't an error (you have "continue if true" instead of "stop if true"). Since the stop button is wired through the top loop and then to the middle loop, the middle and bottom loops will wait for the top loop to finish before they start (dataflow again).


GCentral
0 Kudos
Message 2 of 15
(4,412 Views)

Thank you for the help. The part I am unsure of is the for loop with the array I looked it but but would I have the array with just the index display as 0 with 10 numbers descending vertically on the right of it? and connect this to a for loop. I tried this but the pulse width input of the servo linx will not accept it.

0 Kudos
Message 3 of 15
(4,370 Views)

This is my new Vi I know the gyroscope and load cell are running at the same time and the servo however the event structure is not moving to the next position. I am unsure how to correctly use the array for the position while folding the position for 30 seconds.

 

 

0 Kudos
Message 4 of 15
(4,355 Views)

This is what I meant regarding the loop:

loopExampe.png

 

I can't download the attachment - some sort of header problem. Perhaps the filename is causing a problem, perhaps it's my browser. I'll try again later in case it's the forums, but you might try uploading a file without a comma or other "unusual" characters. Edit: A StackOverflow post suggests commas in filenames might cause this problem: https://stackoverflow.com/questions/13578428/duplicate-headers-received-from-server


GCentral
0 Kudos
Message 5 of 15
(4,346 Views)

This one should work. Same problem as before gyroscope and load cell are working at the same time and the servo only moves to 0 and doesn't proceed to the next event in the event structure.

0 Kudos
Message 6 of 15
(4,325 Views)

All devices are working in this Vi however I can not get this for the static version of the experiment.

0 Kudos
Message 7 of 15
(4,310 Views)
Spoiler
 

The Vi's are all now working however I am trying to read a EMG sensor at the same time. When I add this block for the analogue read to the VI it flat lines all the other graphs. When I remove it everything works. I am not sure how to recifiy this but I assume it is something to do with the software not reading the pins correctly in some way be it not reading the right pin for the right device. The gyroscope is the only device connect to analogue pins these being 5 and 4 of the Arduino. Help will be appreciated thank you.

0 Kudos
Message 8 of 15
(4,289 Views)

@ARD1996 wrote:

This one should work. Same problem as before gyroscope and load cell are working at the same time and the servo only moves to 0 and doesn't proceed to the next event in the event structure.


Hey, glad to see a few more VIs (I can open all of them).

Regarding the one attached to this post (perhaps you already solved this problem but...) your issue is/was that you have what's almost like a State Machine, but with no transitions.

That is, your Case Structure wires the "current case" to the output, and then it will always stay in the same case. You could change it to output the "next case" inside the case structure, but since you're only changing a single value, the system I showed earlier will be easier. Take another look and do the following:

  1. Add a For Loop around the Servo Set Pulse Width.
  2. Move the "1000" in the first, default case, outside of the loop. It should appear with a solid blue box on the edge of the loop.
  3. Right click on the constant, and choose "Change to Array". You may then want to resize the constant, because probably it will be very narrow and impossible to read.
  4. Drag down the array constant, and fill in each of the values you wanted (in what were previously cases "Angle 1" through "Angle 10".
  5. Right click on the tunnel (box at the edge of the For loop) and "Enable Indexing".
  6. Remove the Case Structure (by right clicking on its edge and choosing Remove Case Structure - not Remove and Rewire!)

At this point, you probably have something that looks like this (but without the question mark in the subVI!

step1to6.png

Connect the broken pink and yellow (error) wires to the right side and then right click on them and choose Create Shift Register. Your mouse will change - hover over the left side of the same wire type (mouse cursor changes again, now to a kind of black box?) and click. Remove the broken wires that remain and resize the For Loop to make it a bit tidier. You should end up with something like this:

endstate.png

Notice how the bottom element of the visible array is greyed out - this is showing that the last element is the 1000 after the 1500. The final (visible) 1000 is just a default value because of the way I created the array.


GCentral
0 Kudos
Message 9 of 15
(4,272 Views)

@ARD1996 wrote:
Spoiler
 

The Vi's are all now working however I am trying to read a EMG sensor at the same time. When I add this block for the analogue read to the VI it flat lines all the other graphs. When I remove it everything works. I am not sure how to recifiy this but I assume it is something to do with the software not reading the pins correctly in some way be it not reading the right pin for the right device. The gyroscope is the only device connect to analogue pins these being 5 and 4 of the Arduino. Help will be appreciated thank you.


Regarding this post and the previous one, I'm not exactly sure what the problem you're describing is. I tried downloading a copy of Loop Frequency.vi from the LINX GitHub page and it gave me something with "Non-Reentrant" execution properties. I don't know if this is a problem with the download method, since I may have read something about that somewhere, but in general it shouldn't be.

That leads me to wonder if the problem is caused by having two copies of Loop Frequency in your VI called at the same time - this can't work, and so you'll get them with one blocking the other. If something else in the loops blocks, you might not be able to get anything out.

I want to point out that you have only one loop - the Flat Sequence Structures aren't doing anything at all beyond grouping functionality visually (which you could also use the Decorations palette under Structures for).

I suspect you have some VIs blocking one another in your loop, but I don't know which ones or where. Try removing one copy of the Loop Frequency and see if it works then.


GCentral
0 Kudos
Message 10 of 15
(4,268 Views)