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