jaron.pde
Class ArtificialHorizon

java.lang.Object
  extended by jaron.gui.Panel
      extended by jaron.pde.ArtificialHorizon

public class ArtificialHorizon
extends Panel

The ArtificialHorizon class provides a virtual horizon like device for the Processing Development Environment.
It has two inputs for elevator and aileron deflection and two inputs for pitch and roll angle. It usually gets the values for these inputs by another object or objects through the EventListener mechanism.
Reversing the effective direction for elevator, aileron, pitch and roll is done by swapping the high and the low values of the corresponding signals.

Have a look at the example of the UAVsim for the usage of the ArtificialHorizon.

Since:
1.0
Version:
1.2
Author:
jarontec gmail com

Field Summary
 
Fields inherited from class jaron.gui.Panel
content, frame, labelBottom, labelLeft, labelRight, labelTop
 
Constructor Summary
ArtificialHorizon(processing.core.PApplet applet, int left, int top)
          Creates a new ArtificialHorizon object for the Processing Development Environment (PDE) at a certain position.
ArtificialHorizon(processing.core.PApplet applet, int left, int top, int width, int height)
          Creates a new ArtificialHorizon object for the Processing Development Environment (PDE) at a certain position and with a certain width and height.
 
Method Summary
 void draw()
          Draws the artificial horizon to the screen.
 Signal getAileron()
          Returns a reference to a Signal object containing a value that represents the current deflection of the aileron.
 Signal getElevator()
          Returns a reference to a Signal object containing a value that represents the current deflection of the elevator.
 Signal getPitch()
          Returns a reference to a Signal object containing a value that represents the current pitch angle in degrees (not radians).
 Signal getRoll()
          Returns a reference to a Signal object containing a value that represents the current roll angle in degrees (not radians).
 void setDebug(java.lang.Boolean debug)
          Sets the debugging flag which determines if the debugging informations should be printed to the console.
 void setMaxDeflection(int maxDeflection)
          Sets the maximum deflection that is used for the conversion of the aileron/elevator values into degrees.
 
Methods inherited from class jaron.gui.Panel
getContent, getFrame, getLabelBottom, getLabelLeft, getLabelRight, getLabelTop, setContent, setFrame, setLabelBottomHeight, setLabelLeftWidth, setLabelRightWidth, setLabelTopHeight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArtificialHorizon

public ArtificialHorizon(processing.core.PApplet applet,
                         int left,
                         int top,
                         int width,
                         int height)
Creates a new ArtificialHorizon object for the Processing Development Environment (PDE) at a certain position and with a certain width and height.

Parameters:
applet - a reference to the PDE applet that provides the drawing environment
left - the component's position from the left
top - the component's position from top
height - the component's height
width - the component's width

ArtificialHorizon

public ArtificialHorizon(processing.core.PApplet applet,
                         int left,
                         int top)
Creates a new ArtificialHorizon object for the Processing Development Environment (PDE) at a certain position.

Parameters:
applet - a reference to the PDE applet that provides the drawing environment
left - the component's position from the left
top - the component's position from top
Method Detail

draw

public void draw()
Draws the artificial horizon to the screen. This method should usually be called from the draw method of the Processing Development Environment. This ensures that the horizon is updated periodically.


getAileron

public Signal getAileron()
Returns a reference to a Signal object containing a value that represents the current deflection of the aileron.
The default bandwidth of the signal is +-1 and can be changed through the setHigh and setLow methods of the Signal class.

Returns:
a Signal object containing the current aileron value
See Also:
Signal

getElevator

public Signal getElevator()
Returns a reference to a Signal object containing a value that represents the current deflection of the elevator.
The default bandwidth of the signal is +-1 and can be changed through the setHigh and setLow methods of the Signal class.

Returns:
a Signal object containing the current elevator value
See Also:
Signal

getPitch

public Signal getPitch()
Returns a reference to a Signal object containing a value that represents the current pitch angle in degrees (not radians).

Returns:
a Signal object containing the current pitch angle
See Also:
Signal

getRoll

public Signal getRoll()
Returns a reference to a Signal object containing a value that represents the current roll angle in degrees (not radians).

Returns:
a Signal object containing the current roll angle
See Also:
Signal

setDebug

public void setDebug(java.lang.Boolean debug)
Sets the debugging flag which determines if the debugging informations should be printed to the console. This is for debugging purpose only.

Parameters:
debug - set to true if additional debugging information should be printed

setMaxDeflection

public void setMaxDeflection(int maxDeflection)
Sets the maximum deflection that is used for the conversion of the aileron/elevator values into degrees. The default value is 120 degrees for full left to full right deflection.

Parameters:
maxDeflection - maximum deflection in degrees