-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from Field-Robotics-Japan/feature/gnssCalc
Feature/gnss calc
- Loading branch information
Showing
12 changed files
with
280 additions
and
17 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
Assets/UnitySensors/Runtime/Prefabs/GNSS/GeoCoordinateSystem.prefab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &6658069106543365610 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 6658069106543365612} | ||
- component: {fileID: 6658069106543365611} | ||
m_Layer: 0 | ||
m_Name: GeoCoordinateSystem | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &6658069106543365612 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 6658069106543365610} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!114 &6658069106543365611 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 6658069106543365610} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 5f2116b7f84275c4d877f9ac14990716, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
_coordinate: | ||
latitude: 35.71020206575301 | ||
longitude: 139.81070039691542 | ||
altitude: 3 |
7 changes: 7 additions & 0 deletions
7
Assets/UnitySensors/Runtime/Prefabs/GNSS/GeoCoordinateSystem.prefab.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
Assets/UnitySensors/Runtime/Scripts/Sensors/GNSS/GeoCoordinateSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
using UnitySensors.Utils.GeoCoordinate; | ||
|
||
namespace UnitySensors.Sensor.GNSS | ||
{ | ||
public class GeoCoordinateSystem : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private GeoCoordinate _coordinate = new GeoCoordinate(35.71020206575301, 139.81070039691542, 3.0f); | ||
|
||
private Transform _transform; | ||
private GeoCoordinateConverter _converter; | ||
|
||
private void Awake() | ||
{ | ||
_transform = this.transform; | ||
_converter = new GeoCoordinateConverter(_coordinate.latitude, _coordinate.longitude); | ||
} | ||
|
||
public GeoCoordinate GetCoordinate(Vector3 worldPosition) | ||
{ | ||
Vector3 localPosition = _transform.InverseTransformPoint(worldPosition); | ||
double latitude, longitude; | ||
(latitude, longitude) = _converter.XZ2LatLon(localPosition.x, localPosition.z); | ||
return new GeoCoordinate(latitude, longitude, localPosition.y + _coordinate.altitude); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/UnitySensors/Runtime/Scripts/Sensors/GNSS/GeoCoordinateSystem.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ts/Utils/GeoCoordinates/GeoCoordinates.cs → ...pts/Utils/GeoCoordinates/GeoCoordinate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters