|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: LabVIEW PID for angles
Quote:
It seems that the specific application you have in mind assumes motor control of a mechanism capable of continuous rotation and negligible time for changing direction. That's not the only kind of mechanism one might want to control based on angle. Since each application is going to have its own requirements, a built-in function would have to have a lot of options, and it still might not accommodate some needs. I think you're trying to ask whether there is a built-in function that combines PID with the specific way you want angular errors to be computed. You're the one who knows how you want it to work, so I don't think it's any great burden to have you implement that part of it yourself. |
|
#2
|
|||
|
|||
|
Re: LabVIEW PID for angles
Just to confirm, no. If there are special conditions with the input or output of the PID, you add those to the front or back.
By the way, the integer divide is the LV way to do modulo math. Greg McKaskle |
|
#3
|
||||
|
||||
|
Re: LabVIEW PID for angles
OK, thanks Greg.
Quote:
|
|
#4
|
||||
|
||||
|
Re: LabVIEW PID for angles
Quote:
Code:
angle_error = joystick_command - gyro_angle; angle_error -= 360*floor(0.5+angle_error/360); setpoint = gyro_angle + angle_error; If your compiler supports the REMAINDER function "x REM y" per IEC 60559 (mine does not so I have not tested this) as specified on Page 235 Section 7.12.10.2 of ISO/IEC 9899:TC3, then I believe the following should work: Code:
angle_error = remainder(angle_error,360); The above can be done in LabVIEW as shown in either of the two attached screenshots. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|