Subversion Repositories Projects

Rev

Rev 1540 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1540 Rev 1695
1
package dongfang.mkt.frames;
1
package dongfang.mkt.frames;
2
 
2
 
3
public class AttitudeDataResponseFrame extends ResponseFrame {
3
public class AttitudeDataResponseFrame extends ResponseFrame {
4
        // signed int  Winkel[3]; // nick, roll, compass in 0,1�
-
 
5
        // signed char reserve[8];
-
 
6
        private int pitch;
4
        private float[] attitude;
7
        private int roll;
5
        private float[] rates;
8
        private int heading;
6
        private float[] acc;
9
        private int[] expansion;
-
 
10
       
7
       
11
        public AttitudeDataResponseFrame(int address) {
8
        public AttitudeDataResponseFrame(int address) {
12
                super(address);
9
                super(address);
13
        }
10
        }
14
 
11
 
15
        @Override
12
        @Override
16
        public boolean isResponseTo(RequestFrame r) {
13
        public boolean isResponseTo(RequestFrame r) {
17
                return r instanceof AttitudeDataRequestFrame;
14
                return r instanceof AttitudeDataRequestFrame;
18
        }
15
        }
19
 
16
 
20
        public int getPitch() {
17
        public float[] getAttitude() {
21
                return pitch;
18
                return attitude;
22
        }
19
        }
23
 
20
 
24
        public void setPitch(int pitch) {
21
        public void setAttitude(float[] attitude) {
25
                this.pitch = pitch;
22
                this.attitude = attitude;
26
        }
23
        }
27
 
24
 
28
        public int getRoll() {
25
        public float[] getRates() {
29
                return roll;
26
                return rates;
30
        }
27
        }
31
 
28
 
32
        public void setRoll(int roll) {
29
        public void setRates(float[] rates) {
33
                this.roll = roll;
30
                this.rates = rates;
34
        }
31
        }
35
 
32
 
36
        public int getHeading() {
33
        public float[] getAcc() {
37
                return heading;
34
                return acc;
38
        }
35
        }
39
 
36
 
40
        public void setHeading(int heading) {
-
 
41
                this.heading = heading;
-
 
-
 
37
        public void setAcc(float[] acc) {
42
        }
38
                this.acc = acc;
43
 
39
        }
44
        public int[] getExpansion() {
40
       
45
                return expansion;
41
        public String toString() {
46
        }
42
                String result =  "pitch: " + attitude[0] + ", roll: " + attitude[1] + ", yaw: " + attitude[2];
47
 
43
                result += ", pitchRate: " + rates[0] + ", rollRate: " + rates[1] + ", yawRate: " + rates[2];
48
        public void setExpansion(int[] expansion) {
44
                result += ", X: " + acc[0] + ", Y: " + acc[1] + ", Z: " + acc[2];
49
                this.expansion = expansion;
45
                return result;
50
        }
46
        }
51
}
47
}
52
 
48