Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1690 → Rev 1695

/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/AttitudeDataResponseFrame.java
1,12 → 1,9
package dongfang.mkt.frames;
 
public class AttitudeDataResponseFrame extends ResponseFrame {
// signed int Winkel[3]; // nick, roll, compass in 0,1�
// signed char reserve[8];
private int pitch;
private int roll;
private int heading;
private int[] expansion;
private float[] attitude;
private float[] rates;
private float[] acc;
public AttitudeDataResponseFrame(int address) {
super(address);
17,35 → 14,34
return r instanceof AttitudeDataRequestFrame;
}
 
public int getPitch() {
return pitch;
public float[] getAttitude() {
return attitude;
}
 
public void setPitch(int pitch) {
this.pitch = pitch;
public void setAttitude(float[] attitude) {
this.attitude = attitude;
}
 
public int getRoll() {
return roll;
public float[] getRates() {
return rates;
}
 
public void setRoll(int roll) {
this.roll = roll;
public void setRates(float[] rates) {
this.rates = rates;
}
 
public int getHeading() {
return heading;
public float[] getAcc() {
return acc;
}
 
public void setHeading(int heading) {
this.heading = heading;
public void setAcc(float[] acc) {
this.acc = acc;
}
 
public int[] getExpansion() {
return expansion;
public String toString() {
String result = "pitch: " + attitude[0] + ", roll: " + attitude[1] + ", yaw: " + attitude[2];
result += ", pitchRate: " + rates[0] + ", rollRate: " + rates[1] + ", yawRate: " + rates[2];
result += ", X: " + acc[0] + ", Y: " + acc[1] + ", Z: " + acc[2];
return result;
}
 
public void setExpansion(int[] expansion) {
this.expansion = expansion;
}
}
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/DCMMatrixRequestFrame.java
0,0 → 1,17
package dongfang.mkt.frames;
 
import java.io.IOException;
 
import dongfang.mkt.RequestFrameVisitor;
 
 
public class DCMMatrixRequestFrame extends RequestFrame {
 
public DCMMatrixRequestFrame() {
super(FC_ADDRESS);
}
 
public void accept(RequestFrameVisitor o) throws IOException {
o.visit(this);
}
}
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/DCMMatrixResponseFrame.java
0,0 → 1,42
package dongfang.mkt.frames;
 
import java.util.Formatter;
import java.util.Locale;
 
public class DCMMatrixResponseFrame extends ResponseFrame {
private float[][] matrix;
public DCMMatrixResponseFrame(int address) {
super(address);
}
 
@Override
public boolean isResponseTo(RequestFrame r) {
return r instanceof DCMMatrixRequestFrame;
}
 
public float[][] getMatrix() {
return matrix;
}
 
public void setMatrix(float[][] matrix) {
this.matrix = matrix;
}
 
public String toString() {
StringBuilder result = new StringBuilder();
Formatter fmt = new Formatter(result, Locale.US);
fmt.format("%4.4f", matrix[0][0] + " ");
fmt.format("%4.4f", matrix[0][1] + " ");
fmt.format("%4.4f", matrix[0][2] + "\n");
 
fmt.format("%4.4f", matrix[1][0] + " ");
fmt.format("%4.4f", matrix[1][1] + " ");
fmt.format("%4.4f", matrix[1][2] + "\n");
fmt.format("%4.4f", matrix[2][0] + " ");
fmt.format("%4.4f", matrix[2][1] + " ");
fmt.format("%4.4f", matrix[2][2]);
return result.toString();
}
}