• R/O
  • HTTP
  • SSH
  • HTTPS

yubeshi: Commit

source codes and tests


Commit MetaInfo

Revisionae4a500efc77e538a409f112c19fe3d83dc58bb8 (tree)
Time2012-06-07 20:21:40
Authorkimikage <kimikage_ceo@hotm...>
Commiterkimikage

Log Message

Heightへの対応,緯度・経度が反転していた不具合の修正

Change Summary

Incremental Difference

--- a/Yubeshi/Ubx/NavPosLlh.cs
+++ b/Yubeshi/Ubx/NavPosLlh.cs
@@ -38,16 +38,21 @@ namespace Yubeshi.Ubx
3838 {
3939 Degree lon = BitConverter.ToInt32(Raw, 6 + 4) * 1e-7;
4040 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);
4345 }
4446 }
4547
46- public double MslHeight
48+ public Height MslHeight
4749 {
4850 get
4951 {
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;
5156 }
5257 }
5358
--- a/YubeshiTest/UbxTest/NavPacketTest.cs
+++ b/YubeshiTest/UbxTest/NavPacketTest.cs
@@ -51,6 +51,23 @@ namespace YubeshiTest.UbxTest
5151 }
5252
5353 [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]
5471 public void NavSolTest()
5572 {
5673 UnknownPacket packet;
--- a/YubeshiTest/UbxTest/SamplePackets.cs
+++ b/YubeshiTest/UbxTest/SamplePackets.cs
@@ -25,6 +25,7 @@ namespace YubeshiTest.UbxTest
2525 public static readonly byte[] NavClock;
2626 public static readonly byte[] NavDop;
2727 public static readonly byte[] NavPosEcef;
28+ public static readonly byte[] NavPosLlh;
2829 public static readonly byte[] NavSol;
2930
3031
@@ -122,6 +123,18 @@ namespace YubeshiTest.UbxTest
122123 0xFF, 0xFF
123124 };
124125
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+
125138 NavSol = new byte[]{
126139 0xB5, 0x62, 0x01, 0x06, 0x34, 0x00,
127140 0xE5, 0x16, 0x3F, 0x0A, // tow
Show on old repository browser