本文整理汇总了Java中krpc.client.Connection类的典型用法代码示例。如果您正苦于以下问题:Java Connection类的具体用法?Java Connection怎么用?Java Connection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Connection类属于krpc.client包,在下文中一共展示了Connection类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import krpc.client.Connection; //导入依赖的package包/类
/**
* The default way to start the program
* @param args args
*/
public static void main(String[] args) {
DATA_SETTINGS settings = new DATA_SETTINGS();
initializeLogger(settings);
Connection connection;
try {
connection = Connection.newInstance(settings.getName(), settings.getHostname(), settings.getRPC_Port(),
settings.getStream_Port());
SpaceCenter spaceCenter = SpaceCenter.newInstance(connection);
Vessel vessel = spaceCenter.getActiveVessel();
GUIDANCEUNIT guidanceunit = new GUIDANCEUNIT(settings, connection, spaceCenter, vessel);
guidanceunit.run();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOGGER.logger.log(Level.SEVERE, "Fatal Error in main", e);
}
LOGGER.logger.severe("Autopilot will now shutdown");
System.exit(0);
}
示例2: STAGE_NORMAL
import krpc.client.Connection; //导入依赖的package包/类
public STAGE_NORMAL(Connection nconnection, int ID, Vessel nvessel) throws AGuSDataException {
this.connection = nconnection;
this.vessel = nvessel;
this.id = ID;
// if this is the last stage or not
if (getId() > 0) {
this.nextStage = new STAGE_NORMAL(connection, getId() - 1, vessel);
} else {
this.nextStage = new STAGE_END(vessel);
}
this.allParts = checkAllParts();
this.mass = calcMass();
this.activeEngines = checkActiveEngines();
this.neededPropellant = checkNeededPropellant();
this.mf = calcMassAfterBurn();
this.SRBs = checkSRBs();
this.mfsrb = calcMassAfterSRBs();
this.isp = calcSpecificImpulse();
this.deltaV = calcDeltaV();
this.ispSRB = calcSpecificImpulseofSRBs();
this.deltaVSRB = calcDeltaVofSRBs();
this.decoupledParts = checkDecoupledParts();
this.activatedParts = checkActivatedParts();
this.availabeThrust = calcAvailableThrust();
this.burnTime = calcBurnTime();
}
示例3: SURFACE_TO_SPACE_ATMO
import krpc.client.Connection; //导入依赖的package包/类
/**
*
* @param Connection
* connection
* @param SpaceCenter
* spaceCenter
* @param Vessel
* the vessel
* @param Inclination
* the desired inclination of the orbit after launch in rad
* @throws AGuSDataException
*/
public SURFACE_TO_SPACE_ATMO(Connection Connection, SpaceCenter SpaceCenter, Vessel Vessel, BODIES Bodies,
float Inclination) throws AGuSDataException {
this.connection = Connection;
this.spaceCenter = SpaceCenter;
this.krpcVessel = Vessel;
this.inclination = Inclination;
this.bodies = Bodies;
CelestialBody body;
try {
body = Vessel.getOrbit().getBody();
this.parkingOrbit = (float) FORMULA_TRANSFER.ParkingOrbit(body.getEquatorialRadius(),
body.getAtmosphereDepth(), body.getSurfaceGravity());
} catch (RPCException | IOException e) {
e.printStackTrace();
LOGGER.logger.log(Level.SEVERE, "", e);
throw new AGuSDataException(e);
}
}
示例4: GUIDANCEUNIT
import krpc.client.Connection; //导入依赖的package包/类
public GUIDANCEUNIT(DATA_SETTINGS data_SETTINGS, Connection connection, SpaceCenter spaceCenter,
Vessel krpcVessel) throws AGuSDataException {
// TODO Auto-generated constructor stub
if (connection == null || spaceCenter == null || krpcVessel == null) {
if (connection == null) {
LOGGER.logger.log(Level.SEVERE, "Exiting Programm", new IllegalArgumentException("connection == null"));
}
if (spaceCenter == null) {
LOGGER.logger.log(Level.SEVERE, "Exiting Programm",
new IllegalArgumentException("spaceCenter == null"));
}
if (krpcVessel == null) {
LOGGER.logger.log(Level.SEVERE, "Exiting Programm", new IllegalArgumentException("vessel == null"));
}
throw new IllegalArgumentException();
} else {
this.connection = connection;
this.sCenter = spaceCenter;
this.vessel = new VESSEL(connection, sCenter, krpcVessel);
this.settings = data_SETTINGS;
this.bodies = new BODIES(spaceCenter);
this.mission = new DATA_MISSION(spaceCenter, bodies);
//GUIDANCEUNIT.spaceCenter=sCenter;
}
}
示例5: VESSEL
import krpc.client.Connection; //导入依赖的package包/类
public VESSEL(Connection Connection, SpaceCenter SpaceCenter, Vessel Vessel) throws AGuSDataException {
this.connection = Connection;
this.vessel = Vessel;
this.spaceCenter = SpaceCenter;
this.stage = new STAGE_FIRST(connection, vessel);
this.staging = new STAGING(spaceCenter, vessel, stage);
this.parts = new PARTS(this);
}
示例6: STAGE_FIRST
import krpc.client.Connection; //导入依赖的package包/类
public STAGE_FIRST(Connection nconnection, Vessel Vessel) throws AGuSDataException {
LOGGER.logger.info("created first stage");
this.connection = nconnection;
this.vessel = Vessel;
try {
this.id = vessel.getControl().getCurrentStage();
} catch (RPCException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOGGER.logger.log(Level.SEVERE, "", e);
throw new AGuSDataException(e);
}
this.nextStage = new STAGE_NORMAL(connection, getId() - 1, vessel);
}
示例7: actionPerformed
import krpc.client.Connection; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
Object src = e.getSource();
if(src == button_launch)
{
if(hasOnlyNumbers(text_ap.getText()))
{
int h = Integer.parseInt(text_ap.getText());
h = Math.min(Math.max(30000, h), 170000);
try {
Main.connection = Connection.newInstance();
} catch (IOException e1) {
e1.printStackTrace();
}
if(Main.connection != null)
{
remove(button_launch);
remove(text_ap);
getGraphics().clearRect(0, 0, getWidth(), getHeight());
pilot.ascent_apoapsis = h;
cc.start();
setPreferredSize(new Dimension(telemetry_box_width + log_box.width, log_box.height));
pack();
add(button_abort);
paintReady = true;
repaint();
}
else
{
panel.paint_arg = MyPanel.PAINT_ARG_CONNECTION_RED;
repaint();
}
}
}
else if(src == button_abort)
{
pilot.setBoosterProgram(JPilot.BOOSTER_PROGRAM_ABORT);
}
}
示例8: EXECUTION_SPACESHIP
import krpc.client.Connection; //导入依赖的package包/类
/**
*
* @param SpaceCenter
* the space center object
* @param Vessel
* the vessel
* @param FinalOrbit
* the final orbit that should be reached
* @param MaxErrorInOrbit
* the max error in orbit. 0.1 for an maximum 10% change
* @param MaxPhysicsWarp
* The max physics warp from 1 to 4
*/
public EXECUTION_SPACESHIP(Connection Connection, SpaceCenter SpaceCenter, VESSEL Vessel, BODIES Bodies,
DATA_MISSION data_MISSION, int MaxPhysicsWarp) {
this.mission = data_MISSION;
this.connection = Connection;
this.spaceCenter = SpaceCenter;
this.vessel = Vessel;
this.bodies = Bodies;
this.maxErrorInOrbit = mission.getMaxError();
this.finalOrbit = mission.getFinalOrbit();
this.maxPhysicsWarp = MaxPhysicsWarp;
}