Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 2b7f7ad

Browse files
committed
Merge branch 'develop'
2 parents 6104018 + 9a5539a commit 2b7f7ad

12 files changed

Lines changed: 2316 additions & 329 deletions

Assets/SolAR/Demos/Sample/Scenes/SolARHololens2SampleScene.unity

Lines changed: 2126 additions & 307 deletions
Large diffs are not rendered by default.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @copyright Copyright (c) 2021-2022 B-com http://www.b-com.com/
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using UnityEngine;
18+
19+
using Microsoft.MixedReality.Toolkit.UI;
20+
using Bcom.Solar;
21+
22+
public class ResetButtonHandler : MonoBehaviour
23+
{
24+
public ButtonConfigHelper buttonConfigHelper;
25+
public SolArCloudHololens2 solArCloudHololens2;
26+
27+
// Start is called before the first frame update
28+
void Start()
29+
{
30+
solArCloudHololens2.OnReset += OnReset;
31+
}
32+
33+
// Update is called once per frame
34+
void Update()
35+
{
36+
37+
}
38+
39+
public void Reset()
40+
{
41+
solArCloudHololens2.Reset();
42+
}
43+
44+
private void OnReset()
45+
{
46+
47+
}
48+
}

Assets/SolAR/Demos/Sample/Scripts/ResetButtonHandler.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SolAR/Scripts/SolARMappingAndRelocalizationGrpcProxyManager.cs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,41 @@ public ResultStatus Get3dTransform()
777777
return SUCCESS;
778778
}
779779

