# Lecture 02 — CAD, Units, Meshes & Coordinate Frames

## 01 | A plausible model can be geometrically wrong

Today we move from laboratory measurement into the geometry pipeline. A robot simulator cannot rescue a geometric model that describes the wrong object. The model might have a polished rendered surface, convincing shadows, and all the expected labels, yet the collision geometry could be offset, scaled incorrectly, or attached to a different coordinate frame. Our job is to make those choices explicit and test them before attributing an error to physics.

Imagine a gripper closing around a metal part. In the physical experiment, the fingers touch a rounded shoulder. In the simulator, a simplified box collider contacts a sharp corner. The visible images look similar, but the first contact point, normal direction, lever arm, and available rotational moment all differ. Increasing friction might conceal this discrepancy for one test while making other grasps less realistic. This is a geometry error with a dynamics symptom.

A reliable workflow starts with source measurements, a unit contract, an agreed world frame, and a small set of named object frames. Then we create a geometry hierarchy: visual meshes for appearance, collision primitives or simplified meshes for contact, and inertial descriptions for dynamics. These are related, but not interchangeable. We compare the compiled simulator model against the physical dimensions, not just against the original CAD viewport.

In the next ten scenes, we will follow one part through import, transformation, collision approximation, and validation. We will use illustrative values, and distinguish a visualization from a measurement. The objective is not a beautiful import screenshot. It is a reproducible asset whose shape, placement, contact behavior, and physical metadata have evidence behind them.

## 02 | Units are part of the physical model

A common CAD failure begins with a silent assumption about scale. One engineering file may store dimensions in millimeters, another in centimeters, and a simulator may interpret mesh coordinates in meters. If a one-hundred-millimeter block is treated as one hundred meters, the linear scale is a thousand times too large. This affects not only reach and collision clearance but also mass and inertia when these are derived from geometry.

Write the units at every boundary of the pipeline. For a measured block with dimensions one hundred by sixty by forty millimeters, the simulator dimensions should be zero point one, zero point zero six, and zero point zero four meters. Don't rely on the importer's automatic unit detection without testing it. Measure the axis-aligned bounding box after importing and compare each dimension against the source. Also inspect whether a transform includes a scale factor that is applied twice.

Scale errors propagate differently depending on what you hold constant. If all linear dimensions change by a factor of s while density stays fixed, volume and mass scale as s cubed, and rotational inertia as s to the fifth power. If the mass is instead supplied independently and held fixed, the inertia scales as s squared for similar shapes. Those statements describe different physical assumptions. We must know which one the asset pipeline actually uses.

Unit mismatches also apply to angles and time. Degrees are not radians. A ninety-degree angle is pi over two radians, not ninety radians. Controller sample timestamps might be milliseconds when the simulation expects seconds. Build checks for length, angle, mass, time and density, and test all of them with known references before deploying large asset collections.

## 03 | Frames form a chain, not a collection of guesses

Every pose is expressed relative to some frame. A camera sees points in camera coordinates. A gripper fingertip has coordinates relative to its wrist. A CAD component may be defined relative to an assembly origin. A simulator integrates positions in world coordinates. To compare these descriptions, we must specify an ordered transformation chain with a clear direction at each edge.

For a point represented as a three-dimensional vector, a rigid transform applies a rotation and a translation. We can write the world point as R times the local point plus t. In homogeneous coordinates we embed R and t in a four-by-four matrix. Composition then becomes matrix multiplication, but multiplication order matters. A transform from a part into a wrist followed by one from wrist into world is not the same as multiplying those transforms in the reverse order.

A useful naming convention is to make the destination and source explicit: world from wrist, wrist from part, and therefore world from part. Inverted transforms convert in the opposite direction. Choose one convention and put it in the variable names, lab report and diagrams. Then verify it with an asymmetric object or marker rather than a perfectly symmetric cube that conceals errors.

Let's animate a small marker attached to the part. First rotate the part ninety degrees about a known axis; then translate its parent frame. The marker follows the compounded transform. If you mistakenly translate before rotating, you may move the marker to a different location. The test is straightforward: transform known reference points forward, apply the inverse, and require that they return to their original coordinates within numerical tolerance.

## 04 | Rotation conventions deserve explicit tests

Rotations are particularly prone to plausible-looking mistakes. An orientation may be recorded as Euler angles, a rotation matrix, an axis-angle pair, or a quaternion. Each representation has conventions. Euler angles require a specified axis sequence, such as intrinsic ZYX, and rotations generally do not commute. Ninety degrees about X followed by ninety degrees about Y produces a different result from the reverse order.

