IT/Network & OS

[WebRTC] Unity to ROS2

루벤초이 2023. 2. 11. 18:11

Install Unity-WebRTC

Unity - Package Manager - Add pakcage from git URL - com.unity.webrtc@3.0.0-pre.4
https://docs.unity3d.com/Packages/com.unity.webrtc@3.0/manual/index.html

 

Install Unity-RenderStreaming (for Test)

Unity - Package Manager - Add pakcage from git URL - com.unity.renderstreaming@3.1.0-exp.5
https://docs.unity3d.com/Packages/com.unity.renderstreaming@3.1/manual/installation.html
Then, import the samples and update signaling server in Inspection tab of RenderStreaming object for each scene.
Update signalingAddress to "your-IP:your-port" in Example/Scripts/SceneSelectUI.cs.
[Troubleshoot] The sample does not work if both WebRTC and RenderStreaming samples are imported (menu.scene is overlapped)
[Troubleshoot] menu.scene must be located in the first row of the Build Settings tab. 
[Troubleshoot] Delete ~/.android if keystore error is occurred. It happens when .android is overwritted somehow (e.g. installing new Android Studio). Building Android in Unity create ~/.android again.
[Troubleshoot] clang error is occurred in some recent versions of Unity. Version 2021 works properly.

 

Install Coturn on EC2

First, set security policies.

$sudo apt install coturn
vi /etc/turnserver.conf

listening-ip=172.31.xx.xx
external-ip=3.34.xx.xx

min-port=49152
max-port=65535

verbose

fingerprint

lt-cred-mech

realm=ec2-3-34-xx-xx.ap-northeast-2.compute.amazonaws.com

user=<ID>:<PASSWORD>
$sudo service coturn restart
$sudo service coturn status

Use TrickleICE for verification https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
 
[Troubleshoot] The sample does not work if both WebRTC and RenderStreaming samples are imported (menu.scene is overlapped)

 

Setup Signaling Server

Create your own signaling server using coturn server. In this example, the server provided UnityRenderStreaming is used.

 

Setup Unity Project

Open Assets-Samples-UnityRenderStreaming-3.1.0-exp.5-Example-Broadcast-Broadcast.scene, for example.
Select RenderStreaming in Hierarchy and update Signaling URL in Inspection tab.

 

References

 

728x90
반응형