dfki-ric / phobos

An add-on for Blender allowing to create URDF, SDF and SMURF robot models in a WYSIWYG environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Materials don't always get fully added to urdf

23pointsNorth opened this issue · comments

Describe the bug
When exporting a model with a plain color material (principled BSDF, GGX, base color) per object, sometimes the last material doesn't get fully appended to the urdf - e.g.

### All materials referenced correctly in URDF file

<material name="bucket_material">
  <color rgba="0.15686 0.06667 0.07451 1.00000"/>
</material>
<material name="swivel_material">
### end of file

To Reproduce
Steps to reproduce the behavior:

  1. Create multiple objects with at least a couple of meshes in dae (unsure if relevant)
  2. add material to them
  3. export to URDF

Expected behavior

  1. When exporting finishes, a message to the user to appear that it has completed (I assume on larger models it may take time and writing to the file buffer may not have flushed)
  2. The full materials list to be completed.

Desktop (please complete the following information):

  • OS: Ubuntu Version [e.g. 22.04]
  • Blender version 3.3
  • Phobos version from 21 Sept

Hi @23pointsNorth ,
thanks for reporting your issue.
I tried reproducing this using the aliengo model and edited the materials, added a new mesh, added a new material to that and exported everything to dae. However I couldn't reproduce your issue.

Could you please share more information? If possible your blend file or a minimal example. Also a screen shot of the material settings of swivel_material would help.

The annoying part is that the issues is stochastic, where there may be times where it half flushes things, and sometimes pushes the whole file out.

I've attached the blend file. machine.zip

And the material tab.
Screenshot from 2023-09-25 11-23-31

