# sampling_locations.svelte + SampleField.svelte — Sampling Locations

<span style="white-space: pre-wrap;">The main data collection interface for the Science task. Manages a list of </span>`<span class="editor-theme-code">Sample</span>`<span style="white-space: pre-wrap;"> objects stored in the </span>`<span class="editor-theme-code">samples</span>`<span style="white-space: pre-wrap;"> Svelte store.</span>

### Sample card

<span style="white-space: pre-wrap;">Each sample in the list is rendered as a card with an editable location name field and a set of </span>`<span class="editor-theme-code">SampleField</span>`<span style="white-space: pre-wrap;"> sub-components. The location name field updates </span>`<span class="editor-theme-code">location_name_check</span>`<span style="white-space: pre-wrap;"> automatically as the operator types.</span>

### SampleField.svelte

<span style="white-space: pre-wrap;">A reusable row sub-component used inside each sample card. Renders a checkbox (bound to a </span>`<span class="editor-theme-code">checked</span>`<span style="white-space: pre-wrap;"> prop), a label, the current value, and a </span>`<span class="editor-theme-code">+</span>`<span style="white-space: pre-wrap;"> button that opens the relevant modal. Used for: Coordinates, Size, Weight, Image Before, Image After.</span>

### Modals

<span style="white-space: pre-wrap;">Clicking a </span>`<span class="editor-theme-code">+</span>`<span style="white-space: pre-wrap;"> button opens a modal specific to that field type:</span>

**Coordinates**<span style="white-space: pre-wrap;"> — a single button that calls </span>`<span class="editor-theme-code">invoke("request_coordinates")</span>`<span style="white-space: pre-wrap;">, receives a </span>`<span class="editor-theme-code">[lat, lon]</span>`<span style="white-space: pre-wrap;"> tuple from the rover, formats it as a string, and saves it to the sample.</span>

**Measurement**<span style="white-space: pre-wrap;"> — shows two camera feeds (arm + front) in </span>`<span class="editor-theme-code">measure</span>`<span style="white-space: pre-wrap;"> mode. The operator clicks two corresponding points on the two feeds to trigger a stereo measurement via </span>`<span class="editor-theme-code">invoke("request_measurement")</span>`. The returned value is saved to the sample.

**Weight**<span style="white-space: pre-wrap;"> — a single button that calls </span>`<span class="editor-theme-code">invoke("request_weight")</span>`<span style="white-space: pre-wrap;"> and saves the returned gram value to the sample.</span>

**Image Before / Image After**<span style="white-space: pre-wrap;"> — shows all three camera feeds. Clicking any feed calls </span>`<span class="editor-theme-code">invoke("save_snapshot")</span>`<span style="white-space: pre-wrap;"> which captures a JPEG frame from that stream and saves it to the </span>`<span class="editor-theme-code">images/</span>`<span style="white-space: pre-wrap;"> directory. The filename is </span>`<span class="editor-theme-code">{sample.label}_{before|after}</span>`.

### Pick up Rock

<p class="callout warning">This section is work in progress</p>

<span style="white-space: pre-wrap;">A separate overlay accessible from a button at the bottom of the component. Shows all three camera feeds in </span>`<span class="editor-theme-code">pick</span>`<span style="white-space: pre-wrap;"> mode. The </span>`<span class="editor-theme-code">pick()</span>`<span style="white-space: pre-wrap;"> function is currently a stub for the rover arm pick-up command.</span>