# Programming Mode

### Introduction

Aside from the basic navigational and mapping functions that are built into the control system, the RobotDog can be manually programmed to perform automated functions. This can be useful for tasks that need to be repeated.

Through the Unitree Go App, you can access a visual interface for basic programming. You can create and save multiple scripts and run them as required.&#x20;

{% hint style="info" %}
To access the program menu, select Function from the home screen.
{% endhint %}

<div><figure><img src="/files/W4PAp34QIZ3H3AaZJY4U" alt=""><figcaption><p>Function Menu</p></figcaption></figure> <figure><img src="/files/INrkAttvhsRvYf8sejrk" alt=""><figcaption><p>Programming</p></figcaption></figure> <figure><img src="/files/KGAuMIh9j1JdLzsxM5Er" alt=""><figcaption><p>Select the + to create a new program</p></figcaption></figure></div>

On the left-hand side of the screen, you will see a list of selectable commands that can be used for putting together a script. These are all drag and drop elements, and once placed into the sequence the individual settings can be adjusted.&#x20;

<div data-full-width="false"><figure><img src="/files/dUVfGOIFBrDytWin6Xo1" alt=""><figcaption><p>Movement</p></figcaption></figure> <figure><img src="/files/w415bgYe6DlXS1FDD1ox" alt=""><figcaption><p>Pose Action</p></figcaption></figure> <figure><img src="/files/TwdsxqKaWCGtYddW2JS1" alt=""><figcaption><p>Operation Mode</p></figcaption></figure></div>

<div><figure><img src="/files/PQ7gnst8Kfu9XuZXqi3R" alt=""><figcaption><p>Media Action</p></figcaption></figure> <figure><img src="/files/nblcA3abVkDHb44tCDKz" alt=""><figcaption><p>Lighting Action</p></figcaption></figure> <figure><img src="/files/TTChrC1UKTS5AKW2ahzi" alt=""><figcaption><p>Control</p></figcaption></figure></div>

***

### Creating a Script

We are going to ask the RobotDog to perform some simple movement actions, by dragging and dropping the appropriate commands and adding them to the sequence. Watch the video below for a demonstration.

{% hint style="warning" %}
**Remember to save your script as you go. Changes are not automatically updated.**
{% endhint %}

1. Move forward 1.5m.
2. Rotate 180 Degrees
3. Take a photo
4. Turn on headlight to yellow
5. Move forward 1m
6. Rotate 180 Degrees
7. Reverse back .5m
8. Pause then Snap another photo
9. Lay Down&#x20;

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXautSvCbUco5Lv7YrH%2Fuploads%2Fkn4vEX1gJRAx11uGYJEY%2FSimpleScript.mp4?alt=media&token=3ee739b4-d3ed-4eb6-9b69-e1c606bef2c4>" %}
Creating a simple script
{% endembed %}

{% hint style="info" %}
Before sending the script to the RobotDog, we will preview the simulation by pressing the play button labeled *Simulator* on the bottom right of the screen.
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXautSvCbUco5Lv7YrH%2Fuploads%2FirDsasNTwf6VnDwvAeWZ%2FScriptSim.mp4?alt=media&token=cf319786-9f46-46fd-99c2-cf227caee4d5>" %}
Simple Script Simulation
{% endembed %}

Once you are ready to execute the script with the RobotDog, close the simulator mode by tapping the arrow on the simulation window. You will notice the play button change from *Simulator* to ***Robot.***&#x20;

Pushing play now will execute the script.

<div><figure><img src="/files/RFdooKIp1w7cExuoYbyC" alt=""><figcaption><p>Tap here to exit simulation mode.</p></figcaption></figure> <figure><img src="/files/ZghTfwzKRg1gk3bHcWQL" alt=""><figcaption><p>Check Robot is activated prior to executing.</p></figcaption></figure></div>

***

### Advanced Techniques

There are some more advanced techniques you could utilise such as using the *Defining Function* command. This could be useful if there are particular steps or functions that need to be repeated multiple times within a larger script. Here's how to set this up:

Scroll to the bottom of the menu on the left-hand side of the screen. You will see the purple functions menu. Any defined functions you create will become listed and selectable from this menu.&#x20;

To get started, drag and drop the *define function* tool to the workspace. Give your function a name, to make it easier to identify later. Defined functions will only be available within the current program you are working in.

Watch the video below to see the function groups in action.

<div><figure><img src="/files/2Q3sfmkITu80DJL3fe7m" alt=""><figcaption><p>Name the function groups</p></figcaption></figure> <figure><img src="/files/fIItu0xTZUmJejg2L1sm" alt=""><figcaption><p>Function Groups appear in menu</p></figcaption></figure> <figure><img src="/files/NHsqsVhEdLswSTFO5qz8" alt=""><figcaption><p>Create a script linking function groups.</p></figcaption></figure></div>

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXautSvCbUco5Lv7YrH%2Fuploads%2FJ8Nm6h8Fxa7vPojeury5%2FAdvScript.mp4?alt=media&token=9201d04b-f473-481c-9b43-5c2c0465de9e>" %}
Defined Functions in use
{% endembed %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXautSvCbUco5Lv7YrH%2Fuploads%2Fmt4SSdFR1jitzsEVtIQs%2FExecuting%20a%20Script.mp4?alt=media&token=438c052e-5234-49e7-86c2-b9e7faf7af6a>" %}
Executing a Script on the RobotDog
{% endembed %}


---

# 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://ms-kb.msd.unimelb.edu.au/next-lab/robotics/robotic-dog/operation-setup/programming-mode.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.
