source codes and tests
Revision | ae4a500efc77e538a409f112c19fe3d83dc58bb8 (tree) |
---|---|
Time | 2012-06-07 20:21:40 |
Author | kimikage <kimikage_ceo@hotm...> |
Commiter | kimikage |
Heightへの対応,緯度・経度が反転していた不具合の修正
@@ -38,16 +38,21 @@ namespace Yubeshi.Ubx | ||
38 | 38 | { |
39 | 39 | Degree lon = BitConverter.ToInt32(Raw, 6 + 4) * 1e-7; |
40 | 40 | Degree lat = BitConverter.ToInt32(Raw, 6 + 8) * 1e-7; |
41 | - double h = BitConverter.ToUInt32(Raw, 6 + 12); | |
42 | - return new GeodeticCoordinate(lon, lat, h); | |
41 | + Height h = new Height( | |
42 | + BitConverter.ToUInt32(Raw, 6 + 12) * 1e-3, | |
43 | + Height.Base.Ellipsoid); | |
44 | + return new GeodeticCoordinate(lat, lon, h); | |
43 | 45 | } |
44 | 46 | } |
45 | 47 | |
46 | - public double MslHeight | |
48 | + public Height MslHeight | |
47 | 49 | { |
48 | 50 | get |
49 | 51 | { |
50 | - return BitConverter.ToUInt32(Raw, 6 + 16); | |
52 | + Height h = new Height( | |
53 | + BitConverter.ToUInt32(Raw, 6 + 16) * 1e-3, | |
54 | + Height.Base.MeanSeaLevel); | |
55 | + return h; | |
51 | 56 | } |
52 | 57 | } |
53 | 58 |
@@ -51,6 +51,23 @@ namespace YubeshiTest.UbxTest | ||
51 | 51 | } |
52 | 52 | |
53 | 53 | [Test] |
54 | + public void NavPosLlhTest() | |
55 | + { | |
56 | + UnknownPacket packet; | |
57 | + Assert.IsTrue(NavPosLlh.TryParse(P.NavPosLlh, out packet)); | |
58 | + NavPosLlh p = packet as NavPosLlh; | |
59 | + Assert.AreEqual(Packet.MessageID.NavPosLlh, p.ID); | |
60 | + Assert.AreEqual(timeOfWeek, p.TimeOfWeek); | |
61 | + Assert.AreEqual(35.710058, (double)p.Position.Latitude); | |
62 | + Assert.AreEqual(139.8107190, (double)p.Position.Longitude); | |
63 | + Assert.AreEqual(676.391, (double)p.Position.Altitude); | |
64 | + Assert.AreEqual(Height.Base.Ellipsoid, | |
65 | + p.Position.Altitude.BaseLevel); | |
66 | + Assert.AreEqual(640.0, (double)p.MslHeight); | |
67 | + Assert.AreEqual(Height.Base.MeanSeaLevel, p.MslHeight.BaseLevel); | |
68 | + } | |
69 | + | |
70 | + [Test] | |
54 | 71 | public void NavSolTest() |
55 | 72 | { |
56 | 73 | UnknownPacket packet; |
@@ -25,6 +25,7 @@ namespace YubeshiTest.UbxTest | ||
25 | 25 | public static readonly byte[] NavClock; |
26 | 26 | public static readonly byte[] NavDop; |
27 | 27 | public static readonly byte[] NavPosEcef; |
28 | + public static readonly byte[] NavPosLlh; | |
28 | 29 | public static readonly byte[] NavSol; |
29 | 30 | |
30 | 31 |
@@ -122,6 +123,18 @@ namespace YubeshiTest.UbxTest | ||
122 | 123 | 0xFF, 0xFF |
123 | 124 | }; |
124 | 125 | |
126 | + NavPosLlh = new byte[]{ | |
127 | + 0xB5, 0x62, 0x01, 0x02, 0x1C, 0x00, | |
128 | + 0xE5, 0x16, 0x3F, 0x0A, // tow | |
129 | + 0x36, 0x6C, 0x55, 0x53, // lon | |
130 | + 0x24, 0xEC, 0x48, 0x15, // lat | |
131 | + 0x27, 0x52, 0x0A, 0x00, // height | |
132 | + 0x00, 0xC4, 0x09, 0x00, // hMSL | |
133 | + 0x6D, 0x14, 0x00, 0x00, // hAcc | |
134 | + 0x6D, 0x14, 0x00, 0x00, // vAcc | |
135 | + 0xFF, 0xFF | |
136 | + }; | |
137 | + | |
125 | 138 | NavSol = new byte[]{ |
126 | 139 | 0xB5, 0x62, 0x01, 0x06, 0x34, 0x00, |
127 | 140 | 0xE5, 0x16, 0x3F, 0x0A, // tow |