Build a twin with a measurement contract

Separate the simulated world, sensor observations, and controller state.

Exercise brief·Beginner·5 min read

Opening the Python editor…

Requirements and learning goals

Before you start

  • A sketch of a room
  • Basic coordinate geometry

You will be able to

  • Define a world frame
  • Separate truth from observations
  • Choose a measurable first scenario

The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?

A is a digital representation of a particular physical system, connected to measurements where available. It lets you test a question about that system, such as where a camera saw an object. This first exercise defines a small simulated scene and its measurement rules; a 3D room alone does not establish that it matches a real room.

The warehouse project supplies an example scene and workflow; validate its dimensions and camera placement before reusing them.

Start with one room

A useful digital twin represents geometry and behavior closely enough to answer a specific question. For camera localization, begin with a floor, one shelf, one camera, and one target. Record dimensions in meters and choose a world origin and axis directions.

Keep three views distinct:

  • The environment owns exact object positions and generates observations.
  • The application sees camera frames and sensor readings.
  • The evaluator compares estimates with known positions after the run.

The warehouse demo follows this separation: live detection uses images; known positions score localization offline. Its simulator requires separately licensed runtime assets. You can complete this planning exercise without them.

Work through a small room

Use a room 4 meters wide and 3 meters deep. Put the origin at the center of its floor, with x across the width, y across the depth, and z upward. The floor is z = 0. Mount a camera at (0, 0, 2) meters, pointing straight down. Give it a horizontal of 600 pixels and an image center at pixel 320.

A floor target at (0.50, 0, 0) lies 0.50 meters sideways and 2 meters below the camera. Its horizontal image offset is 600 × 0.50 / 2 = 150 pixels, so it appears at pixel 470. Reversing that calculation gives 2 × (470 - 320) / 600 = 0.50 meters. The application can recover the floor point from the pixel, calibration, camera pose, and floor height without reading the target's true position.

Now put a target on a shelf at (0.25, 0, 1). It is 0.25 meters sideways and only 1 meter below the camera, so it also appears at pixel 470. Assuming the floor again would report (0.50, 0, 0): a horizontal error of 0.25 meters and the wrong support height. The pixel alone cannot distinguish these two depths. A shelf-aware geometry intersection or a depth measurement supplies the missing information.

The evaluator may use those known target coordinates to calculate error. The application must obtain its surface choice from an observation or a declared map assumption. Keeping those roles separate makes the twin useful for testing perception.

Checkpoint 1 of 2

A teammate proposes that the application read the target's simulated z coordinate to choose between floor and shelf, then compute x from the pixel. What is wrong with this plan?

Commit to an answer. Every choice explains itself.

Try it

Draw your room and write this contract with your own values:

{
  "world_frame": "warehouse",
  "units": "meters",
  "floor_z": 0,
  "camera_frame": "camera_1",
  "observation": ["image", "capture_time", "calibration_id"],
  "controller_output": ["goal_x", "goal_y", "expires_at"]
}

Use the worked room first, then change the shelf height to 0.50 meters while keeping its target at x = 0.25. Predict the pixel and the error from assuming the floor. Explain how your application would distinguish support surfaces without reading the target's exact simulated position.

Checkpoint 2 of 2

The shelf is now 0.50 meters high with its target at x = 0.25. The camera is still 2 meters up with a 600-pixel focal length and image center 320. Which pixel shows the target, and what x does a floor assumption report?

Commit to an answer. Every choice explains itself.

Check your result

You should have a dimensioned scene, named frames, and an explicit sensor boundary. A controller that reads the target's simulation coordinates has bypassed perception.

Optional extension: add a shelf that blocks the camera. A correct twin should produce an occlusion or rejected observation, rather than revealing the hidden target through geometry metadata. See the thermal warehouse demo for a surface-ray example with occluding racks.

Can you do each of these?

  • Define a world frame
  • Separate truth from observations
  • Choose a measurable first scenario

0 of 2 checkpoints solved. Try checkpoint 1

Digital twins & camera geometry
All lessons in this topic
  1. 1. Build a twin with a measurement contract
  2. 2. Understand calibration and check a camera projection
  3. 3. Turn a camera pixel into a world ray
  4. 4. Locate a detected object in the twin
  5. 5. Validate a robot goal with a dry-run adapter

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.