mirror of
https://github.com/brendanhaines/RasPi.git
synced 2024-11-09 16:44:40 -07:00
adds *.class to .gitignore
This commit is contained in:
parent
aa779639ad
commit
ad72a19c36
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.class
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -137,6 +137,10 @@ class ConnectionPanel extends JPanel implements ActionListener {
|
||||||
for( int i = 0; i < contentOut.controlValues.length; i++ )
|
for( int i = 0; i < contentOut.controlValues.length; i++ )
|
||||||
out.print( "C" + i + "_" + contentOut.controlValues[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();
|
out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,18 +152,43 @@ class ConnectionPanel extends JPanel implements ActionListener {
|
||||||
if( in.ready() ) {
|
if( in.ready() ) {
|
||||||
String messageIn = in.readLine();
|
String messageIn = in.readLine();
|
||||||
Scanner temp = new Scanner( messageIn );
|
Scanner temp = new Scanner( messageIn );
|
||||||
|
boolean motorsEnabled = false;
|
||||||
|
|
||||||
|
contentIn.motorTesting = false;
|
||||||
|
contentIn.controls = false;
|
||||||
|
contentIn.orientation = false;
|
||||||
|
|
||||||
while( temp.hasNext() ) {
|
while( temp.hasNext() ) {
|
||||||
String next = temp.next();
|
String next = temp.next();
|
||||||
if( next.indexOf( "H" ) == 0 ) System.out.print( "\nH" );
|
if( next.indexOf( "H" ) == 0 ) {
|
||||||
System.out.print( next );
|
System.out.print( "\nH " );
|
||||||
if( next.indexOf( "M" ) > 0 ) {
|
}
|
||||||
Scanner motorScan = new Scanner( next );
|
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 ) {}
|
catch( IOException ex ) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Display3d extends JPanel implements ActionListener, ChangeListener {
|
||||||
|
|
||||||
private JSlider slider;
|
private JSlider slider;
|
||||||
private MessageContent source = new MessageContent();
|
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
|
* no-args constructor
|
||||||
|
@ -60,12 +60,23 @@ class Display3d extends JPanel implements ActionListener, ChangeListener {
|
||||||
g.setColor( Color.GREEN );
|
g.setColor( Color.GREEN );
|
||||||
//g.drawLine( centerX, centerY, X, Y );
|
//g.drawLine( centerX, centerY, X, Y );
|
||||||
|
|
||||||
g.setColor( Color.BLACK );
|
g.setColor( Color.LIGHT_GRAY );
|
||||||
g.setFont( normalFont );
|
g.setFont( normalFont );
|
||||||
g.drawString( "w = " + source.orientValues[ 0 ], 10, 35 );
|
|
||||||
g.drawString( "x = " + source.orientValues[ 1 ], 10, 60 );
|
double w = source.orientValues[ 0 ];
|
||||||
g.drawString( "y = " + source.orientValues[ 2 ], 10, 85 );
|
double x = source.orientValues[ 1 ];
|
||||||
g.drawString( "z = " + source.orientValues[ 3 ], 10, 110 );
|
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 {
|
else {
|
||||||
g.setColor( Color.RED );
|
g.setColor( Color.RED );
|
||||||
|
|
26
GroundStation/v2/DisplayController.java
Normal file
26
GroundStation/v2/DisplayController.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,7 +20,7 @@ class EStopWindow extends JFrame implements ActionListener {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public EStopWindow() {
|
public EStopWindow( boolean visible) {
|
||||||
super("Emergency Stop");
|
super("Emergency Stop");
|
||||||
setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
|
setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
|
||||||
setAlwaysOnTop( true );
|
setAlwaysOnTop( true );
|
||||||
|
@ -33,7 +33,14 @@ class EStopWindow extends JFrame implements ActionListener {
|
||||||
|
|
||||||
setEnabled( true );
|
setEnabled( true );
|
||||||
pack();
|
pack();
|
||||||
setVisible( true );
|
setVisible( visible );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public EStopWindow() {
|
||||||
|
this( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@ class GroundStation implements ActionListener {
|
||||||
/** main window to hold everything */
|
/** main window to hold everything */
|
||||||
private JFrame mainWindow;
|
private JFrame mainWindow;
|
||||||
/** window to hold emergency stop button */
|
/** window to hold emergency stop button */
|
||||||
private EStopWindow eStopWindow;
|
private EStopWindow eStopWindow = new EStopWindow( false );
|
||||||
|
|
||||||
/** connection options section of window */
|
/** connection options section of window */
|
||||||
private ConnectionPanel connectPanel;
|
private ConnectionPanel connectPanel;
|
||||||
|
@ -52,6 +52,8 @@ class GroundStation implements ActionListener {
|
||||||
|
|
||||||
mainWindow.pack();
|
mainWindow.pack();
|
||||||
mainWindow.setVisible( true );
|
mainWindow.setVisible( true );
|
||||||
|
|
||||||
|
sendContent.orientation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableMotors() {
|
public void disableMotors() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user