# Singularity Example DR

### HMI Panel File

<figure><img src="/files/OqxkUKlysEUtOK3bReVx" alt=""><figcaption></figcaption></figure>

{% file src="/files/edduDvdSGuT0YdT9Ukog" %}

### Script File

```python
from DRCF import *

label_status = "OUTSIDE SINGULAR REGION"
checkbox_status = [True, False, False]
checkbox_auto_avoid = True
checkbox_var_vel = False
checkbox_path_first = False


def update_hmi():
    global checkbox_status, checkbox_var_vel, checkbox_path_first, checkbox_auto_avoid, label_status

    # update checkbox
    if checkbox_auto_avoid and not checkbox_status[0]:
        checkbox_var_vel = False
        checkbox_path_first = False
        set_singularity_handling(DR_AVOID)
        checkbox_status = [checkbox_auto_avoid, checkbox_var_vel, checkbox_path_first]

    elif checkbox_var_vel and not checkbox_status[1]:
        checkbox_auto_avoid = False
        checkbox_path_first = False
        set_singularity_handling(DR_VAR_VEL)
        checkbox_status = [checkbox_auto_avoid, checkbox_var_vel, checkbox_path_first]

    elif checkbox_path_first and not checkbox_status[2]:
        checkbox_auto_avoid = False
        checkbox_var_vel = False
        set_singularity_handling(DR_TASK_STOP)
        checkbox_status = [checkbox_auto_avoid, checkbox_var_vel, checkbox_path_first]

    elif not checkbox_auto_avoid and not checkbox_var_vel and not checkbox_path_first:
        checkbox_auto_avoid = True
        checkbox_var_vel = False
        checkbox_path_first = False
        set_singularity_handling(DR_AVOID)
        checkbox_status = [checkbox_auto_avoid, checkbox_var_vel, checkbox_path_first]

    # update label
    j5 = abs(get_current_posj()[4])
    if j5 > 15:
        label_status = "OUTSIDE SINGULAR REGION"
    elif j5 > 10:
        label_status = "NEAR SINGULAR REGION"
    else:
        label_status = "INSIDE SINGULAR REGION"


thread_run(update_hmi, loop=True)
movej(posj(0.0, 36.8, 123.6, -0.0, -70.4, 0.0))


def test():
    movej(posj(0.0, 36.8, 123.6, -0.0, -70.4, 0.0))
    movel(posx(680.0, 34.5, 1142.5, -0.0, 90.0, -0.0))
    movel(posx(679.9, 34.5, 122.3, -0.0, 90.0, -0.0))

```

{% file src="/files/te2JYSYZ8WOFCMNb4k8O" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.robpod.cloud/hmi-designer/working-examples/doosan-robotics/singularity-example-dr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
