# rover_state.rs — Rover Mode State

<p class="callout warning">The state described here MIGHT be subject to change</p>

<span style="white-space: pre-wrap;">Manages the three global boolean flags that track the rover's current operating mode. The state is held in a </span>`<span class="editor-theme-code">RoverState</span>`<span style="white-space: pre-wrap;"> struct registered as Tauri managed state (initialised in </span>`<span class="editor-theme-code">lib.rs</span>`), so it persists for the lifetime of the application.

### State fields

<table id="bkmrk-statedefaultdescript"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><td>**State**

</td><td>**Default**

</td><td>**Description**

</td></tr><tr><td>`<span class="editor-theme-code">drive_manual_mode</span>`

</td><td>`<span class="editor-theme-code">true</span>`

</td><td>Whether the rover driving is in manual control

</td></tr><tr><td>`<span class="editor-theme-code">arm_manual_mode</span>`

</td><td>`<span class="editor-theme-code">true</span>`

</td><td>Whether the arm is in manual control

</td></tr><tr><td>`<span class="editor-theme-code">pickup_mode</span>`

</td><td>`<span class="editor-theme-code">false</span>`

</td><td>Whether the rover is in driving or pickup mode

</td></tr></tbody></table>

### Commands

**`<strong class="editor-theme-bold editor-theme-code">get_state(state_type: StateType) → bool</strong>`**<span style="white-space: pre-wrap;"> Returns the current value of the requested state flag. Called on page mount to sync the UI with the actual rover state.</span>

**`<strong class="editor-theme-bold editor-theme-code">set_state(state_type: StateType, value: bool)</strong>`**<span style="white-space: pre-wrap;"> Sets a state flag. Called by the frontend when the operator switches modes (e.g. toggling pick-up mode on the dashboard).</span>

`<span class="editor-theme-code">StateType</span>`<span style="white-space: pre-wrap;"> is an enum with variants: </span>`<span class="editor-theme-code">DriveManual</span>`<span style="white-space: pre-wrap;">, </span>`<span class="editor-theme-code">ArmManual</span>`<span style="white-space: pre-wrap;">, </span>`<span class="editor-theme-code">Pickup</span>`.