Skip to content
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

Using this library with ROS2 #315

Open
maxlein opened this issue May 19, 2020 · 10 comments
Open

Using this library with ROS2 #315

maxlein opened this issue May 19, 2020 · 10 comments

Comments

@maxlein
Copy link

maxlein commented May 19, 2020

I am not sure if this is a bug or just not supported.
But as the timestamp msg has changed from "sec" to "secs" I can only use the ROS1 bridge and not the ROS2 version -> ros2-web-bridge

Is this something known, or in the pipeline?

@berkayalpcakal
Copy link
Contributor

Hi @maxlein,

As far as I know, ROS# is not tested with ros2-web-bridge. If only problem is the naming of the message fields, then you can change the field names in the message classes manually on your local fork. For the timestamps in the header, Timer.cs is the corresponding script where you can see the "sec" field. You just need to make the necessary changes, then rebuild the library and replace the dll's on the plugins folder.

I hope that the difference in the naming convention is the only problem. Could you please right down your experiences regarding the use of ROS# with ros2-web-bridge? There is a plan to implement ROS2 support for ROS# soon, your experience could help us.

@maxlein
Copy link
Author

maxlein commented May 20, 2020

I only looked at some messages till now and they work with these small fixes:

diff --git a/Libraries/RosBridgeClient/BaseMessages/Std/msg/Duration.cs b/Libraries/RosBridgeClient/BaseMessages/Std/msg/Duration.cs
index e7851bb..0db29d5 100644
--- a/Libraries/RosBridgeClient/BaseMessages/Std/msg/Duration.cs
+++ b/Libraries/RosBridgeClient/BaseMessages/Std/msg/Duration.cs
@@ -19,19 +19,19 @@ namespace RosSharp.RosBridgeClient.MessageTypes.Std
 	{
         public const string RosMessageName = "std_msgs/Duration";
 
-        public uint secs { get; set; }
-        public uint nsecs { get; set; }
+        public uint sec { get; set; }
+        public uint nanosec { get; set; }
 
         public Duration()
         {
-            secs = 0;
-            nsecs = 0;
+            sec = 0;
+            nanosec = 0;
         }
 
-        public Duration(uint secs, uint nsecs)
+        public Duration(uint sec, uint nanosec)
         {
-        	this.secs = secs;
-        	this.nsecs = nsecs;
+        	this.sec = sec;
+        	this.nanosec = nanosec;
         }
 	}
 }
\ No newline at end of file
diff --git a/Libraries/RosBridgeClient/BaseMessages/Std/msg/Time.cs b/Libraries/RosBridgeClient/BaseMessages/Std/msg/Time.cs
index 5ae121c..525a476 100644
--- a/Libraries/RosBridgeClient/BaseMessages/Std/msg/Time.cs
+++ b/Libraries/RosBridgeClient/BaseMessages/Std/msg/Time.cs
@@ -18,19 +18,19 @@ namespace RosSharp.RosBridgeClient.MessageTypes.Std
     public class Time : Message
     {
         public const string RosMessageName = "std_msgs/Time";
-        public uint secs { get; set; }
-        public uint nsecs { get; set; }
+        public uint sec { get; set; }
+        public uint nanosec { get; set; }
 
         public Time()
         {
-            secs = 0;
-            nsecs = 0;
+            sec = 0;
+            nanosec = 0;
         }
 
-        public Time(uint secs, uint nsecs)
+        public Time(uint sec, uint nanosec)
         {
-            this.secs = secs;
-            this.nsecs = nsecs;
+            this.sec = sec;
+            this.nanosec = nanosec;
         }
 
     }

@alexandar1000
Copy link

Hello!

My team and I are quite new to ROS and are just starting a project to connect it to Unity which is to be used as a simulator. Initially, our choice was to use ROS2 and make use of the fact that it provides some new functionality and will possibly be a bit more long-term solution. However, upon realising that ROS#, an important tool for connecting the two, does not fully support ROS 2, I am left puzzled on which version of ROS to use.

Knowing this, and taking our unfamiliarity with the tools into consideration, would you say that it is better to use ROS1 until ROS# fully supports ROS2 and is tested sufficiently, or to use ROS2 anyways and adapt it as @maxlein suggested?

Additionally, @maxlein, did you encounter any additional issues upon implementing this fix, or was that the only problem?

Any advice would be immensely appreciated! Thank you in advance!

@maxlein
Copy link
Author

maxlein commented Jul 7, 2020

No, I had no other issues. Works fine and the fix is easy to implement.
I may write a tutorial on ROS2 and Unity in the coming days.

@alexandar1000
Copy link

Thank you for the update, really appreciate it!

@BarzelS
Copy link

BarzelS commented Oct 26, 2020

No, I had no other issues. Works fine and the fix is easy to implement.
I may write a tutorial on ROS2 and Unity in the coming days.

Did you end up writing a guide on this subject? where can I find it?

@sttobia
Copy link

sttobia commented Oct 20, 2022

Hi @maxlein,

As far as I know, ROS# is not tested with ros2-web-bridge. If only problem is the naming of the message fields, then you can change the field names in the message classes manually on your local fork. For the timestamps in the header, Timer.cs is the corresponding script where you can see the "sec" field. You just need to make the necessary changes, then rebuild the library and replace the dll's on the plugins folder.

I hope that the difference in the naming convention is the only problem. Could you please right down your experiences regarding the use of ROS# with ros2-web-bridge? There is a plan to implement ROS2 support for ROS# soon, your experience could help us.

Hello everyone,
Thanks for this library and the effort!
I just wanted to check in on the plans of implementing ROS2 support. Is this still planned in the near future, so that the changes stated here are not required to be made whenever we use the library together with ROS2.
Thank you for an update on this topic.

@Skoven
Copy link

Skoven commented Mar 21, 2023

Hi,

I have now compiled a version of the Visual Studio project that makes it ROS2 compatible. So far I have only looked at the communication itself, so changes to the RosBridgeClient.dll. The MessageGenerator.dll and the URDF.dll might already work for ROS2, but i have not checked that yet.

I have created a fork of this repository with a branch called ros2: https://github.com/Skoven/ros-sharp/tree/ros2
Here is both the edited C# code, but also updated RosSharp folder for placing in the Unity project Asset folder:
com.siemens.ros-sharp/Assets/RosSharp

The issues fixed where:

  1. Fixing the timing labels. So going form secs to sec and nsecs to nanosec
  2. Removed .seq from header as this is not a part of ROS2
  3. Found that ROS2 puts "null" in unused parts of JointState msgs. The Json deserialiser of the ros-sharp library cannot handle this. I have just solved this by searching through the string an replacing "null" with 0.0

I hope that this will be of some help to poor souls like me, that struggle with getting ros-sharp to work with ROS2.

@Dabuss
Copy link

Dabuss commented Oct 28, 2024

Hi,

I recently discovered this library and really like it so far, the documentation is great, and I've found it very easy to use so far!

However, I just noticed that actions are not supported for ros2. Are there any plans to make it up to date with the advances in rosbridge_suite, for action support in ros2 (see RobotWebTools/rosbridge_suite#886)?

Thanks!
David

@memrecakal
Copy link
Collaborator

Hi @Dabuss,

Thank you for your interest. It's good to hear that you like it and find it easy to use. Yes, we are planning to add support for ROS2 actions. We didn't include it in the update because the way actions are handled has changed considerably from ROS1 to ROS2 and we want to take our time to implement it as properly as possible. I can't give you an estimated date for action support at the moment, but it's in our todo list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants