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