{
    "componentChunkName": "component---src-components-page-template-jsx",
    "path": "/archive/nugus/scripts",
    "result": {"data":{"mdx":{"id":"05bb947b-7210-533a-a168-38e4847540e5","body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"section\": \"Archive\",\n  \"chapter\": \"NUgus\",\n  \"title\": \"Running and Tuning Scripts\",\n  \"description\": \"How to tune and run scripts.\",\n  \"slug\": \"/archive/nugus/scripts\",\n  \"authors\": [\"Ysobel Sims (@ysims)\"]\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar Alert = makeShortcode(\"Alert\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(Alert, {\n    type: \"info\",\n    mdxType: \"Alert\"\n  }, mdx(\"p\", null, \"This page is archived. It documents the NUgus, which NUbots no longer uses as its main platform.\")), mdx(\"p\", null, \"Scripts are static motions for the robot. By static, we mean they are preconfigured motions that won't change at runtime. They specify what joint angles to move to and how long the robot should take to go to those joint angles. For example, standing up is a small script telling the robot to move its joints to the stand position over one second. There can be many of these position specifications in a row to make the robot do more complex movements like getting up or kicking.\"), mdx(\"p\", null, \"Scripts are run using the script utility and the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/system/foundations/director\"\n  }, \"Director system\"), \". The script utility will convert a specified script yaml file into a \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"#the-script-system\"\n  }, \"Sequence Task message\"), \". It takes each joint position and time from the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \".yaml\"), \" file and adds these frames to the Sequence of servo targets. The Sequence Provider will request a Director Task for each Group in its Sequence, and will only progress to the next Group when the previous has completed.\"), mdx(\"p\", null, \"More information on the script system, Script Runner and Script Tuner is in the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"#background\"\n  }, \"Background\"), \" section below.\"), mdx(\"h2\", {\n    \"id\": \"script-runner\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#script-runner\",\n    \"aria-label\": \"script runner permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Script Runner\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"scriptrunner\"), \" command will run a script. It is used as follows:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"./scriptrunner <script_name>\\n\")), mdx(\"p\", null, \"Where \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<script_name>\"), \" is the name of the script you want to run, such as \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand.yaml\"), \". All scripts can be found in the NUbots repository under \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/shared/utility/skill/scripts\"), \".\"), mdx(\"p\", null, \"The script you are running needs to be on the robot in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/scripts/\"), \" folder. These scripts can be robot specific. For example, you could have a stand script specifically for the NUgus 1 robot stored in \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/scripts/nugus1/Stand.yaml\"), \". When you run \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"./scriptrunner Stand.yaml\"), \" on NUgus 1, the ScriptEngine will first look for the robot-specific \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand.yaml\"), \" in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/scripts/nugus1/\"), \" folder. If found, it will execute it. If not, it will look for a platform-specific \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand.yaml\"), \" in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/scripts/nugus/\"), \" folder, which it will execute if found. Otherwise, it will look for a more general \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand.yaml\"), \" in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/scripts/\"), \" folder.\"), mdx(\"p\", null, \"More on the script system can be found on the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/system/foundations/config-script\"\n  }, \"Configuration and Script System page\"), \".\"), mdx(\"h2\", {\n    \"id\": \"script-tuner\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#script-tuner\",\n    \"aria-label\": \"script tuner permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Script Tuner\"), mdx(\"p\", null, \"Script tuner is a tool that can be used to create and modify scripts. To use script tuner, run:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"./scripttuner <script_path>\\n\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<script_path>\"), \" is the path to the script you want to tune, such as \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"scripts/nugus/Stand.yaml\"), \". The path can be to an existing script, if you want to edit it, or to a script that does not exist yet if you want to create a new script.\"), mdx(\"p\", null, \"Running a command like the above will open the following interface, which will enable you to tune the script:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"-----------------------------------Script Tuner-----------------------------------\\n\\nScript: scripts/nugus2/walk.yaml\\nFrames: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28\\nDuration:  3000\\n-\\n\\n\\nU Head Pan              Angle:  -.--- Gain: ---.-\\nU Head Tilt             Angle:  -.--- Gain: ---.-\\nL Right Shoulder Pitch  Angle: +1.963 Gain:  20.0\\nL Left Shoulder Pitch   Angle: +1.963 Gain:  20.0\\nL Right Shoulder Roll   Angle: -0.124 Gain:  20.0\\nL Left Shoulder Roll    Angle: +0.124 Gain:  20.0\\nL Right Elbow           Angle: -2.443 Gain:  25.0\\nL Left Elbow            Angle: -2.443 Gain:  25.0\\nL Right Hip Yaw         Angle: +0.030 Gain:  30.0\\nL Left Hip Yaw          Angle: +0.030 Gain:  30.0\\nL Right Hip Roll        Angle: -0.063 Gain:  30.0\\nL Left Hip Roll         Angle: +0.063 Gain:  30.0\\nL Right Hip Pitch       Angle: -0.204 Gain:  30.0\\nL Left Hip Pitch        Angle: -0.204 Gain:  30.0\\nL Right Knee            Angle: +0.257 Gain:  30.0\\nL Left Knee             Angle: +0.257 Gain:  30.0\\nL Right Ankle Pitch     Angle: -0.239 Gain:  30.0\\nL Left Ankle Pitch      Angle: -0.239 Gain:  30.0\\nL Right Ankle Roll      Angle: +0.060 Gain:  30.0\\nL Left Ankle Roll       Angle: -0.067 Gain:  30.0\\n\\nCommands\\n, Left a frame  N New Frame        Lock/Unlock   J Jump to Frame P play\\n. Right a frame I Delete a Frame T Edit Duration G Change Gains  S Save\\n\\nType :help for a full list of commands\\n----------------------------------------------------------------------------------\\n\")), mdx(\"p\", null, \"The first line shows the name and path of the script you are creating or editing.\"), mdx(\"p\", null, \"The second line specifies the number of frames and the current frame, which is highlighted. Each frame specifies different joint (i.e. servo) positions, and when these frames are combined they result in a motion.\"), mdx(\"p\", null, \"The next line is the duration. This determines how long the robot will take to move to the servo positions you have specified. This is measured in milliseconds.\"), mdx(\"p\", null, \"The next section is a table that shows the angle and gain for each servo for that frame.\"), mdx(\"p\", null, \"The bottom of the interface shows what commands are available. It does not show all the commands. All commands can be viewed by typing \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \":help\"), \" and pressing \", mdx(\"kbd\", null, \"Enter\"), \". Note that the letters should be pressed in UPPERCASE.\"), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Command\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Description\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \",\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Moves to the frame that is to the left of the currently selected frame. When moving to the frame, the robot's joints will move to the joint positions for that frame.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \".\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Moves to the frame that is right of the currently selected frame. When moving to the frame, the robot's joints will move to the joint positions for that frame.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"N\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Creates a new frame after the currently selected frame. This frame will be a duplicate of the selected frame. It will be added in after the currently selected frame, and the selected frame will not change.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"I\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Deletes the currently selected frame. The frame after the deleted frame will be selected, if there's one. Otherwise the one before will be selected.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"space\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Toggles locking and unlocking of servos. When a servo is locked, you will not be able to manually move its joint on the robot, and the angle it is at will be stored in the table on the script tuner interface. When it is unlocked, you are able to freely move that joint on the robot to adjust the angle of the joint for that frame. Space bar can be pressed to edit any field that is editable.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"T\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Edits the duration that the current frame plays for, in milliseconds. After pressing this key, type the duration and press \", mdx(\"kbd\", null, \"Enter\"), \" to submit.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"J\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Jumps to a specified frame. After pressing this key, type the frame number you want to jump to and then press \", mdx(\"kbd\", null, \"Enter\"), \".\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"G\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Opens the interface for editing the gain of the entire script or frame. Provides a quick way to change all servo gains, only the upper body gains (arms and head), or only lower body gains (legs) at the same time. The change can be applied to the entire script or to a particular frame. Press \", mdx(\"kbd\", null, \"X\"), \" to exit the edit gain interface when done.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"P\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Plays the script from the first frame to the last frame.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"S\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Saves the new script or saves the edited script.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"A\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Saves the script with a particular name (equivalent to \\\"save as\\\"). After pressing this key, type the name of the script and press \", mdx(\"kbd\", null, \"Enter\"), \".\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"R\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Manually refreshes view. Useful if for some reason the view gets stuck.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"M\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Mirrors the script in the sagittal plane.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"X\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Exits the help view or exits the gain editing interface.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \"CTRL\"), \"+\", mdx(\"kbd\", null, \"C\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Quits script tuner.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"kbd\", null, \":help\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Lists all commands that can be used in script tuner.\")))), mdx(\"h2\", {\n    \"id\": \"list-of-scripts\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#list-of-scripts\",\n    \"aria-label\": \"list of scripts permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"List of Scripts\"), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Script Name\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Description\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"DiveLeft.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot stretches its arm out to the left and moves its left leg so that it will dive to the left.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"DiveRight.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot stretches its arm out to the right and moves its right leg so that it will dive to the right.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"KickLeft.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot kicks with its left foot.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"KickRight.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot kicks with its right foot.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"NodYes.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot nods its head.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"Relax.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot relaxes all of its joints. Be prepared to hold it if it's standing, as it will fall over.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"RollOverFront.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot rolls from its back onto its front.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"Stand.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot moves into a standing position.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"StandUpBack.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot gets up from its back and moves into a standing position.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"StandUpFront.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot gets up from its front and moves into a standing position.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"Zombie.yaml\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The robot moves into a standing zombie position, with arms straight out.\")))), mdx(\"h2\", {\n    \"id\": \"modifying-and-adding-scripts\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#modifying-and-adding-scripts\",\n    \"aria-label\": \"modifying and adding scripts permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Modifying and Adding Scripts\"), mdx(\"p\", null, \"When installing NUbots code onto a robot for tuning scripts, ensure you are using \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/system/foundations/build-system#install\"\n  }, \"the correct flag for installing configuration files\"), \", depending on whether you want to overwrite existing scripts on the robot, or not. Ensure that you have enabled the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"scripttuner\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"scriptrunner\"), \" binaries by turning \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"scripttuner.role\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"scriptrunner.role\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"ON\"), \" in \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"./b configure -i\"), \", before building and installing.\"), mdx(\"p\", null, \"Use script tuner as detailed above to make or edit your script. It is a good idea to have one person using script tuner and another person holding the robot and moving the joints to new positions. Wait a few seconds after saving before you close the script, to allow it time to finish saving.\"), mdx(\"p\", null, \"When you have finished making or editing your script, copy it from the robot to your computer using\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"scp nubots@<address>:<path_to_script> <path_on_your_computer>\\n\")), mdx(\"p\", null, \"or\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"./b retrieve <address> scripts # and watch the magic happen as it copies the script straight back to the codebase\\n\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<address>\"), \" is the address of the robot, such as \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"10.1.1.1\"), \" for NUgus 1. \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<path_to_script>\"), \" is the path to the script. \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<path_on_your_computer>\"), \" is the path you want to copy the script to on your computer. Run this command on your computer.\"), mdx(\"p\", null, \"After you copy the script to your computer, you should commit it to a new branch and make a pull request to merge it into the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"main\"), \" branch on GitHub; unless the changes are not suitable to keep, in which case you can discard them. For information on Git and GitHub visit the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/guides/general/git\"\n  }, \"Git guide\"), \".\"), mdx(\"h2\", {\n    \"id\": \"background\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#background\",\n    \"aria-label\": \"background permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Background\"), mdx(\"h3\", {\n    \"id\": \"the-script-system\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#the-script-system\",\n    \"aria-label\": \"the script system permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"The Script System\"), mdx(\"p\", null, \"Scripts are static motions for the robot. They specify what joint angles to move to and how long the robot should take to get to those joint angles. For example, standing up is a script telling the robot to move its joints to the stand position over one second. There can be many of these position specifications in sequence to make the robot do short movements that may be hard to dynamically implement, such as getting up.\"), mdx(\"h4\", {\n    \"id\": \"execution\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#execution\",\n    \"aria-label\": \"execution permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Execution\"), mdx(\"p\", null, \"To execute a script, we emit a Director Task message with the appropriate servo Sequence containing the script information. This script information comes from the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"load_script\"), \" function in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"script\"), \" utility.\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"load_script\"), \" function takes a YAML file name (eg \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand.yaml\"), \"), finds and reads the file and creates a servo Sequence representing the script. The Sequence is returned and emitted as a Director Task. The Director Task is then executed by the Director system.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"\\nemit<Task>(load_script<BodySequence>(\\\"Stand.yaml\\\"));\\n\\n\")), mdx(\"p\", null, \"Scripts can be given a start time. If a script has a start time, it will not start execution until that time. The following would execute the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand\"), \" script in five seconds.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"\\nemit<Task>(load_script<BodySequence>(\\\"Stand.yaml\\\", NUClear::clock::now() + std::chrono::seconds(5)));\\n\\n\")), mdx(\"h4\", {\n    \"id\": \"script-files\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#script-files\",\n    \"aria-label\": \"script files permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Script files\"), mdx(\"p\", null, \"The script files are YAML files specifying a duration and list of servo targets, in a format like the following:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yaml\"\n  }, \"- duration: 1000\\n  targets:\\n    - id: HEAD_YAW\\n      position: 0\\n      gain: 10\\n      torque: 100\\n    - id: HEAD_PITCH\\n      position: 0.5\\n      gain: 10\\n      torque: 100\\n    - id: R_HIP_YAW\\n      position: -0.03\\n      gain: 5\\n      torque: 100\\n\")), mdx(\"p\", null, \"The fields are described in the table below.\"), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Field\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Description\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"duration\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"An integer in milliseconds.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"position\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"A float representing the angle of the servo in radians.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"gain\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"A float representing how much effort the servo will use to get to the target position. Gain is often between 5 and 15.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"torque\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"A float, where 0 represents no torque and 100 represents torque being on. Torque is 100 unless you want that servo relaxed, in which case it will be 0.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"id\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"One of the servo IDs listed in \", mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/NUbots/NUbots/blob/467f458c687419056e2487fe468c7f22d19a6965/shared/utility/input/ServoID.h#L30\"\n  }, \"ServoID.h\"), \".\")))), mdx(\"p\", null, \"Script files can be found in the ScriptEngine module. Scripts can be specific to a robot. More on scripts can be found on the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/system/foundations/config-script\"\n  }, \"Configuration and Script System\"), \" page.\"), mdx(\"h3\", {\n    \"id\": \"script-runner-1\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#script-runner-1\",\n    \"aria-label\": \"script runner 1 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Script Runner\"), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/NUbots/NUbots/tree/8bfdde1ac3f51764515908dd514e653f6b38cf04/module/purpose/ScriptRunner\"\n  }, \"ScriptRunner\"), \" is a purpose-level module. It takes the name of one or more script files as arguments and attempts to run the scripts. It does not take file paths, only the file name/s of the script/s to execute.\"), mdx(\"p\", null, \"When ScriptRunner is executed, it stores the script file names passed to it as a vector of strings. When the green button on the robot is pushed, the scripts are executed in order of appearance, one after the other. ScriptRunner also provides an option to set a delay before the execution of the first script, as well as a delay between the execution of each script.\"), mdx(\"p\", null, \"An example of using ScriptRunner to run a script called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Stand.yaml\"), \" is:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"./scriptrunner Stand.yaml\\n\")), mdx(\"h3\", {\n    \"id\": \"script-tuner-1\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#script-tuner-1\",\n    \"aria-label\": \"script tuner 1 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Script Tuner\"), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/NUbots/NUbots/tree/0a948978ba5806ee532bc1120a76e9e58c4e6533/module/purpose/ScriptTuner\"\n  }, \"ScriptTuner\"), \" is a purpose-level module. Using a command-line argument, it can either create a new script or open an existing script for editing. It uses \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://en.wikipedia.org/wiki/Curses_(programming_library)\"\n  }, \"curses\"), \" to create a user interface in the terminal. Through this user interface, YAML files are created or edited that specify a script that can then be used by other modules.\"), mdx(\"p\", null, \"A script consists of frames (also called targets) which specify the position of one or more servos at a given time. The ScriptTuner interface allows for stepping through and modifying those frames. When a frame is selected in ScriptTuner, a ServoCommand for that frame will be emitted to the robot. By stepping through multiple frames, the entire script can be played back on the robot, allowing the user to preview changes to the script.\"), mdx(\"p\", null, \"ScriptTuner also allows for \\\"locking\\\" and \\\"unlocking\\\" servos on the robot. When a servo is \\\"locked\\\", its position can only be changed in ScriptTuner. When it is \\\"unlocked\\\", the servo can be moved physically on the robot, which will update the position value in the script. Locking a servo involves emitting a ServoCommand for the current position of the servo. Unlocking the servo involves emitting a ServoCommand with zero torque and gain.\"), mdx(\"p\", null, \"To learn how to use ScriptTuner, see \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"#script-tuner\"\n  }, \"Script Tuner\"), \" above.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#script-runner","title":"Script Runner"},{"url":"#script-tuner","title":"Script Tuner"},{"url":"#list-of-scripts","title":"List of Scripts"},{"url":"#modifying-and-adding-scripts","title":"Modifying and Adding Scripts"},{"url":"#background","title":"Background","items":[{"url":"#the-script-system","title":"The Script System"},{"url":"#script-runner-1","title":"Script Runner"},{"url":"#script-tuner-1","title":"Script Tuner"}]}]},"frontmatter":{"section":"Archive","chapter":"NUgus","title":"Running and Tuning Scripts","description":"How to tune and run scripts.","keywords":null,"slug":"/archive/nugus/scripts","hidden":null},"childNUbookContributions":{"authors":[{"name":"Ysobel Sims","username":"ysims"}],"lastCommit":{"date":"2026-11-08T04:31:56.000Z","hash":"c00a8e7cc091fb8b4b96f4852a33a5718fefca99"}}}},"pageContext":{"mdxPath":"src/book/04-archive/01-nugus/04-scripts.mdx","id":"05bb947b-7210-533a-a168-38e4847540e5","next":{"chapter":"NUgus","title":"PS3 Walk","description":"Controlling the NUgus with a PS3 controller.","slug":"/archive/nugus/ps3-walk","hidden":null},"previous":{"chapter":"NUgus","title":"Servo Setup and Calibration","description":"Learn how to test and calibrate servos.","slug":"/archive/nugus/servo-calibration","hidden":null},"menu":[{"title":"Team","slug":"/team/introduction","chapters":[{"title":"Introduction","slug":"/team/introduction","pages":[{"title":"Introduction to NUbots","slug":"/team/introduction","hidden":null},{"title":"Areas of Research","slug":"/team/areas-of-research","hidden":null},{"title":"Current Team","slug":"/team/current-members","hidden":null}],"hidden":false},{"title":"Joining the Team","slug":"/team/how-we-work","pages":[{"title":"How We Work","slug":"/team/how-we-work","hidden":null},{"title":"How to Join NUbots","slug":"/team/how-to-join","hidden":null},{"title":"Lab Induction","slug":"/team/induction","hidden":null}],"hidden":false},{"title":"Community","slug":"/team/sponsors","pages":[{"title":"Sponsors","slug":"/team/sponsors","hidden":null},{"title":"Connect","slug":"/team/connect","hidden":null}],"hidden":false},{"title":"History","slug":"/team/history","pages":[{"title":"Team History","slug":"/team/history","hidden":null},{"title":"Past Members","slug":"/team/past-members","hidden":null},{"title":"Publications","slug":"/team/publications","hidden":null}],"hidden":false},{"title":"RoboCup","slug":"/team/robocup","pages":[{"title":"RoboCup","slug":"/team/robocup","hidden":null},{"title":"Resources","slug":"/team/robocup/resources","hidden":null},{"title":"Debriefs","slug":"/team/robocup/debriefs","hidden":null}],"hidden":false}],"iconSvg":"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0z\"/><circle opacity=\".3\" cx=\"9\" cy=\"8\" r=\"2\"/><path opacity=\".3\" d=\"M9 15c-2.7 0-5.8 1.29-6 2.01V18h12v-1c-.2-.71-3.3-2-6-2z\"/><path d=\"M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87zM15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24a5.98 5.98 0 010 7.52c.42.14.86.24 1.33.24zM9 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zM9 13c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1z\"/></svg>","hidden":false},{"title":"System","slug":"/system/foundations/overview","chapters":[{"title":"Foundations","slug":"/system/foundations/overview","pages":[{"title":"Overview","slug":"/system/foundations/overview","hidden":null},{"title":"Build System","slug":"/system/foundations/build-system","hidden":null},{"title":"Continuous Integration","slug":"/system/foundations/ci-system","hidden":null},{"title":"NUClear","slug":"/system/foundations/nuclear","hidden":null},{"title":"Mathematics","slug":"/system/foundations/mathematics","hidden":null},{"title":"Configuration and Script System","slug":"/system/foundations/config-script","hidden":null},{"title":"Director","slug":"/system/foundations/director","hidden":null}],"hidden":false},{"title":"Subsystems","slug":"/system/subsystems/input","pages":[{"title":"Input","slug":"/system/subsystems/input","hidden":null},{"title":"Localisation","slug":"/system/subsystems/localisation","hidden":null},{"title":"Odometry","slug":"/system/subsystems/odometry","hidden":null},{"title":"Motion","slug":"/system/subsystems/motion","hidden":null},{"title":"Vision","slug":"/system/subsystems/vision","hidden":null},{"title":"Behaviour","slug":"/system/subsystems/behaviour","hidden":null},{"title":"Logging","slug":"/system/subsystems/logging","hidden":null}],"hidden":false},{"title":"Tools","slug":"/system/tools/nusight","pages":[{"title":"NUsight","slug":"/system/tools/nusight","hidden":null},{"title":"NUbook","slug":"/system/tools/nubook","hidden":null},{"title":"NUpbr","slug":"/system/tools/nupbr","hidden":null},{"title":"NUgan","slug":"/system/tools/nugan","hidden":null},{"title":"System Configuration","slug":"/system/tools/system_configuration","hidden":null},{"title":"NatNet SDK","slug":"/system/tools/natnet_sdk","hidden":null}],"hidden":false},{"title":"Hardware","slug":"/system/hardware/k1","pages":[{"title":"K1 Specification","slug":"/system/hardware/k1","hidden":null}],"hidden":false},{"title":"Modules","slug":"/system/modules/actuation/","pages":[{"title":"Actuation","slug":"/system/modules/actuation/","hidden":null},{"title":"Extension","slug":"/system/modules/extension/","hidden":null},{"title":"Input","slug":"/system/modules/input/","hidden":null},{"title":"Localisation","slug":"/system/modules/localisation/","hidden":null},{"title":"Nbs","slug":"/system/modules/nbs/","hidden":null},{"title":"Network","slug":"/system/modules/network/","hidden":null},{"title":"Output","slug":"/system/modules/output/","hidden":null},{"title":"Planning","slug":"/system/modules/planning/","hidden":null},{"title":"Platform","slug":"/system/modules/platform/","hidden":null},{"title":"Purpose","slug":"/system/modules/purpose/","hidden":null},{"title":"Skill","slug":"/system/modules/skill/","hidden":null},{"title":"Strategy","slug":"/system/modules/strategy/","hidden":null},{"title":"Support","slug":"/system/modules/support/","hidden":null},{"title":"Tools","slug":"/system/modules/tools/","hidden":null},{"title":"Vision","slug":"/system/modules/vision/","hidden":null}],"hidden":false}],"iconSvg":"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0zm0 0h24v24H0V0z\"/><path opacity=\".3\" d=\"M4 19h14V5H4v14zm8-12h4v3h-4V7zm0 4h4v6h-4v-6zM6 7h5v5H6V7zm0 6h5v4H6v-4z\"/><path d=\"M6 13h5v4H6zm0-6h5v5H6zm6 0h4v3h-4zm0 4h4v6h-4zm10-2V7h-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2v-2h-2V9h2zm-4 10H4V5h14v14z\"/></svg>","hidden":false},{"title":"Guides","slug":"/guides/main/getting-started","chapters":[{"title":"Main Codebase","slug":"/guides/main/getting-started","pages":[{"title":"Getting Started","slug":"/guides/main/getting-started","hidden":null},{"title":"NUClear","slug":"/guides/main/nuclear-tutorial","hidden":null},{"title":"Data Recording and Playback","slug":"/guides/main/data-recording-playback","hidden":null},{"title":"Onboarding Workshop","slug":"/guides/main/onboarding","hidden":null}],"hidden":false},{"title":"Tools","slug":"/guides/tools/nusight-contribution","pages":[{"title":"Contributing to NUsight","slug":"/guides/tools/nusight-contribution","hidden":null},{"title":"Using NUpbr","slug":"/guides/tools/nupbr-guide","hidden":null},{"title":"GameController Setup","slug":"/guides/tools/gamecontroller","hidden":null}],"hidden":false},{"title":"Hardware","slug":"/guides/hardware/working-with-robots","pages":[{"title":"Working with Robots","slug":"/guides/hardware/working-with-robots","hidden":null},{"title":"DARwIn Op2 Robot Restoration and Calibration Guide","slug":"/guides/hardware/darwin-op2-guide","hidden":null}],"hidden":false},{"title":"General","slug":"/guides/general/learning-resources","pages":[{"title":"Learning Resources","slug":"/guides/general/learning-resources","hidden":null},{"title":"Contribution Workflow","slug":"/guides/general/contribute","hidden":null},{"title":"RoboCup Setup","slug":"/guides/general/robocup-setup","hidden":null},{"title":"Troubleshooting","slug":"/guides/general/troubleshooting","hidden":null},{"title":"Code Conventions","slug":"/guides/general/code-conventions","hidden":null},{"title":"Glossary","slug":"/guides/general/glossary","hidden":null}],"hidden":false}],"iconSvg":"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0z\"/><path d=\"M21 5c-1.11-.35-2.33-.5-3.5-.5-1.95 0-4.05.4-5.5 1.5-1.45-1.1-3.55-1.5-5.5-1.5S2.45 4.9 1 6v14.65c0 .25.25.5.5.5.1 0 .15-.05.25-.05C3.1 20.45 5.05 20 6.5 20c1.95 0 4.05.4 5.5 1.5 1.35-.85 3.8-1.5 5.5-1.5 1.65 0 3.35.3 4.75 1.05.1.05.15.05.25.05.25 0 .5-.25.5-.5V6c-.6-.45-1.25-.75-2-1zM3 18.5V7c1.1-.35 2.3-.5 3.5-.5 1.34 0 3.13.41 4.5.99v11.5C9.63 18.41 7.84 18 6.5 18c-1.2 0-2.4.15-3.5.5zm18 0c-1.1-.35-2.3-.5-3.5-.5-1.34 0-3.13.41-4.5.99V7.49c1.37-.59 3.16-.99 4.5-.99 1.2 0 2.4.15 3.5.5v11.5z\"/><path opacity=\".3\" d=\"M11 7.49c-1.37-.58-3.16-.99-4.5-.99-1.2 0-2.4.15-3.5.5v11.5c1.1-.35 2.3-.5 3.5-.5 1.34 0 3.13.41 4.5.99V7.49z\"/><g><path d=\"M17.5 10.5c.88 0 1.73.09 2.5.26V9.24c-.79-.15-1.64-.24-2.5-.24-1.28 0-2.46.16-3.5.47v1.57c.99-.35 2.18-.54 3.5-.54zM17.5 13.16c.88 0 1.73.09 2.5.26V11.9c-.79-.15-1.64-.24-2.5-.24-1.28 0-2.46.16-3.5.47v1.57c.99-.34 2.18-.54 3.5-.54zM17.5 15.83c.88 0 1.73.09 2.5.26v-1.52c-.79-.15-1.64-.24-2.5-.24-1.28 0-2.46.16-3.5.47v1.57c.99-.35 2.18-.54 3.5-.54z\"/></g></svg>","hidden":false},{"title":"Archive","slug":"/archive/nugus/specification","chapters":[{"title":"NUgus","slug":"/archive/nugus/specification","pages":[{"title":"NUgus Specification","slug":"/archive/nugus/specification","hidden":null},{"title":"Flashing a NUgus","slug":"/archive/nugus/flashing","hidden":null},{"title":"Servo Setup and Calibration","slug":"/archive/nugus/servo-calibration","hidden":null},{"title":"Running and Tuning Scripts","slug":"/archive/nugus/scripts","hidden":null},{"title":"PS3 Walk","slug":"/archive/nugus/ps3-walk","hidden":null},{"title":"Batteries","slug":"/archive/nugus/batteries","hidden":null},{"title":"Camera Calibration","slug":"/archive/nugus/camera-calibration","hidden":null}],"hidden":false},{"title":"Visual Mesh","slug":"/archive/visual-mesh/vision","pages":[{"title":"Visual Mesh Vision","slug":"/archive/visual-mesh/vision","hidden":null},{"title":"Visual Mesh Getting Started","slug":"/archive/visual-mesh/guide","hidden":null},{"title":"Maintaining Subsystems","slug":"/archive/visual-mesh/maintaining-subsystems","hidden":null}],"hidden":false}],"iconSvg":"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0z\"/><path opacity=\".3\" fill-rule=\"evenodd\" d=\"M4 5h16v1H4zM5 11h14v8H5zm4 1v2h6v-2z\"/><path fill-rule=\"evenodd\" d=\"M3 3h18a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v1h16V5zM3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm2 2v8h14v-8zm4 1h6v2H9z\"/></svg>\n","hidden":false},{"title":"Kitchen Sink","slug":"/kitchen-sink/headers","chapters":[{"title":"Markdown","slug":"/kitchen-sink/headers","pages":[{"title":"Headers","slug":"/kitchen-sink/headers","hidden":true},{"title":"Formatting and Paragraphs","slug":"/kitchen-sink/formatting-and-paragraphs","hidden":true},{"title":"Blockquotes","slug":"/kitchen-sink/blockquotes","hidden":true},{"title":"Alerts","slug":"/kitchen-sink/alerts","hidden":true},{"title":"Images","slug":"/kitchen-sink/images","hidden":true},{"title":"Lists","slug":"/kitchen-sink/lists","hidden":true},{"title":"Code","slug":"/kitchen-sink/code","hidden":true},{"title":"Math","slug":"/kitchen-sink/math","hidden":true},{"title":"Table of Contents","slug":"/kitchen-sink/table-of-contents","hidden":true},{"title":"Tables","slug":"/kitchen-sink/tables","hidden":true},{"title":"Collapsible Content","slug":"/kitchen-sink/collapsible","hidden":true},{"title":"GraphViz Diagrams","slug":"/kitchen-sink/graphviz-diagrams","hidden":true},{"title":"Referencing","slug":"/kitchen-sink/referencing","hidden":true}],"hidden":true}],"iconSvg":"<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><g><rect fill=\"none\" height=\"24\" width=\"24\"/></g><g><g><g opacity=\".3\"><polygon points=\"8.66,14.64 4.41,18.88 5.12,19.59 9.36,15.34 9.36,15.34 8.66,14.64\"/></g><g opacity=\".3\"><rect height=\"6\" transform=\"matrix(0.7071 -0.7071 0.7071 0.7071 -7.0983 17.0848)\" width=\"1\" x=\"16.57\" y=\"14.11\"/></g><g><path d=\"M21.67,18.17l-5.3-5.3h-0.99l-2.54,2.54v0.99l5.3,5.3c0.39,0.39,1.02,0.39,1.41,0l2.12-2.12 C22.06,19.2,22.06,18.56,21.67,18.17z M18.84,19.59l-4.24-4.24l0.71-0.71l4.24,4.24L18.84,19.59z\"/></g><g><path d=\"M17.34,10.19l1.41-1.41l2.12,2.12c1.17-1.17,1.17-3.07,0-4.24l-3.54-3.54l-1.41,1.41V1.71L15.22,1l-3.54,3.54l0.71,0.71 h2.83l-1.41,1.41l1.06,1.06l-2.89,2.89L7.85,6.48V5.06L4.83,2.04L2,4.87l3.03,3.03h1.41l4.13,4.13l-0.85,0.85H7.6l-5.3,5.3 c-0.39,0.39-0.39,1.02,0,1.41l2.12,2.12c0.39,0.39,1.02,0.39,1.41,0l5.3-5.3v-2.12l5.15-5.15L17.34,10.19z M9.36,15.34 l-4.24,4.24l-0.71-0.71l4.24-4.24l0,0L9.36,15.34L9.36,15.34z\"/></g></g></g></svg>","hidden":true}],"references":null,"hidden":null}},
    "staticQueryHashes": ["2362849146","445096115","962821121"]}