Author Topic: Mesh export  (Read 2752 times)

sgal

  • Robots in Architecture Members
  • Forum User
  • *
  • Posts: 1
    • View Profile
Mesh export
« on: May 24, 2019, 11:59:35 AM »
Hi everyone,

I would like to output a robot's mesh and current six axis angle values to send them to another program over the network for visualization in HoloLens.
However, I'm not very proficient at Grasshopper yet. Could you please give me some pointers which nodes to use in GH and how to set them up? I think I can take it from there.

Thanks for you time,
Stefan

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1361
    • View Profile
    • Robots in Architecture
Re: Mesh export
« Reply #1 on: May 24, 2019, 01:01:01 PM »
Hello Stefan,

The Robot Geometry output provides three data trees:
The first one contains the meshes, the second one the color of those meshes and the third one the curves.
Note that the order inside those lists is not always the same due to multithreading.
I'm not sure if it's ideal to send e.g. 20 lists of robot meshes per second, maybe making a simple forward kinematic model of the robot within Unity - or whatever you are using for the HoloLens - would be easier.

Attached is an example on how to get the axis values. You will need to activate enable the Output Analysis Values option in the settings.

Best,
Johannes

ghostmu

  • Forum User
  • *
  • Posts: 7
    • View Profile
Re: Mesh export
« Reply #2 on: December 08, 2021, 08:01:24 PM »
Hi, Johannes

I've encountered similar problem as above.

I'm using Mindesk, which enables grasshopper to live-link geometry to Unreal Engine, but any other mesh/curve I've created inside grasshopper is fine, but it doesn't work the mesh output from kuka|prc component, even when I try to link only one item from the list.


ghostmu

  • Forum User
  • *
  • Posts: 7
    • View Profile
Re: Mesh export
« Reply #3 on: December 08, 2021, 08:13:09 PM »
Hello Stefan,

The Robot Geometry output provides three data trees:
The first one contains the meshes, the second one the color of those meshes and the third one the curves.
Note that the order inside those lists is not always the same due to multithreading.
I'm not sure if it's ideal to send e.g. 20 lists of robot meshes per second, maybe making a simple forward kinematic model of the robot within Unity - or whatever you are using for the HoloLens - would be easier.

Attached is an example on how to get the axis values. You will need to activate enable the Output Analysis Values option in the settings.

Best,
Johannes

Hi, Johannes

I've noticed one thing, the item number in the mesh list from geometry list is always changing, could this be the problem when streaming mesh to other softwares?

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1361
    • View Profile
    • Robots in Architecture
Re: Mesh export
« Reply #4 on: December 08, 2021, 09:03:35 PM »
Hello,

KUKA|prc uses some parallelization to calculate with more performance, this is the reason that the order sometimes changes. You could sort the meshes e.g. by the number of vertices - that should not take significant computational power and solve that issue for you.
However, the parallelization happens only internally, to the outside there should not be any special things happening.
I don't know Mindesk, but I could imagine that it generates a mesh and then only updates the position of the vertices when they change. So try the sorting I suggested above first, please.
If that does not help, please let me know if there are any error messages or indicators, what may be going wrong.

Best,
Johannes

ghostmu

  • Forum User
  • *
  • Posts: 7
    • View Profile
Re: Mesh export
« Reply #5 on: December 09, 2021, 08:34:25 AM »
Hello,

KUKA|prc uses some parallelization to calculate with more performance, this is the reason that the order sometimes changes. You could sort the meshes e.g. by the number of vertices - that should not take significant computational power and solve that issue for you.
However, the parallelization happens only internally, to the outside there should not be any special things happening.
I don't know Mindesk, but I could imagine that it generates a mesh and then only updates the position of the vertices when they change. So try the sorting I suggested above first, please.
If that does not help, please let me know if there are any error messages or indicators, what may be going wrong.

Best,
Johannes

Hi

I tried sorting mesh with vertices numbers, it didn't solve the problem.

I get these logs from rhino prompt:

Exception :: Index was outside the bounds of the array.
Exception ::    at Rhino.Geometry.Collections.MeshTextureCoordinateList.get_Item(Int32 index)
   at Mindesk.ExternalViewer.getMergedMeshes(IEnumerable`1 meshes, Int32 texture_parameter)
   at Mindesk.MindeskGHComponent.SolveInstance(IGH_DataAccess DA)

ghostmu

  • Forum User
  • *
  • Posts: 7
    • View Profile
Re: Mesh export
« Reply #6 on: December 09, 2021, 08:41:30 AM »
Hello,

KUKA|prc uses some parallelization to calculate with more performance, this is the reason that the order sometimes changes. You could sort the meshes e.g. by the number of vertices - that should not take significant computational power and solve that issue for you.
However, the parallelization happens only internally, to the outside there should not be any special things happening.
I don't know Mindesk, but I could imagine that it generates a mesh and then only updates the position of the vertices when they change. So try the sorting I suggested above first, please.
If that does not help, please let me know if there are any error messages or indicators, what may be going wrong.

Best,
Johannes

Hi

I managed to succesfully stream the mesh to Unreal Engine by disabling texture mapping for the meshes.

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1361
    • View Profile
    • Robots in Architecture
Re: Mesh export
« Reply #7 on: December 09, 2021, 08:50:47 AM »
Thanks a lot for the update!
Is that setting a component in Grasshopper or part of Mindesk?
In any case, robot meshes are built based on internalized lists of vertices and faces, they do not contain any texture (mapping) information.
Best,
Johannes

ghostmu

  • Forum User
  • *
  • Posts: 7
    • View Profile
Re: Mesh export
« Reply #8 on: December 09, 2021, 05:26:13 PM »
Thanks a lot for the update!
Is that setting a component in Grasshopper or part of Mindesk?
In any case, robot meshes are built based on internalized lists of vertices and faces, they do not contain any texture (mapping) information.
Best,
Johannes

It's part of Mindesk, it tries to pre-assign a plane/box/cylinder texture mapping before sending mesh to UE, it's fine as long as this auto-mapping is disabled.

But the mesh itself is still quite heavy. Animation or in my case, I'm using a joystick to control the position of robotarm's target using udp receiver, there's noticeable frame lost when streaming to UE, still, it's interesting as an experiment.

Would be nice if there's an option to use really low polygon number meshes for these kind of real time visualization purposes, as it utilizes UE, for VR/Hololens scenarios. 
« Last Edit: December 09, 2021, 05:33:02 PM by ghostmu »

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1361
    • View Profile
    • Robots in Architecture
Re: Mesh export
« Reply #9 on: December 09, 2021, 08:14:10 PM »
My suggestion would be to extract a transformation, e.g. based on three vertices of the mesh, and then only transfer the transformation to Unreal and move the meshes there.
You will have some challenges with the different coordinate systems, but maybe Mindesk takes care of that for you.
Alternatively you can use the low-resolution robot meshes in the settings, they can be a bit ugly though. Also, recompute your solution once, otherwise there are some wrong colors.

Best,
Johannes

ghostmu

  • Forum User
  • *
  • Posts: 7
    • View Profile
Re: Mesh export
« Reply #10 on: December 09, 2021, 09:20:01 PM »
My suggestion would be to extract a transformation, e.g. based on three vertices of the mesh, and then only transfer the transformation to Unreal and move the meshes there.
You will have some challenges with the different coordinate systems, but maybe Mindesk takes care of that for you.
Alternatively you can use the low-resolution robot meshes in the settings, they can be a bit ugly though. Also, recompute your solution once, otherwise there are some wrong colors.

Best,
Johannes

Good idea, will definitely try it out. Thanks a lot for the help!