rbdl / rbdl-toolkit

Application for visualizing and working with rbdl models
European Union Public License 1.2
19 stars 11 forks source link

Wireframe without mesh not showing up if no meshes are defined #20

Closed jfslin closed 1 week ago

jfslin commented 3 years ago

I tried loading the following double pendulum Lua model and was expecting to see the wireframe, but instead got a blank screen. No error messages shown.

Probably not urgent since the tutorial will show how to incorporate standard meshes so it's less of a concern, I think.

rod_length = 1

model = {
  gravity = { 0, -9.81, 0 },

  configuration = {
    axis_right = { 1, 0, 0 },
    axis_front = { 0, 1, 0 },
    axis_up =    { 0, 0, 1 },
  },

  frames = {
    {
      name = "segment1",
      parent = "ROOT",
      visuals = { meshes.rod1 },
      joint = {{ 0, 1, 0, 0, 0, 0 }},
      joint_frame = {
        E = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
      }
    },
    {
      name = "segment2",
      parent = "segment1",
      joint = {{ 0, 1, 0, 0, 0, 0 }},
      joint_frame = {
        r = { 0., 0., -rod_length },
        E = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
      }
    },
    {
      name = "segment3",
      parent = "segment1",
      joint = {{ 0, 1, 0, 0, 0, 0 }},
      joint_frame = {
        r = { 0., 0., rod_length },
        E = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
      }
    }
  }
}

return model

Loading the proper meshes did provide the wireframe though:

rod_length = 1

meshes = {
  rod1 = {
    color = { 1, 0, 0},
    mesh_center = {0, 0, -rod_length/2},
    dimensions = { 0.1, 0.1, rod_length},
    src = "unit_cube.obj"
  },
  rod2 = {
    color = { 0, 1, 0},
    mesh_center = {0, 0, -rod_length/2},
    dimensions = { 0.1, 0.1, rod_length},
    src = "unit_cube.obj"
  }
}

model = {
  gravity = { 0, -9.81, 0 },

  configuration = {
    axis_right = { 1, 0, 0 },
    axis_front = { 0, 1, 0 },
    axis_up =    { 0, 0, 1 },
  },

  frames = {
    {
      name = "segment1",
      parent = "ROOT",
      visuals = { meshes.rod1 },
      joint = {{ 0, 1, 0, 0, 0, 0 }},
      joint_frame = {
        E = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
      }
    },
    {
      name = "segment2",
      parent = "segment1",
      visuals = { meshes.rod2 },
      joint = {{ 0, 1, 0, 0, 0, 0 }},
      joint_frame = {
        r = { 0., 0., -rod_length },
        E = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
      }
    },
    {
      name = "segment3",
      parent = "segment1",
      visuals = { meshes.rod2 },
      joint = {{ 0, 1, 0, 0, 0, 0 }},
      joint_frame = {
        r = { 0., 0., rod_length },
        E = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
      }
    }
  }
}

return model