780+
781+
public ResultStatus Reset()
782+
{
783+
SolARMappingAndRelocalizationProxyClient client = null;
784+
try
785+
{
786+
client = clientPool.GetClient();
787+
if (client == null)
788+
{
789+
return new ResultStatus(false, "Cannot call Reset(): no gRPC client available");
790+
}
791+
792+
client.Reset(
793+
EMPTY,
794+
deadline: DateTime.UtcNow.AddSeconds(gRpcDeadlineInS));
795+
796+
clientPool.ReleaseClient(client);
797+
}
798+
catch (Grpc.Core.RpcException e)
799+
{
800+
clientPool.DeleteClient(client);
801+
return makeErrorResult("SolARMappingAndRelocalizationGrpcProxyManager::Reset(): Error: "
802+
+ e.Message + "(status: " + e.Status.Detail + ", code: " + e.StatusCode);
803+
}
804+
catch (Exception e)
805+
{
806+
clientPool.DeleteClient(client);
807+
return makeErrorResult("SolARMappingAndRelocalizationGrpcProxyManager::Reset(): Error: "
808+
+ e.Message);
809+
}
810+
811+
return SUCCESS;
812+
813+
}
814+
780815
public ResultStatus SendMessage(string message)
781816
{
782817
SolARMappingAndRelocalizationProxyClient client = null;
@@ -785,7 +820,7 @@ public ResultStatus SendMessage(string message)
785820
client = clientPool.GetClient();
786821
if (client == null)
787822
{
788-
return new ResultStatus(false, "Cannot call RelocalizeAndMap(): no gRPC client available");
823+
return new ResultStatus(false, "Cannot call SendMessage(): no gRPC client available");
789824
}
790825

791826

Assets/SolAR/Scripts/SolArCloudHololens2.cs

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ public event Action
256256

257257
public event Action<long> OnSentFrame;
258258

259+
public event Action OnReset;
260+
259261
private void NotifyOnDepthFrame(
260262
byte[] depthData,
261263
byte[] depthABData,
@@ -324,6 +326,9 @@ private void NotifyOnReceivedPose(
324326
private void NotifyOnSentFrame(long nbSentFrames)
325327
=> OnSentFrame?.Invoke(nbSentFrames);
326328

329+
private void NotifyOnReset()
330+
=> OnReset?.Invoke();
331+
327332
SolArCloudHololens2()
328333
{
329334
pvParameters = new CameraParameters(pvDefaultParameters);
@@ -437,10 +442,13 @@ private void OnApplicationPause(bool pause)
437442
}
438443
}
439444

440-
//void OnApplicationQuit()
441-
//{
445+
void OnApplicationQuit()
446+
{
442447
// SaveUserPrefs();
443-
//}
448+
449+
// Stop services if currently started
450+
StopSensorsCapture();
451+
}
444452

445453
public bool TestRpcConnection()
446454
{
@@ -1091,6 +1099,44 @@ private string toString(Matrix4x4 m)
10911099
//}
10921100
}
10931101

1102+
public void Reset()
1103+
{
1104+
// RelocAndMappingProxy used to be created when starting the mapping/reloc
1105+
// (in order to take into account the latest value for service address)
1106+
// Need to be created here if null to be able to reset before having used
1107+
// the service.
1108+
//TODO(jmhenaff): handle this better
1109+
if (relocAndMappingProxy == null)
1110+
{
1111+
string _frontEndIp = frontendIp;
1112+
int _frontendBasePort = frontendBasePort;
1113+
1114+
string[] splittedString = frontendIp.Split(':');
1115+
if (splittedString.Length > 2)
1116+
{
1117+
_frontEndIp = frontendIp.Substring(0, frontendIp.LastIndexOf(':'));
1118+
1119+
if (!Int32.TryParse(frontendIp.Substring(frontendIp.LastIndexOf(':') + 1), out _frontendBasePort))
1120+
{
1121+
NotifyOnUnityAppError("Ill-formed URL: '" + frontendIp + "'");
1122+
// best effort
1123+
_frontendBasePort = frontendBasePort;
1124+
}
1125+
}
1126+
1127+
relocAndMappingProxy = new SolARRpc.SolARMappingAndRelocalizationGrpcProxyManager.Builder()
1128+
.SetServiceAddress(_frontEndIp)
1129+
.SetPortBase(_frontendBasePort)
1130+
.SetClientPoolSize(advancedGrpcSettings.channelPoolSize)
1131+
.UseUniquePortNumber(advancedGrpcSettings.useUniquePort)
1132+
// .SetRelocAndMappingRequestIntervalMs(advancedGrpcSettings.delayBetweenFramesInMs)
1133+
.Build();
1134+
}
1135+
1136+
relocAndMappingProxy.Reset();
1137+
NotifyOnReset();
1138+
}
1139+
10941140
private void LateUpdate()
10951141
{
10961142

Assets/SolAR/Scripts/grpc/SolarMappingAndRelocalizationProxy.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static SolarMappingAndRelocalizationProxyReflection() {
5959
"UmVsb2NhbGl6YXRpb25Qb3NlU3RhdHVzEgsKB05PX1BPU0UQABIMCghORVdf",
6060
"UE9TRRABEg8KC0xBVEVTVF9QT1NFEAIqMgoLSW1hZ2VMYXlvdXQSCgoGUkdC",
6161
"XzI0EAASCgoGR1JFWV84EAESCwoHR1JFWV8xNhACKi4KEEltYWdlQ29tcHJl",
62-
"c3Npb24SCAoETk9ORRAAEgcKA1BORxABEgcKA0pQRxACMsgECiJTb2xBUk1h",
62+
"c3Npb24SCAoETk9ORRAAEgcKA1BORxABEgcKA0pQRxACMokFCiJTb2xBUk1h",
6363
"cHBpbmdBbmRSZWxvY2FsaXphdGlvblByb3h5EkoKBEluaXQSJi5jb20uYmNv",
6464
"bS5zb2xhci5ncHJjLlBpcGVsaW5lTW9kZVZhbHVlGhouY29tLmJjb20uc29s",
6565
"YXIuZ3ByYy5FbXB0eRI/CgVTdGFydBIaLmNvbS5iY29tLnNvbGFyLmdwcmMu",
@@ -71,8 +71,10 @@ static SolarMappingAndRelocalizationProxyReflection() {
7171
"Z3ByYy5GcmFtZRopLmNvbS5iY29tLnNvbGFyLmdwcmMuUmVsb2NhbGl6YXRp",
7272
"b25SZXN1bHQSVwoOR2V0M0RUcmFuc2Zvcm0SGi5jb20uYmNvbS5zb2xhci5n",
7373
"cHJjLkVtcHR5GikuY29tLmJjb20uc29sYXIuZ3ByYy5SZWxvY2FsaXphdGlv",
74-
"blJlc3VsdBJHCgtTZW5kTWVzc2FnZRIcLmNvbS5iY29tLnNvbGFyLmdwcmMu",
75-
"TWVzc2FnZRoaLmNvbS5iY29tLnNvbGFyLmdwcmMuRW1wdHliBnByb3RvMw=="));
74+
"blJlc3VsdBI/CgVSZXNldBIaLmNvbS5iY29tLnNvbGFyLmdwcmMuRW1wdHka",
75+
"Gi5jb20uYmNvbS5zb2xhci5ncHJjLkVtcHR5EkcKC1NlbmRNZXNzYWdlEhwu",
76+
"Y29tLmJjb20uc29sYXIuZ3ByYy5NZXNzYWdlGhouY29tLmJjb20uc29sYXIu",
77+
"Z3ByYy5FbXB0eWIGcHJvdG8z"));
7678
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
7779
new pbr::FileDescriptor[] { },
7880
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Com.Bcom.Solar.Gprc.PipelineMode), typeof(global::Com.Bcom.Solar.Gprc.CameraType), typeof(global::Com.Bcom.Solar.Gprc.RelocalizationPoseStatus), typeof(global::Com.Bcom.Solar.Gprc.ImageLayout), typeof(global::Com.Bcom.Solar.Gprc.ImageCompression), }, null, new pbr::GeneratedClrTypeInfo[] {

Assets/SolAR/Scripts/grpc/SolarMappingAndRelocalizationProxyGrpc.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, gl
102102
__Marshaller_com_bcom_solar_gprc_Empty,
103103
__Marshaller_com_bcom_solar_gprc_RelocalizationResult);
104104

