-
-
Notifications
You must be signed in to change notification settings - Fork 19
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 #11 from lge-ros2/develop
Merge 'develop' branch into 'master
- Loading branch information
Showing
56 changed files
with
1,464 additions
and
572 deletions.
There are no files selected for viewing
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
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
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,51 @@ | ||
/* | ||
* Copyright (c) 2020 LG Electronics Inc. | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
using UnityEngine; | ||
using Stopwatch = System.Diagnostics.Stopwatch; | ||
|
||
public class GpsPlugin : CustomPlugin | ||
{ | ||
public string partName = string.Empty; | ||
|
||
private SensorDevices.GPS gps = null; | ||
|
||
protected override void OnAwake() | ||
{ | ||
partName = DeviceHelper.GetPartName(gameObject); | ||
|
||
string hashKey = MakeHashKey(partName); | ||
if (!RegisterTxDevice(hashKey)) | ||
{ | ||
Debug.LogError("Failed to register for GpsPlugin - " + hashKey); | ||
} | ||
} | ||
|
||
protected override void OnStart() | ||
{ | ||
gps = gameObject.GetComponent<SensorDevices.GPS>(); | ||
|
||
AddThread(Sender); | ||
} | ||
|
||
private void Sender() | ||
{ | ||
Stopwatch sw = new Stopwatch(); | ||
while (true) | ||
{ | ||
if (gps == null) | ||
{ | ||
continue; | ||
} | ||
|
||
var datastreamToSend = gps.PopData(); | ||
sw.Restart(); | ||
Publish(datastreamToSend); | ||
sw.Stop(); | ||
gps.SetTransportTime((float)sw.Elapsed.TotalSeconds); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.