From 9f20a3540e5ec5d967225db0df9abef56cb76eb1 Mon Sep 17 00:00:00 2001 From: Jmcrobbie Date: Mon, 24 Sep 2018 21:32:29 +1000 Subject: [PATCH] Hot-fix working in vts --- .../src/main/java/msp/simulator/Main.java | 4 +-- .../logs/ephemeris/EphemerisGenerator.java | 27 ++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/simulator/src/main/java/msp/simulator/Main.java b/simulator/src/main/java/msp/simulator/Main.java index baf1b10f..2c896b1a 100644 --- a/simulator/src/main/java/msp/simulator/Main.java +++ b/simulator/src/main/java/msp/simulator/Main.java @@ -48,8 +48,8 @@ public static void main(String[] args) { Dashboard.setInitialRotAcceleration(new Vector3D(0,0,0)); Dashboard.setTorqueDisturbances(true); - Dashboard.setCommandTorqueProvider(TorqueProviderEnum.MEMCACHED); - Dashboard.setMemCachedConnection(true, "127.0.0.1:11211"); + //Dashboard.setCommandTorqueProvider(TorqueProviderEnum.MEMCACHED); + //Dashboard.setMemCachedConnection(false, "127.0.0.1:11211"); Dashboard.setVtsConnection(false); diff --git a/simulator/src/main/java/msp/simulator/utils/logs/ephemeris/EphemerisGenerator.java b/simulator/src/main/java/msp/simulator/utils/logs/ephemeris/EphemerisGenerator.java index bc7cbf03..949ed6f6 100644 --- a/simulator/src/main/java/msp/simulator/utils/logs/ephemeris/EphemerisGenerator.java +++ b/simulator/src/main/java/msp/simulator/utils/logs/ephemeris/EphemerisGenerator.java @@ -276,17 +276,22 @@ public void writeStep(Satellite satellite) { double torqueX = ang_accel.getX()/satellite.getAssembly().getBody().getInertiaMatrix()[0][0]; double torqueY = ang_accel.getY()/satellite.getAssembly().getBody().getInertiaMatrix()[1][1]; double torqueZ = ang_accel.getZ()/satellite.getAssembly().getBody().getInertiaMatrix()[2][2]; - + Vector3D torque = new Vector3D(torqueX,torqueY,torqueZ); + if (torque.getNorm() != 0) { + torque = torque.normalize(); + } buff .append(days) .append(" ") /* Column Separator */ .append(seconds) .append(" ") - .append(torqueX) + .append(torque.getX()) + .append(" ") + .append(torque.getY()) .append(" ") - .append(torqueY) + .append(torque.getZ()) .append(" ") - .append(torqueZ) + .append(0) ; this.writerAEM_torque.append(buff+LS); this.writerAEM_torque.flush(); @@ -295,6 +300,10 @@ public void writeStep(Satellite satellite) { /** Writing to the angular velocity file */ Vector3D vel = satellite.getStates().getCurrentState().getAttitude().getSpin(); + vel.normalize(); + if (vel.getNorm() != 0) { + vel = vel.normalize(); + } buff .append(days) .append(" ") /* Column Separator */ @@ -305,6 +314,8 @@ public void writeStep(Satellite satellite) { .append(vel.getY()) .append(" ") .append(vel.getZ()) + .append(" ") + .append(0) ; this.writerAEM_angVel.append(buff+LS); this.writerAEM_angVel.flush(); @@ -313,6 +324,9 @@ public void writeStep(Satellite satellite) { /** Writing to the angular momentum file */ Vector3D mom = satellite.getAssembly().getAngularMomentum(); + if(mom.getNorm()!= 0) { + mom = mom.normalize(); + } buff .append(days) .append(" ") /* Column Separator */ @@ -323,6 +337,8 @@ public void writeStep(Satellite satellite) { .append(mom.getY()) .append(" ") .append(mom.getZ()) + .append(" ") + .append(0) ; this.writerAEM_angMomentum.append(buff+LS); this.writerAEM_angMomentum.flush(); @@ -331,6 +347,7 @@ public void writeStep(Satellite satellite) { /* Writing the current mag field to the log file. */ Vector3D mag_field = satellite.getSensors().getMagnetometer().retrievePerfectField().getFieldVector(); + mag_field = mag_field.normalize(); buff .append(days) .append(" ") /* Column Separator */ @@ -341,6 +358,8 @@ public void writeStep(Satellite satellite) { .append(mag_field.getY()) .append(" ") .append(mag_field.getZ()) + .append(" ") + .append(0) ; this.writerAEM_mag.append(buff.toString()+ LS); this.writerAEM_mag.flush();