LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM with Real-Time-Application

Hi,

 

My program uses servomotors that I control using the PWM pins on the NI MyRIO 1950.

Everything works perfectly if I run it from labview. But I want to make a real-time-application so that the program runs on startup of the MyRIO.

After have done that everything works good, except for the servomotors. They won't move whatsoever.

I debugged the program using the LED's, and it opens all the subVI's in the main VI just fine. I added the main VI below.

Is there something that's different about PWM signals when using a RTA?

0 Kudos
Message 1 of 4
(3,137 Views)

Hello Rofid,

well, generally speaking your VIs should be able to output signals when running on the RT all alone the same way as when running interactively from LabVIEW.

 

Unfortunately you posted only a screenshot of one of your VIs and not the whole project. This makes it almost impossible to help you, as all the interesting parts of your code are hidden.

 

I can just take "educated guesses" on what is going wrong:

- From what I understand you want to use your myRIO headless. However I see some Front-Panel objects in your code. This will definitely create some issues. (Also have a look here: Interacting with the Front Panels of RT Target VIs (Real-Time Module))

- What are the Default Values of your Buttons on the Front Panel?

- Do you do some kind of error handling or logging in your code? I can't see any. Maybe there is an error raised on the RT that you are not aware of.

 

If none of these apply / help with your issue, please attach your full project (if there is any code in it you don't want to publicly share on this forum, please remove it and create a minimal version of your code that still shows the unexpected behavior).


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 2 of 4
(3,082 Views)

Hi,

 

Sorry for the long delay! I adapted the VI I'm having trouble with, purely taking input from a joystick and converting that signal to a PWM signal, and outputting that to two servo's. And I just checked and I'm running into the same problem, works fine if I run the program from the laptop, but making a RTA won't work.

 

I'm not running any error management, because I never needed it, even if I disconnect the USB it can run fine for hours on end. Is it mandatory for a RTA? The buttons on the front panel are purely for testing. Or settings for example a PID controller. Does labview automatically save those settings to the MyRIO or should I do that via constants instead of sliders?

 

Thanks for helping me! I'm at my wits end at the moment.

 

0 Kudos
Message 3 of 4
(3,054 Views)

Hi Rofid,

 

sorry for the long delay as well, I was on holiday and therefore 100% offline.

Thank you for attaching the VI! Is it part of a project? I was not able to test it here as I don't know the "myRIO personality settings" you are using. Would you be able to attach all files needed with the project (probably not much more than the .lvproj and the vi, just put them into a zip file)?

 

About the "Settings Servo" front panel cluster: Using a constant here instead would be the best. I noticed that you did not change the default values, they are all zero. You can change them by putting the value you want into the control and then "Right Click » Data Operations » Make Current Value Default". However, as you are not using the "Max angle" value in you code and the offset is just an offset, this should not be the cause for your trouble.

 

No, error management is not mandatory, but highly recommended for RT and non-RT. In non-RT "Automatic Error Handling" can be a fall-back solution during development, however definitely not recommended for software used by an end-user.

 

I am not sure if we are talking about the same VI. You mentioned buttons and sliders in your posting. However, I only see (one) stop button and no sliders. Maybe you are referring to the Numeric Controls with the Increment/Decrement buttons as sliders. Please let me know if this different wording usage is the reason for my confusion or if you were talking about naother (older?) version of your vi.

 

I also noticed there is no closing / resetting of the myRIO target. So we don't know what state your hardware is in when you try executing the code. Have a look at one of the myRIO examples (Help » Find Examples...), e.g. the one called "Edge Detection and Debouncing". You find it in the Example Finder at "Task » Toolkits and Modules » myRIO » Edge Detection and Debouncing.lvproj". There is a "Reset myRIO.vi" at the top right of the code. Feel free to use this as well (and also use the error handling as it is done here):

LabVIEW_2018-05-22_10-51-15.png


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 4 of 4
(3,041 Views)