105+
static readonly grpc::Method<global::Com.Bcom.Solar.Gprc.Empty, global::Com.Bcom.Solar.Gprc.Empty> __Method_Reset = new grpc::Method<global::Com.Bcom.Solar.Gprc.Empty, global::Com.Bcom.Solar.Gprc.Empty>(
106+
grpc::MethodType.Unary,
107+
__ServiceName,
108+
"Reset",
109+
__Marshaller_com_bcom_solar_gprc_Empty,
110+
__Marshaller_com_bcom_solar_gprc_Empty);
111+
105112
static readonly grpc::Method<global::Com.Bcom.Solar.Gprc.Message, global::Com.Bcom.Solar.Gprc.Empty> __Method_SendMessage = new grpc::Method<global::Com.Bcom.Solar.Gprc.Message, global::Com.Bcom.Solar.Gprc.Empty>(
106113
grpc::MethodType.Unary,
107114
__ServiceName,
@@ -149,6 +156,11 @@ public abstract partial class SolARMappingAndRelocalizationProxyBase
149156
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
150157
}
151158

159+
public virtual global::System.Threading.Tasks.Task<global::Com.Bcom.Solar.Gprc.Empty> Reset(global::Com.Bcom.Solar.Gprc.Empty request, grpc::ServerCallContext context)
160+
{
161+
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
162+
}
163+
152164
public virtual global::System.Threading.Tasks.Task<global::Com.Bcom.Solar.Gprc.Empty> SendMessage(global::Com.Bcom.Solar.Gprc.Message request, grpc::ServerCallContext context)
153165
{
154166
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
@@ -275,6 +287,22 @@ protected SolARMappingAndRelocalizationProxyClient(ClientBaseConfiguration confi
275287
{
276288
return CallInvoker.AsyncUnaryCall(__Method_Get3DTransform, null, options, request);
277289
}
290+
public virtual global::Com.Bcom.Solar.Gprc.Empty Reset(global::Com.Bcom.Solar.Gprc.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
291+
{
292+
return Reset(request, new grpc::CallOptions(headers, deadline, cancellationToken));
293+
}
294+
public virtual global::Com.Bcom.Solar.Gprc.Empty Reset(global::Com.Bcom.Solar.Gprc.Empty request, grpc::CallOptions options)
295+
{
296+
return CallInvoker.BlockingUnaryCall(__Method_Reset, null, options, request);
297+
}
298+
public virtual grpc::AsyncUnaryCall<global::Com.Bcom.Solar.Gprc.Empty> ResetAsync(global::Com.Bcom.Solar.Gprc.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
299+
{
300+
return ResetAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
301+
}
302+
public virtual grpc::AsyncUnaryCall<global::Com.Bcom.Solar.Gprc.Empty> ResetAsync(global::Com.Bcom.Solar.Gprc.Empty request, grpc::CallOptions options)
303+
{
304+
return CallInvoker.AsyncUnaryCall(__Method_Reset, null, options, request);
305+
}
278306
public virtual global::Com.Bcom.Solar.Gprc.Empty SendMessage(global::Com.Bcom.Solar.Gprc.Message request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
279307
{
280308
return SendMessage(request, new grpc::CallOptions(headers, deadline, cancellationToken));
@@ -309,6 +337,7 @@ protected override SolARMappingAndRelocalizationProxyClient NewInstance(ClientBa
309337
.AddMethod(__Method_SetCameraParameters, serviceImpl.SetCameraParameters)
310338
.AddMethod(__Method_RelocalizeAndMap, serviceImpl.RelocalizeAndMap)
311339
.AddMethod(__Method_Get3DTransform, serviceImpl.Get3DTransform)
340+
.AddMethod(__Method_Reset, serviceImpl.Reset)
312341
.AddMethod(__Method_SendMessage, serviceImpl.SendMessage).Build();
313342
}
314343

@@ -324,6 +353,7 @@ public static void BindService(grpc::ServiceBinderBase serviceBinder, SolARMappi
324353
serviceBinder.AddMethod(__Method_SetCameraParameters, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Com.Bcom.Solar.Gprc.CameraParameters, global::Com.Bcom.Solar.Gprc.Empty>(serviceImpl.SetCameraParameters));
325354
serviceBinder.AddMethod(__Method_RelocalizeAndMap, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Com.Bcom.Solar.Gprc.Frame, global::Com.Bcom.Solar.Gprc.RelocalizationResult>(serviceImpl.RelocalizeAndMap));
326355
serviceBinder.AddMethod(__Method_Get3DTransform, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Com.Bcom.Solar.Gprc.Empty, global::Com.Bcom.Solar.Gprc.RelocalizationResult>(serviceImpl.Get3DTransform));
356+
serviceBinder.AddMethod(__Method_Reset, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Com.Bcom.Solar.Gprc.Empty, global::Com.Bcom.Solar.Gprc.Empty>(serviceImpl.Reset));
327357
serviceBinder.AddMethod(__Method_SendMessage, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Com.Bcom.Solar.Gprc.Message, global::Com.Bcom.Solar.Gprc.Empty>(serviceImpl.SendMessage));
328358
}
329359

ProjectSettings/ProjectSettings.asset

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ PlayerSettings:
128128
16:10: 1
129129
16:9: 1
130130
Others: 1
131-
bundleVersion: 0.4.0
131+
bundleVersion: 0.5.0
132132
preloadedAssets:
133133
- {fileID: 0}
134134
- {fileID: 0}
@@ -262,8 +262,10 @@ PlayerSettings:
262262
- {fileID: 0}
263263
- {fileID: 0}
264264
- {fileID: 0}
265+
- {fileID: 0}
265266
- {fileID: 8098013011867456620, guid: 892250fbfc1442f49a66d62b6c348e31, type: 2}
266267
- {fileID: 2256912601668067897, guid: bc86b981421586743bee1b33317fbc8a, type: 2}
268+
- {fileID: 0}
267269
metroInputSource: 0
268270
wsaTransparentSwapchain: 0
269271
m_HolographicPauseOnTrackingLoss: 1
@@ -754,7 +756,7 @@ PlayerSettings:
754756
m_RenderingPath: 1
755757
m_MobileRenderingPath: 1
756758
metroPackageName: SolARDemo
757-
metroPackageVersion: 0.4.0.0
759+
metroPackageVersion: 0.5.0.0
758760
metroCertificatePath: Assets\WSATestCertificate.pfx
759761
metroCertificatePassword:
760762
metroCertificateSubject: DefaultCompany
@@ -790,7 +792,6 @@ PlayerSettings:
790792
metroSplashScreenUseBackgroundColor: 0
791793
platformCapabilities:
792794
WindowsStoreApps:
793-
CodeGeneration: False
794795
OfflineMapsManagement: False
795796
HumanInterfaceDevice: False
796797
Location: False
@@ -803,6 +804,7 @@ PlayerSettings:
803804
InternetClientServer: True
804805
VideosLibrary: False
805806
Objects3D: False
807+
Proximity: False
806808
RemoteSystem: False
807809
BlockedChatMessages: False
808810
PhoneCall: False
@@ -825,7 +827,7 @@ PlayerSettings:
825827
RecordedCallsFolder: False
826828
Contacts: False
827829
InternetClient: True
828-
Proximity: False
830+
CodeGeneration: False
829831
BackgroundMediaPlayback: False
830832
EnterpriseAuthentication: False
831833
metroTargetDeviceFamilies:

RELEASE-NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release Notes
22

3+
## v0.5.0
4+
* Add reset button
5+
* Send a "stop" request to ARCloud services when application closes (if in "start" mode)
36
## v0.4.0
47
* Improve hologram alignment by applying the offset transfom between sensor camera and the eyes location.
58
* Use a coroutine to start sensors, fetch and send frames + control sending rate

doc/architecture-communication.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,8 @@ Envoy is available for many platforms, but I will describe the case where Envoy
189189
### Install
190190

191191
As mentionned earlier, the installation is described for Linux as Windows installation is performed only via a Docker image, which adds some complexity and/or performance issues.
192-
On Ubuntu Envoy can be installed simply via apt ([doc](https://www.envoyproxy.io/docs/envoy/v1.19.1/start/install#install-envoy-on-ubuntu-linux)):
193-
```bash
194-
sudo apt update
195-
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
196-
curl -sL 'https://getenvoy.io/gpg' | sudo gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg
197-
Verify the keyring - this should yield "OK"
198-
echo 1a2f6152efc6cc39e384fb869cdf3cc3e4e1ac68f4ad8f8f114a7c58bb0bea01 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check
199-
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://dl.bintray.com/tetrate/getenvoy-deb $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/getenvoy.list
200-
sudo apt update
201-
sudo apt install -y getenvoy-envoy
202-
```
192+
193+
On Ubuntu Envoy can be installed simply via **apt**, as described in the official [documentation](https://www.envoyproxy.io/docs/envoy/latest/start/install#install-envoy-on-ubuntu-linux).
203194
204195
### Run and test
205196
Follow the instructions [here](https://www.envoyproxy.io/docs/envoy/v1.19.1/start/quick-start/run-envoy#run-envoy-with-the-demo-configuration) to run Envoy with a default configuration and attempt to connect to it.

0 commit comments

Comments
 (0)