Quaternions avoid some Euler-angle singularities and interpolate rotations usefully, but their component order is not universal. Some APIs use w, x, y, z; others use x, y, z, w. A copied four-number array may remain normalized while encoding an entirely different rotation. Remember that q and negative q represent the same physical orientation. Test semantic behavior rather than demanding identical raw quaternion signs.

Also check handedness, axis definitions, and camera versus robot frame conventions. A tool might describe Z as up while another asset uses Y as up. Without an explicit conversion, the scene can be rotated or mirrored. Mirroring is especially problematic: a reflection has negative determinant and is not a proper rigid rotation. It can change triangle winding and surface normals as well as pose.

The quickest orientation test uses an asymmetric triad of colored axes and one known ninety-degree rotation. Read the transformed positions of three reference points. Next verify an inverse round-trip and compare a rendered direction arrow with the actual joint axis in the simulator. Only after these tests should you evaluate the robot's movement. If a frame is wrong at rest, trajectories will not fix it.

## 05 | The visual mesh is not the collision model

A mesh can serve different purposes. The visual mesh exists to give the viewer the expected surface, materials, and silhouette. The collision representation determines where contact candidates occur and which normals are presented to the contact solver. An inertial model determines how forces affect motion. Treating all three as the same asset by default can create needless computational cost and misleading dynamics.

For collision, start with the simplest geometry that captures the task-relevant contact: a box for a rectangular housing, a capsule for a rounded limb, or several convex pieces for a complex assembly. Use a high-detail triangle mesh only when its extra fidelity is justified. A gripper contacting a narrow chamfer may require an accurate bevel. A mobile robot avoiding broad walls may not.

Show the collision geometry separately from the render mesh. Highlight contact patches, surface normals and penetrations. Check whether decorative bolts, interior faces, or invisible fixtures have accidentally become colliders. Also check mesh orientation, triangle degeneracy, non-manifold edges, overlapping components and numerical scale. The goal is not always to repair every artistic imperfection: it is to ensure the collision approximation reflects what the experiment actually measures.

A convex hull can erase holes and cavities. That may be fine for external obstacle avoidance but unacceptable when an insertion task depends on an opening. Conversely, a detailed mesh may be too expensive or unreliable for stable real-time contact. Document the approximation and test it with the manipulations that matter. A collision representation earns complexity through measured improvement, not polygon count.

## 06 | Geometry origins, centers of mass, and inertia frames

CAD files frequently put the origin at a convenient modeling location, not at the physical center of mass. A robot link can contain several visual meshes at different offsets while its body origin sits at the joint. Separately, the inertial frame identifies the center of mass and inertia tensor. These frames should not be conflated, even if a simple demonstration uses the same coordinates for all of them.

Consider a bracket with a heavy motor attached to one side. Its visual bounding-box center is not generally its center of mass. If we use a uniform box approximation, we may produce a misleading balance and tipping behavior. Measure the assembly masses or calculate them from defensible densities and component geometry. Then express the aggregate center of mass in the link frame and calculate the inertia about that center, rather than reusing a convenient display origin.

Parent transforms can also lead to double offsets. A mesh already exported in assembly coordinates might be given the same assembly offset again in the simulator. The part looks displaced, collision contacts occur where no physical surface exists, and joint motions follow strange arcs. Debug by drawing the link frame, visual frame, collision frame and inertial frame simultaneously, with colors and clearly named axes.

Our import audit should report four separate facts: the visual extent, the collision extent, the body transform, and the inertial center. If those values differ, that isn't necessarily a defect. It becomes a defect when the difference is unintended or undocumented. Making these differences visible early is far cheaper than trying to infer them from failed grasp trajectories.

## 07 | Assemblies, joints, and contact filtering

Real robots contain assemblies rather than isolated meshes. A CAD assembly describes parts and mating constraints; a robotics model adds joint types, axes, limits, actuators, inertial properties, and contact rules. These concepts overlap but are not directly interchangeable. Importing a set of visual meshes does not magically infer the correct kinematic tree or joint behavior.

Begin with parent-child structure. Establish where each joint frame lies and which bodies move relative to it. For a revolute joint, inspect the axis and sign using a small positive command. Check zero configuration, end stops and limits. For a prismatic joint, verify the translation direction and permitted travel. Cross-check the assembled robot in an obvious asymmetric pose so mirrored links and swapped axes are visible.

