A Unity library for communicattion with ROS through RosBridge
The first version of this I believe origins from Michael Jenkin, in the repo unityros. He has made a sample unity project showing turtlesim, with good instructions on how to use this project. All honor goes to him. I created this project because there was no repository containing the barebone library.
This repository is intended to be imported as a git submodule.
This repository does not contain every ROS message. If you need to add one, please fork this repository, add the file and make a pull request.
Documentation is in the code. I have added some more in addition to what Michael Jenkin (original author). The main file is ROSBridgeWebSocketConnection.cs, which sets up everything.
A Unity project which uses this repository UnityROSSensorVisualizer:
publicclassRealsenseViewer:MonoBehaviour{privateROSBridgeWebSocketConnectionros=null;voidStart(){ros=newROSBridgeWebSocketConnection("ws://localhost",9090);ros.AddSubscriber(typeof(RealsenseCompressedImageSubscriber));ros.AddServiceResponse(typeof(RealsenseServiceResponse));ros.Connect();}// Extremely important to disconnect from ROS. OTherwise packets continue to flowvoidOnApplicationQuit(){if(ros!=null){ros.Disconnect();}}// Update is called once per frame in UnityvoidUpdate(){ros.Render();}}Note: SimpleJSON is included here as a convenience. It has its own licensing requirements. See source code and unity store for details.