adds *.class to .gitignore

This commit is contained in:
Brendan Haines 2015-03-02 14:45:13 -07:00
parent aa779639ad
commit ad72a19c36
11 changed files with 92 additions and 16 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.class

Binary file not shown.

Binary file not shown.

View File

@ -137,6 +137,10 @@ class ConnectionPanel extends JPanel implements ActionListener {
for( int i = 0; i < contentOut.controlValues.length; i++ )
out.print( "C" + i + "_" + contentOut.controlValues[i] + " " );
}
if( contentOut.orientation ) {
for( int i = 0; i < contentOut.orientValues.length; i++ )
out.print( "O" + i + "_" + contentOut.orientValues[i] + " " );
}
out.println();
}
@ -148,18 +152,43 @@ class ConnectionPanel extends JPanel implements ActionListener {
if( in.ready() ) {
String messageIn = in.readLine();
Scanner temp = new Scanner( messageIn );
boolean motorsEnabled = false;
contentIn.motorTesting = false;
contentIn.controls = false;
contentIn.orientation = false;
while( temp.hasNext() ) {
String next = temp.next();
if( next.indexOf( "H" ) == 0 ) System.out.print( "\nH" );
System.out.print( next );
if( next.indexOf( "M" ) > 0 ) {
Scanner motorScan = new Scanner( next );
if( next.indexOf( "H" ) == 0 ) {
System.out.print( "\nH " );
}
else if( next.indexOf( "E" ) == 0 ) {
motorsEnabled = true;
System.out.print( "E " );
}
else if( next.indexOf( "M" ) == 0 ) {
contentIn.motorTesting = true;
//int motorNum = Integer.parseInt( next.substring( 1 ) );
//int motorVal = Integer.parseInt( next.substring( 3, next.length() ) );
//contentIn.motorValues[ motorNum ] = motorVal;
System.out.print( "M " );
}
else if( next.indexOf( "C" ) == 0 ) {
contentIn.controls = true;
//int controlNum = Integer.parseInt( next.substring( 1 ) );
//int controlVal = Integer.parseInt( next.substring( 3, next.length() ) );
//contentIn.controlValues[ controlNum ] = controlVal;
System.out.print( "C " );
}
else if( next.indexOf( "O" ) == 0 ) {
contentIn.orientation = true;
System.out.print( "O " );
}
}
contentIn.setMotorsEnabled( motorsEnabled );
contentIn.fireActionPerformed( new ActionEvent(contentIn, ActionEvent.ACTION_PERFORMED, "" ) );
}
contentIn.orientation = true;
contentIn.fireActionPerformed( new ActionEvent(contentIn, ActionEvent.ACTION_PERFORMED, "" ) );
}
catch( IOException ex ) {}
}

View File

@ -10,7 +10,7 @@ class Display3d extends JPanel implements ActionListener, ChangeListener {
private JSlider slider;
private MessageContent source = new MessageContent();
private Font normalFont = new Font( "Normal", Font.PLAIN, 15 );
private Font normalFont = new Font( "Normal", Font.BOLD, 15 );
/**
* no-args constructor
@ -60,12 +60,23 @@ class Display3d extends JPanel implements ActionListener, ChangeListener {
g.setColor( Color.GREEN );
//g.drawLine( centerX, centerY, X, Y );
g.setColor( Color.BLACK );
g.setColor( Color.LIGHT_GRAY );
g.setFont( normalFont );
g.drawString( "w = " + source.orientValues[ 0 ], 10, 35 );
g.drawString( "x = " + source.orientValues[ 1 ], 10, 60 );
g.drawString( "y = " + source.orientValues[ 2 ], 10, 85 );
g.drawString( "z = " + source.orientValues[ 3 ], 10, 110 );
double w = source.orientValues[ 0 ];
double x = source.orientValues[ 1 ];
double y = source.orientValues[ 2 ];
double z = source.orientValues[ 3 ];
g.drawString( "w = " + w, 11, 35 );
g.drawString( "x = " + x, 15, 50 );
g.drawString( "y = " + y, 15, 65 );
g.drawString( "z = " + z, 15, 80 );
double[] gravity = { 2 * ( x*z - w*y ), 2 * ( w*x + y*z ), w*w - x*x - y*y + z*z };
g.drawString( "Pitch: " + Math.toRadians( Math.atan( x / Math.sqrt( y*y + z*z ) ) ), 15, 100 );
g.drawString( "Roll: " + Math.toRadians( Math.atan( y / Math.sqrt( x*x + z*z ) ) ), 15, 115 );
}
else {
g.setColor( Color.RED );

View File

@ -0,0 +1,26 @@
import javax.swing.*;
import java.awt.event.*;
class DisplayController.java extends JPanel implements ActionListener {
private MessageContent source = new MessageContent();
public DisplayController() {
setBackground( Color.DARK_GRAY );
setPerferredSize( new Dimension( 0, 100 ) );
}
public void paintComponent( Graphics g ) {
super.paintComponent( g );
g.setColor( Color.LIGHT_GRAY );
}
/**
*
*/
public void actionPerformed( ActionEvent evt ) {
redraw();
}
}

View File

@ -20,7 +20,7 @@ class EStopWindow extends JFrame implements ActionListener {
/**
*
*/
public EStopWindow() {
public EStopWindow( boolean visible) {
super("Emergency Stop");
setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
setAlwaysOnTop( true );
@ -33,7 +33,14 @@ class EStopWindow extends JFrame implements ActionListener {
setEnabled( true );
pack();
setVisible( true );
setVisible( visible );
}
/**
*
*/
public EStopWindow() {
this( true );
}
/**

View File

@ -11,7 +11,7 @@ class GroundStation implements ActionListener {
/** main window to hold everything */
private JFrame mainWindow;
/** window to hold emergency stop button */
private EStopWindow eStopWindow;
private EStopWindow eStopWindow = new EStopWindow( false );
/** connection options section of window */
private ConnectionPanel connectPanel;
@ -52,6 +52,8 @@ class GroundStation implements ActionListener {
mainWindow.pack();
mainWindow.setVisible( true );
sendContent.orientation = true;
}
public void disableMotors() {