P.S. The export paths in Linux (Ubuntu) by default are empty (best to set it to e.g. ./ or if relative is always prefixed by //, which is unnatural and e.g. if in ~, then //Downloads is actually /Downloads and not /home/{user}/Downloads.

Thanks, I'll have a look. In the meantime, could you start blender from terminal? Then you'll get the outputs during export. maybe there might be a hint why this issue occurs when it occurs.

RE: PS: This // is a blender thing which corresponds to the current blend file. without // the path corresponds to the working directory of the blender process. If there is no blend file and no path given at all it should be written to your phobos-models in your home directory. I also added a message in the info panel.
The problem with the path field is that - why so ever - when blender loads phobos the phobos add-on preferences are not yet available. If you click the path field and leave it it should be filled then.

Ok I tried your example several times, for me it worked everytime.

Funny thought: Are you using gedit to view the urdf on Ubuntu? I sometimes have an issue with gedit, that it isn't able to scroll down to the very end of the file. Resizing the window or opening in another editor solves this.

Generally I am using Sublime Text. Maybe it's something else on my end.
Happy to close the issue unless I can consistently replicate.

(Sorry, this became longer than expected. Latest blend.)

  1. Unrelated, alas with the same blender file, adding an IMU sensor to the base_link is fine. Adding a GPS (to any link) results in the following error:

Screenshot from 2023-09-25 15-56-51

Am I missing something with the link tree and how sensors are added [Hardware -> Add Sensor -> name/category:GPS]?

  1. How do you change the FOV for a camera to be in radiant rather than degrees? (currently looking at e.g. 90', rather than pi/2)
  2. When I export the SDF or URDF, the camera sensors list are grouped and added in the begining/end. However, importing things to gazebo requires for them to be part of the link definition. Is there an option I haven't seen?

Expected

<sdf version="1.9">
<model name="machine" canonical_link="base_link">
<link name="base_link"> # inside link
    ...
    <sensor name="cabin_camera" type="camera">
      <pose relative_to="base_link">1.38000 0.50000 3.20000 1.57080 0.00000 -0.17453</pose>
      <always_on>1</always_on>
      <update_rate>30</update_rate>
      <visualize>true</visualize>
      <enable_metrics>true</enable_metrics>
      <camera name="cabin_camera">
        <horizontal_fov>1.52</horizontal_fov> # in rads
        <image>
          <width>640</width>
          <height>480</height>
        </image>
      </camera>
    </sensor>
  </link>

Actual:

<sdf version="1.9">
<model name="machine" canonical_link="base_link">
  <sensor name="cabin_camera" type="camera">
    <pose relative_to="base_link">1.38000 0.50000 3.20000 1.57080 0.00000 -0.17453</pose>
    <always_on>1</always_on>
    <update_rate>30</update_rate>
    <visualize>true</visualize>
    <enable_metrics>true</enable_metrics>
    <camera name="cabin_camera">
      <horizontal_fov>90</horizontal_fov>
      <image>
        <width>640</width>
        <height>480</height>
      </image>
    </camera>
  </sensor>

  <link name="base_link"> 
  ...
  </link>
  1. When looking at the published frames in Rviz, the tf tree publishes all frames from the base frame, rather than following the parent/child hierarchy. I should assume I've messed up things on gazebo end, and that is not a problem here, right?
  2. Changing the name of a link with a child (IMU) sensor gives error on export. Removing sensor and re-adding it allows exporting to happen. Error contains the previous name of the link.
  3. (probably linked to 2) In the alt text of the motor controller dialogue box, on the max_speed field, the label mentions "uncheck radian to ...", however, the dialogue box doesn't contain a checkbox.

Hi @23pointsNorth,

  1. should be fixed: c8bc7cf
  2. Currently there is no option... So I guess you have to take the calculator...
  3. Could you please open a separate issue regarding this?
  4. Please check the relative_to attribute in the corresponding link/joint in your SDF. If they point to the corresponding parent, check gazebo, other wise, please open a separate issue as well.
  5. Plesae try this again with the latest master, if it persists please open a separate issue and include the full error message.
  6. Unfortunately same answer as for 2. I removed the misleading hint.

Thanks for all your testing. Sorry that I ask you to open that many issues, but that makes it easier to track and resolve the different bugs. The rad/deg thing is something we might add properly again. but has not the highest priority. Feel free to open a feature request.

As that what this issue was opened for seems solve I close this. (see #322 (comment))

No worries, I was looking at the anybotics issue and assumed the preferred method is within a single issue.

[FOV rads] Currently there is no option... So I guess you have to take the calculator...

Maybe I am within my own bubble, but where do folks use sdf/urdfs for? I've been in the ROS + Gazebo ecosystem and maybe those are some non-backwards compatible items that have occurred. (ROS Humble + Gazebo Garden 7.5)

No worries, I was looking at the anybotics issue and assumed the preferred method is within a single issue.

I see, here it helps me getting my todo list straight and thereby I can reference the issue in the fixing commit and others with the same problem can contribute to that issue. ;)

[FOV rads] Currently there is no option... So I guess you have to take the calculator...

Maybe I am within my own bubble, but where do folks use sdf/urdfs for? I've been in the ROS + Gazebo ecosystem and maybe those are some non-backwards compatible items that have occurred. (ROS Humble + Gazebo Garden 7.5)

I'm no longer sure whether I understand your question.
Are you looking for a convenient method of typing angles in phobos or of specifing the type written to sdf/urdf?
I don't know for sdf but I'm pretty sure urdf can only handle radiant...

I'm no longer sure whether I understand your question. Are you looking for a convenient method of typing angles in phobos or of specifing the type written to sdf/urdf? I don't know for sdf but I'm pretty sure urdf can only handle radiant...

That was my intuition as well, that the sdf/urdf assumes radinats (but currently phobos exports degrees for the camera fov).
So, I assumed there was another tool that uses the phobos output (not ros/gazebo), and thus it exporting the camera sensor in degrees being ok. So was curious if that was the case.

Ohhhh now I get the point. Yes phobos is bascially agnostic of the units provided. So when you put for the opening height/width radiant, it will export them. However the defaults before where defined in degree, as in other exports this was asked for in degree.

OK so summarized we have to ensure that sdf/urdf cameras receives fov data in rad.