Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1688 | - | 1 | package dongfang.mkt.frames; |
2 | |||
3 | public class ReadMotorMixerResponseFrame extends ResponseFrame { |
||
4 | private int[][] matrix; |
||
5 | // private int[] oppositeMotors; |
||
6 | private int configurationVersion; |
||
7 | private int dataLength; // not used really... |
||
8 | |||
9 | public ReadMotorMixerResponseFrame() { |
||
10 | super(FC_ADDRESS); |
||
11 | } |
||
12 | |||
13 | @Override |
||
14 | public boolean isResponseTo(RequestFrame r) { |
||
15 | return r instanceof ReadMotorMixerRequestFrame; |
||
16 | } |
||
17 | |||
18 | public int getConfigurationVersion() { |
||
19 | return configurationVersion; |
||
20 | } |
||
21 | |||
22 | public void setConfigurationVersion(int configurationVersion) { |
||
23 | this.configurationVersion = configurationVersion; |
||
24 | } |
||
25 | |||
26 | public int[][] getMatrix() { |
||
27 | return matrix; |
||
28 | } |
||
29 | |||
30 | public void setMatrix(int[][] matrix) { |
||
31 | this.matrix = matrix; |
||
32 | } |
||
33 | |||
34 | /* |
||
35 | public int[] getOppositeMotors() { |
||
36 | return oppositeMotors; |
||
37 | } |
||
38 | |||
39 | public void setOppositeMotors(int[] oppositeMotors) { |
||
40 | this.oppositeMotors = oppositeMotors; |
||
41 | } |
||
42 | */ |
||
43 | |||
44 | public int getDataLength() { |
||
45 | return dataLength; |
||
46 | } |
||
47 | |||
48 | public void setDataLength(int dataLength) { |
||
49 | this.dataLength = dataLength; |
||
50 | } |
||
51 | |||
52 | public String toString() { |
||
53 | StringBuilder result = new StringBuilder(getClass().getSimpleName() + ": "); |
||
54 | if (matrix != null) { |
||
55 | for (int i=0; i<matrix.length; i++) { |
||
56 | result.append(i + "->"); |
||
57 | result.append("Pitch: " + matrix[i][0]); |
||
58 | result.append("Roll: " + matrix[i][1]); |
||
59 | result.append("Throttle: " + matrix[i][2]); |
||
60 | result.append("Yaw: " + matrix[i][3]); |
||
61 | result.append("Opposite motor: " + matrix[i][4]); |
||
62 | if (i<matrix.length-1) result.append("\n"); |
||
63 | } |
||
64 | } |
||
65 | return result.toString(); |
||
66 | } |
||
67 | } |
||
68 |