ARM LAB / STUDY / LEVEL 3 OF 8

The
parts.

The joint table says where the joints are, but nothing about what the arm looks like. The looks come from 13 STL files, one per 3D-printed shell or motor. An STL is the simplest 3D format there is: a list of triangles, each with three corners and a normal (which way it faces). The designers drew the parts as solids in CAD software and exported them; the export cut every curved surface into triangles. This page opens one of the real files, the base's mounting plate, with the scene's own stl.js, and then hangs it on its link the way armLab.js does.

CAD soliddesigned in Onshape; exact curves and dimensions
→
STL exportevery surface cut into triangles with normals
→
stl.jstext → vertex array → clay.defineMesh(name)
→
placed on its linkadd(name).move(xyz).turnZ.turnY.turnX

waveshare_mounting_plate_so101_v2.stl

loading…

Drag to turn the view. Flat shading: each triangle's brightness comes from its normal, which is why the file stores one. Thin lines are the triangle edges.

The first triangle, as text in the file

From file to link

the mesh never changes; its frame does

base_link's meshes in the table

stlxyz (m)rpy (rad)

The loader

stl.js, the course's file, run by this page

Fetch the text, split it at every facet, pick the three vertices and the normal out of each piece by position in the word list, and hand the array to clay.defineMesh. From then on the part's name is a shape, like 'sphere'.


      

Hanging a part on its joint

armLab.js

Loading is asynchronous, so every frame the scene asks clay.formMesh(name) whether a part has arrived, and adds it once. A part is a child of its joint's node, placed by the table's xyz/rpy, so it moves with the joint for free.


      
    

What you should be able to explain

  1. CAD versus STL. CAD stores exact geometry: "a cylinder of diameter 30 mm with a 4 mm hole". STL stores only a skin of triangles approximating it. CAD is for designing; STL is for printing and drawing.
  2. Why triangles. Three points always lie on one plane, so a triangle is always flat and a GPU can fill it. Every curved thing you see in VR is many small flat triangles.
  3. Why normals. Shading needs to know which way a surface faces. The file stores a normal per triangle so nobody has to recompute it; stl.js copies it next to every vertex.
  4. The part is dumb, the frame is smart. The triangles' coordinates are in the part's own frame and never change. Where the part appears comes entirely from the node it is attached to: its xyz/rpy in the link, the link's joint matrix, and everything above (level 2).
  5. Size. The gripper's moving jaw alone is 28,270 triangles and 9.5 MB as text, which is why the parts appear one by one for a few seconds after the scene starts.

Exercises: ① Reduce the triangles drawn to 20 %: which features of the plate disappear first, and why? ② Switch to "placed on base_link": which rpy value turned the plate upright? ③ The motor sts3215_03a_v1 appears five times in the tables with different xyz/rpy. How many times is its STL loaded, and how many nodes show it?