-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RosBridgeClient for UWP #33
Comments
Hi @arunavanag591 ! Concerning your 1st question: It is absolutely possible to use ROS# for publishing
Just drop the above Here is another code example how to publish Yo find all ROS message types currently supported by ROS# in Message.cs. Concerning your 2nd question: Let us continue discussing your 2nd question in issue #21. If you are fine with the answer to your 1st question please close this issue. Best, |
Hi @MartinBischoff though the answer look satisfying, however, I haven't been able to use ROS-Sharp due to issue #21 I tried a bunch of workarounds, but its only the issue with the ROSBridgeClient.dll which throws the error.
One such example you can find here |
@blommers provides a NetStandard 2.0 Version of the UrdfImporter. Have you tried this one? Instead of using the RosBridgeClient.dll in a Plugins folder, you can also use the source code of the RosBridgeClient project directly in Unity and add any required preprocessor directives there. |
When I do that I have issues with the ROSConnector and other scripts
If I change the target to 4.5 then websocketsharp fails. |
Hi, @MartinBischoff could you find a solution this? I have been putting a lot of time on this, however nothing yet. |
Hi @arunavanag591 would you please report what you have tried out thus far? What worked and what didn't? The info you provide will be helpful for others trying to solve your problem. In our group there is no demand for UWP at the moment. Maybe you want to ask others for support? @jaguar243 @Jasonthefirst |
Hi,
it throws me such error. I tried setting .NET target to 4 it solves that issue however it doesn't compile websocketsharp. I downloaded the websocket sharp library and created my own dll, but it did not help either. I tried using
It still fails to build both the rosbridge lib and websocket dll |
Hi, I came across this implementation and I'm currently working on forking it to this project, but you can see if this works for you: https://github.com/SoylentGraham/Websocket-Sharp-UWP. I have tested it on the Hololens and it works no problem. |
Hi @jaguar243, So did you just import the |
@arunavanag591 you need to rebuild the websocket-sharp.dll with the uwp code interspersed with normal websockets using the target tags
at the places where the two implementions differ. I will update with a proof of concept soon but I'm currently working on just using a TCP client on the hololens connecting to a server on the PC sending data. Another issue with UWP is they don't allow loopback connections so your hololens and the server need to be connected to the same network and served with separate IP addresses. Hope that helps. |
@jaguar243 I followed the conversation and tried to implement this as well. I am not sure if I understand you correctly though. We need to rebuild the websocket-sharp.dll in the ros-sharp project or totally from weboscket-sharp scratch? Would this mean we use the /sta/websocket-sharp project, change all references depending if we use the normal implementation or the other one? Or do we only need to change the references in the ros-sharp project? |
@Jasonthefirst The websocket-sharp.dll needs to be rebuilt starting from /sta/websocket-sharp with the UWP implementation interspersed within that project using the target tags. The UWP implementation that I mentioned earlier maintains the same references so there are no changes required in the RosBridgeClient project. So the steps involved are:
|
@jaguar243 A quick question, while I trying to use the UWP version. The present websocket version should be working with UNITY EDITOR right? The UWP version comes into picture only when I am using it hololens? I want it to work with the editor first. Additionally is it possible to have a branch for UWP support containing the right websocket dll and rosbridgeclient dll |
@arunavanag591 Yes, on the editor the provided libraries work without any issues. The UWP build is for building and deploying to the hololens. |
@jaguar243 I was doing some other things so it took me a while to return to this again but I tried to work with what you told me the last few day. |
+1 |
Someone working with the Hololens/UWP and ROS# want to try this out? |
Hey so I got ros-sharp on the HoloLens! The trick I did was to add the SoylentGraham script above into unity, add the RosBridgeClient cs files to unity (removing the RosBridgeClient.dll), and wrap the appropriate code snipits in preprocessor directives. I'll cleanup the code and make a pull request. |
These are very good news @dwhit ! Before including your modification in the master branch, we need to think about a way to include this alternative Websocket implementation properly. ROS# is designed such that only all Unity-related code is included as .cs source files in Unity.
In the meantime please feel free to provide any working implementation in your fork 👍 |
Absolutely @MartinBischoff. My current implementation is too sloppy for mainbranch. I think the best way to do it would be to build two RosBridgeClient.dll files, and tag one to build in editor, and one to build to WSA. We already did this with Newtwonsoft.Json without any issues. |
I am planning to write 3 implementations of a
Let us continue the discussion here. |
Hi. This forked project supports for UWP and works in HoloLens. |
Hi @tarukosu ! Thanks for this info and for sharing your code! |
I know you are refactoring to support UWP. I'm looking forward to it. |
Hi @tarukosu With #59 done it is now an eay task to implement an IProtocol implementation for SoylentGraham's Websocket-sharp-UWP version that you are using in your fork.
In case someone wants to write the IProtocol implementation wrapping UWPWebsocket.cs anyway, it will look very similar to the wrapper for websocket-sharp. |
That's great news @MartinBischoff! I'll give it a spin now. A few months ago I wrote my own System.Net.Websocket based protocol, and although it worked in the editor, it didn't work on the HoloLens. Looking at the HoloLens documentation, it seems the only supported Websocket library is Windows.Networking.Sockets (despite claiming elsewhere that the HoloLens supports .NET Standard 2.0). So I'll try to write an IProtocol implementation of Websocket-sharp-UWP today! At the very least, it could live in another branch, or my fork. |
Thank you @dwhit and @lee4138 for your UWP tests with these most recent ROS# changes. Apparently (and other than I have hoped it would be) the .NET ClientWebSocket class does not work with UWP (cf. Issue #59 ). In order to get RosBridgeClient Websocket communication running for UWP you have the following options:
@lee4138 informed us in issue #83 that he also has problems with other dependencies for UWP. |
So I've written a WebSocket client based on Windows.Networking.Sockets that implements IProtocol. you can see it on my fork here. I'm currently testing now. The problem with it is that I don't see a way of compiling it into the RosBridgeClient.dll, since it requires a WindowsUWP compilation target, and the other WebSocket clients require .NET Framework 4.6 targets. I think the best solution will be to make two .dlls, and use specify which one include/exclude depending on the Unity Build Target (this can be done in the Unity editor). As far as the other .dll dependencies, we can do roughly the same thing. I know Newtonsoft.Json has a UWP .dll, for instance. |
Okay, so I've tested my code, and my WebSocketUWPProtocol.cs file works. I have the working branch here. In this branch, I removed the RosBridgeClient.dll and UrdfImporter.dll and added all source code to the unity project, to streamline my development. If this branch were ever to be merged into master, the next step would be moving the Library code back out of Unity, and setting up a UWP build target for RosBridgeClient.dll. Even if we did that though, there would still need to be preprocessor directives peppered all over the RosBridgeClient object. I can't think of a way around that. |
Hi all, |
Great job @dwhit ! We now proceed as follows:
|
Hi all! |
@tarukosu nice! |
Hey all, my fork is done! You can view it here: https://github.com/dwhit/ros-sharp I edited the main Readme with instructions for installation, and an overview of the architecture for others who would want to edit or extend it. |
Hi @dwhit, |
I agree it should be closed, but I didn't actually open it, @arunavanag591 did. |
@dwhit thank you so much for your UWP implementation of ROS#. I would like to ask you one question regarding your fork. According to the readme, Unity 2018.x is required but it is not clear if the MixedRealityToolkit-Unity can support higher Unity versions than 2017.x. Could you share with us what configuration of Unity and MixedRealityToolkit-Unity you have tested and confirmed working? Maybe this should be included into the readme of your fork? Thank you in advance for your help. |
Hi @lotfielhafi!, I can run the MixedRealityToolkit without issues on 2018.2. I just followed the install instructions from the Getting Started page. I'll add this info to the Readme! |
Hi all, I just went through the process of integrating ROS# with Unity 2018.3 for the HoloLens and wanted to share what I did as it is a bit different from what is described by @dwhit in his fork:
|
Hey @roalchaq, my team and I are currently stuck on a project and we're wondering if we can ask you a few questions. I can't seem to find any contact details on your profile, please feel free to message me. |
Hello,
I would like to send an array of float values as a std_msgs/String. However, I could not locate many examples for publishing message from Unity to ROS except for CameraImagePublisher.cs. Is it possible using ros-sharp?
My message would look something like this: "[718.23, 234.21, 324.54 . . . . .. ]"
Also, after importing ROS-sharp as given here. The menu items do come, but when I am building it for UWP,
the following errors are thrown:
I don't know why these errors are thrown as in the plugins the ROSBridgeClient.dll is already imported. I am building it as a C# project, to deploy onto my mixed reality device.
The text was updated successfully, but these errors were encountered: