-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from NeuronRobotics/development
Release for Make Faire NYC
- Loading branch information
Showing
87 changed files
with
4,867 additions
and
1,980 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
javasdk/NRSDK/addons/com/neuronrobotics/addons/driving/SimpleDisplay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.neuronrobotics.addons.driving; | ||
|
||
import java.awt.Color; | ||
import java.awt.color.CMMException; | ||
import java.util.ArrayList; | ||
|
||
import javax.swing.JFrame; | ||
|
||
import com.neuronrobotics.addons.driving.virtual.ObsticleType; | ||
import com.neuronrobotics.sdk.ui.ConnectionImageIconFactory; | ||
|
||
public class SimpleDisplay extends NrMap { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = -7042174918507023465L; | ||
private JFrame frame = new JFrame(); | ||
public SimpleDisplay(){ | ||
getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
setBackground(Color.black); | ||
getFrame().add(this); | ||
getFrame().setSize((int)width+200,(int)height+200); | ||
getFrame().setLocationRelativeTo(null); | ||
getFrame().setVisible(true); | ||
getFrame().setIconImage( ConnectionImageIconFactory.getIcon("images/hat.png").getImage()); | ||
|
||
} | ||
public JFrame getFrame() { | ||
return frame; | ||
} | ||
public void setFrame(JFrame frame) { | ||
this.frame = frame; | ||
} | ||
public void setData(ArrayList<DataPoint> data) { | ||
//removeAllUserDefinedObsticles(); | ||
for(DataPoint d:data){ | ||
double pix = getCmToPixel(d.getRange()/100); | ||
double centerX=(width/2); | ||
double centerY=(height/2); | ||
if(!(pix>centerX || pix>centerY )){ | ||
double deltX = pix*Math.cos(Math.toRadians(d.getAngle())); | ||
double deltY = pix*Math.sin(Math.toRadians(d.getAngle())); | ||
addUserDefinedObsticle((int)(centerX+deltX), (int)(centerY+deltY), 2,ObsticleType.USERDEFINED); | ||
}else{ | ||
//System.out.println("Range too long: "+pix+" cm="+d.getRange()/100); | ||
} | ||
} | ||
updateMap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.