From 4325f78d83c6d153387c02b199c2d1d75bdc4335 Mon Sep 17 00:00:00 2001 From: Lafith Mattara Date: Wed, 26 Aug 2020 12:18:00 +0530 Subject: [PATCH 1/4] Update README.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 41a4b4d..89c883c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # ROSBridgeLib A Unity library for communication with ROS through [RosBridge](http://wiki.ros.org/rosbridge_suite) - +```console +foo@bar:~$ sudo apt-get install ros--rosbridge-suite +foo@bar:~$ source /opt/ros//setup.bash +foo@bar:~$ roslaunch rosbridge_server rosbridge_websocket.launch +``` The first version of this I believe origins from [Michael Jenkin](https://github.com/michaeljenkin), in the repo [unityros](https://github.com/michaeljenkin/unityros). He 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. ## Included messages @@ -63,7 +67,7 @@ using SimpleJSON; using ROSBridgeLib.geometry_msgs; -public class BallPoseSubscriber : MonoBehaviour +public class BallPoseSubscriber : ROSBridgeSubscriber { static GameObject ball; @@ -112,7 +116,7 @@ using UnityEngine; using SimpleJSON; using ROSBridgeLib.geometry_msgs; -public class BallTwistPublisher : MonoBehaviour +public class BallTwistPublisher : ROSBridgePublisher { // The following three functions are important public static string GetMessageTopic() { From 5a604c0769a96e6dba3f4f5f361151bb55630103 Mon Sep 17 00:00:00 2001 From: Lafith Mattara Date: Thu, 27 Aug 2020 14:53:52 +0530 Subject: [PATCH 2/4] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 89c883c..71dae63 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,12 @@ This repository does not contain every ROS message. If you need to add one, plea Documentation is in the code. I added some more in addition to what Michael Jenkin (original author) did. The main file is ROSBridgeWebSocketConnection.cs, which sets up everything. +## Installation +Clone this repository in to the Assets folder of an Unity project: +```console +foo@bar:~$ git clone --recurse-submodules https://github.com/MathiasCiarlo/ROSBridgeLib.git +``` + ## Example usage This is an example application where a ball is controlled. Basically, there are three important script types to notice. From c9aeda38f7ae0b57989f991e555b56137cd93483 Mon Sep 17 00:00:00 2001 From: Lafith Mattara Date: Mon, 28 Sep 2020 19:20:51 +0530 Subject: [PATCH 3/4] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8d62ad9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. Windows.Linux] + - Unity Version [e.g.2020.1.6f1] + +**Additional context** +Add any other context about the problem here. From f8efed7b3986ad8e18e66c7dcdb8a2a9ac60a565 Mon Sep 17 00:00:00 2001 From: lafith Date: Mon, 28 Sep 2020 20:18:27 +0530 Subject: [PATCH 4/4] issue #1 regarding README fixed --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 71dae63..69dba64 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,6 @@ public class ROSInitializer : MonoBehaviour ros.Render (); } } - ``` ### **Subscriber** Then, create a subscriber script, **BallPoseSubscriber.cs**, which will receive updates from a chosen ROS topic @@ -95,15 +94,16 @@ public class BallPoseSubscriber : ROSBridgeSubscriber } // This function should fire on each received ros message - public new static void CallBack(PoseMsg msg) { + public new static void CallBack(ROSBridgeMsg msg) { Debug.Log("Recieved Message : "+msg.ToYAMLString()); // Update ball position, or whatever + PoseMsg PoseData=(PoseMsg)msg; ball=GameObject.Find("ball"); Vector3 ballPos=ball.transform.position; - ballPos.x = msg.GetPosition().GetX(); - ballPos.y = msg.GetPosition().GetY(); - ballPos.z = msg.GetPosition().GetZ(); + ballPos.x = PoseData.GetPosition().GetX(); + ballPos.y = PoseData.GetPosition().GetY(); + ballPos.z = PoseData.GetPosition().GetZ(); //Changing ball's position to the updated position vector ball.transform.position=ballPos; } @@ -120,6 +120,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using SimpleJSON; +using ROSBridgeLib; using ROSBridgeLib.geometry_msgs; public class BallTwistPublisher : ROSBridgePublisher @@ -143,7 +144,7 @@ public class BallTwistPublisher : ROSBridgePublisher } } ``` -Above script defines the publisher. In order to call this publisher attach one script, **DataManager.cs**, to the gameobject ball. +Above script defines the publisher. In order to call this publisher attach one script, **DataController.cs**, to the gameobject ball. ```cs using System.Collections; using System.Collections.Generic; @@ -152,7 +153,7 @@ using UnityEngine; using ROSBridgeLib; using ROSBridgeLib.geometry_msgs; -public class DataManager : MonoBehaviour +public class DataController : MonoBehaviour { Rigidbody rb; GameObject rosObj; @@ -184,7 +185,7 @@ public class DataManager : MonoBehaviour rb.angularVelocity.z ); msg=new TwistMsg(linearVel,angularVel); - rosobj.GetComponent().ros.Publish( + rosObj.GetComponent().ros.Publish( BallTwistPublisher.GetMessageTopic(),msg ); }