View Single Post
  #2   Spotlight this post!  
Unread 20-02-2011, 01:22
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,050
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: paper: LabVIEW Mecanum Programming


Nice presentation. This should prove helpful to teams just getting started with LabVIEW and mecanum.

There's a small error on Page 19 which may lead some astray:

Quote:
Wouldn't it be convienient to--on the push of a button--rotate to the direction you're traveling?
▪To calculate this angle, do Math.atan2(Joystick X, -Joystick Y)
▪Implement a PID loop--the setpoint is the joystick angle, and the process variable is the gyro angle
The above won't work very well. The joystick angle will be -180..+180, and the gyro angle will be 0..360+

You can't just pass the joystick angle and gyro angle to the PID as-is. The PID will not like that at all.

For example, if the joystick angle is -1 degree and the gyro is reading +359 degrees, the PID will calculate (and act upon) an error of -1-359 = -360 degrees... even though the vehicle is already pointing in the desired direction.

To use the LabVIEW PID in this situation, you need to do something like this:

Code:
angle_error = joystick_angle - gyro_angle;
angle_error -= 360*floor(0.5+angle_error/360);
setpoint = gyro_angle + angle_error;
process_variable = gyro_angle;

Example LabVIEW code for the second line in the code block above can be found here.





Last edited by Ether : 20-02-2011 at 02:05.
Reply With Quote