siemens / ros-sharp

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity3D
Apache License 2.0
945 stars 364 forks source link

"URDF Model (New)" Have No Rigidbodies, New Links Have No Joints #404

Closed kneave closed 2 years ago

kneave commented 2 years ago

I have a question!

Here is my question:

Following the "create a new URDF" tutorial I found that none of the new links had joints created. In the video no extra steps were needed for this but I found I needed to manually add a rigidbody to the base_link in order for joints to be created in the manner shown in the video. I couldn't find reference to adding the rigidbody in the wiki or previous issues. Is this change by design or a regression of some kind?


I found a bug!

Here is my bug description:

Creating a new URDF doesn't include a rigidbody on the base_link, this prevents joints being created.

Perform the following steps reproduce the bug:

  1. Create a new 3d object by selecting "urdf (new)" in the 3d objects menu
  2. Click on the base_link and add a new link
  3. Look at the newly created link, there will be no joint present

Observed results:

Base_link on a new model with no rigidbody image

Newly created child link, no joint component image

Expected results:

Base_link with rigidbody image

New children have joints image

MartinBischoff commented 2 years ago

Hi @kneave ! we didn't add a rigidbody by default, because links in URDF can also come without `inertial' tag. By adding a rigidbody manually, users can add the inerial tag. It is correct that joints require rigidbodies in both parent and child link.

kneave commented 2 years ago

Hi Martin, this is from creating a new model completely in Unity so no URDF imported in this case. If it's expected behaviour that the user adds a rigid body could I suggest the video demo be updated to show this please or it be included in a the documentation?

MartinBischoff commented 2 years ago

Hi @kneave , I digged a bit deeper into this issue. We changed the functionality in commit https://github.com/siemens/ros-sharp/commit/f15f3f9eeec0d46b7dbb3dfbc4364eeef8e7fbe8 to not automatically generate rigidbodies in this case.

The problem is that URDF does not require <inertial> tags (i.e. rigidbody data) whereas Unity requires rigidbodies to create joints between transforms (i.e. links). We had discussions whether to create a default rigidbody to a new/empty link or not since the beginning and didn't find a clear answer yet.

In pull request #405 I changed it back, such that creating a new link in Unity also creates a rigidbody / default inertial data. It seems like this is the more convenient / user friendly solution. Would you please test if it works for you?

kneave commented 2 years ago

I just pulled that branch and it looks like it works as I'd expect from the demo video, thanks for the quick update! Good call with the Newtonsoft.Json fix too. :)

MartinBischoff commented 2 years ago

Merged in https://github.com/siemens/ros-sharp/commit/6e91309b2447c0919d3dabaa0650bb71e3e490dd . Thank you @kneave .