necst.ctrl.antenna.az_unwrap¶
Runtime support for absolute-modulo azimuth encoder unwrapping.
- load_unwrap_disabled_mount_az_limit()[source]¶
Return raw-Az command limits when absolute unwrap is configured off.
When an absolute-modulo Az encoder is configured but
antenna_encoder_unwrap.az.enabledis false, the control system has no branch information. In that state Az commands must be confined to the raw absolute encoder range (normally 0..360 deg). If no unwrap section exists, returnNoneso NANTEN2/incremental-encoder configurations are unchanged.- Return type:
Optional[dict]
- assert_mount_az_allowed_when_unwrap_disabled(az_deg, *, action_label='Az target')[source]¶
Reject Az commands outside raw range when unwrap is configured off.
This is a fail-closed guard for absolute-modulo encoders. It intentionally uses the configured raw absolute encoder range, not the wider continuous drive range, because without unwrap the controller cannot distinguish e.g. 10 deg from 370 deg.
- Parameters:
az_deg (Any) –
action_label (str) –
- Return type:
Optional[dict]
- load_az_unwrap_config()[source]¶
- Return type:
tuple[neclib.coordinates.angle_unwrap.AbsoluteModuloUnwrapConfig, Optional[pathlib.Path], float, float, float, str, str, int]
- class AtomicStateWriter(path)[source]¶
Bases:
objectLow-rate atomic state persistence, isolated from encoder callbacks.
- Parameters:
path (Optional[Path]) –
- class AzUnwrapRuntime[source]¶
Bases:
object- process(raw_az_deg, *, el_deg, encoder_time)[source]¶
- Parameters:
raw_az_deg (float) –
el_deg (float) –
encoder_time (float) –
- Return type:
tuple[float, necst_msgs.msg._antenna_az_unwrap_status.AntennaAzUnwrapStatus]
- get_state_report()[source]¶
Return runtime/state-file information for ROS service responses.
The report is generated inside the encoder node process. Therefore the reported state_path and state-file content refer to the path that encoder_readout actually uses, not to a caller’s local ~/.necst.
- Return type:
dict
- manual_initialize(*, raw_az, continuous_az, branch, reason='manual state set via encoder service')[source]¶
Validate and persist a manual unwrap state inside encoder_readout.
This is the service-side equivalent of the old local-file CLI. The validation rules and JSON schema are shared with the local fallback, but the write happens in the encoder node process, so Docker/HOME differences cannot redirect the state file to the wrong computer.
- Parameters:
raw_az (Optional[float]) –
continuous_az (Optional[float]) –
branch (Optional[int]) –
reason (str) –
- Return type:
- fill_get_response(response, report)[source]¶
Fill GetAzUnwrapState.Response-like objects from a runtime report.
- Parameters:
response (Any) –
report (Mapping[str, Any]) –
- Return type:
Any
- fill_set_response(response, *, success, state, reason, state_path, enabled, valid, raw_az_deg, modulo_az_deg, continuous_az_deg, branch, period_deg, drive_min_deg, drive_max_deg)[source]¶
Fill SetAzUnwrapState.Response-like objects without importing ROS types.
- Parameters:
response (Any) –
success (bool) –
state (str) –
reason (str) –
state_path (str) –
enabled (bool) –
valid (bool) –
raw_az_deg (float) –
modulo_az_deg (float) –
continuous_az_deg (float) –
branch (int) –
period_deg (float) –
drive_min_deg (float) –
drive_max_deg (float) –
- Return type:
Any
- report_from_status(runtime, status, *, success=True)[source]¶
Convert a status message to a response/report dictionary.
- Parameters:
runtime (AzUnwrapRuntime) –
status (AntennaAzUnwrapStatus) –
success (bool) –
- Return type:
dict