Contact filtering matters just as much. Adjacent robot links often overlap or sit close together by design. A model may explicitly exclude some self-contacts. Overly broad exclusions hide real collisions; too few exclusions create false contacts, jitter, or large constraint forces. When debugging, print actual contacting geometry names and include pairs you expect to touch and pairs you expect never to touch.

Exercise: import a two-link tool holder. First test each piece at rest, then rotate its joint without actuation dynamics, then enable collision detection, and finally apply force. This staged process distinguishes frame errors from geometry errors, contact filtering from solver behavior, and joint configuration from actuator calibration. Changing everything at once destroys that evidence.

## 08 | Import and inspect across simulator ecosystems

MuJoCo, Isaac Sim, and Gazebo offer different representations and tooling. A CAD file or USD scene can contain visual hierarchy, units, materials and transforms, while an MJCF or SDF model adds simulator-specific physics and contact configuration. Converting between these formats requires explicit decisions. There is no universal one-click import that guarantees all conventions, collision choices and physical parameters remain intact.

Use an interchange checklist. Start with length scale and up axis. Then inspect body hierarchy, mesh locations, joint frames, collision primitives, inertial centers and tensors. Check whether default contact parameters have changed and whether unsupported attributes were silently ignored. Keep one known test object in each pipeline as a control. A simple rectangle with a deliberately offset marker often exposes convention errors more reliably than a complicated robot model.

A useful automated importer produces a report before displaying the model. Record source file checksum, exporter and engine versions, mesh counts, object dimensions, axis conventions, frame offsets and warnings. Compare the compiled simulation model, not merely a parser's input values. For contact-sensitive tasks, run a standard collision probe and save the resulting contact normals and geoms.

The point of cross-engine testing is not to force every solver to produce identical trajectories. Different contact models and numerical methods can legitimately diverge. We want to separate representation mistakes from intentional modeling differences, then establish whether each engine predicts the relevant physical observation within our tolerance. This is an engineering acceptance test, not a beauty contest between renderers.

## 09 | A practical geometry validation harness

We can now put the checks into a reproducible harness. Begin with a known object and measured dimensions. Our illustrative part is one hundred by sixty by forty millimeters. After import into a meters-based model, the bounding box should be zero point one by zero point zero six by zero point zero four meters. Confirm the axes agree with the declared frame and that the visual and collision extents match their intended approximations.

Next, transform known local marker points into world coordinates and back. For a rigid transform with an orthonormal rotation matrix, inverse composition should return the original points. Compute the maximum round-trip error, and flag incorrect units or transforms before moving to dynamic tests. Then probe contact at several known surfaces and compare reported normals with the expected geometry. A collision primitive that is offset by a few millimeters may materially affect a precision manipulation task.

Add simple negative tests. Intentionally swap quaternion order, double a scale factor, and move a collision shape relative to its visual mesh. The harness should detect these mistakes. If it only passes well-formed models, we haven't demonstrated that it catches failures. Include a marker outside any symmetry plane, because symmetric objects may hide rotations and reflections.

Finally, record where approximations remain. A convex proxy may not represent a narrow groove; a uniform-density estimate may neglect an internal motor. These are model limitations, not necessarily import bugs. The result should be a short machine-readable geometry report with source metadata, explicit conventions, pass-or-fail checks, and task-specific exceptions. A colleague should be able to rerun it on the same version.

## 10 | Delivering a defensible asset

The deliverable for this lecture is an asset package, not just a screenshot. It should contain the source geometry or provenance, normalized metric coordinates, visual and collision representations, the kinematic and inertial frame map, a versioned simulator model, and an import audit. It should also state which details were measured and which were approximated. If physical tests are unavailable, say so clearly.

A good review opens with the intended task. For grasp planning, show the actual contact surfaces and any known tolerance-sensitive edges. For obstacle avoidance, the collision envelope may be deliberately conservative. For a robot arm, joint axes, stops and link inertias are essential. The same CAD source can legitimately yield different simulation proxies for different purposes; there is no single perfect polygon budget or universal collision mesh.

Rehearse the central diagnostic question. If the simulated object rotates differently from the real object, do we blame friction? Not until we've checked geometry, center of mass, inertia, joint frames, contact locations and applied forces. If the simulated collider touches before the visual surfaces meet, visualize both and measure the gap. A small, precise test often resolves what looks like a large, mysterious physics problem.

In the lab, you will convert dimensions from millimeters to meters, transform marker points, audit expected bounding boxes, and intentionally inject a frame error. Report your pass criteria and document the limitations of each collision approximation. The next lecture builds directly on this asset discipline by asking how mass distribution and inertia turn forces into trajectories. That transition works only because geometry, units and frames have already been established.
