From 9e7712c5f76125e8bbdc0f846eec608a827b1f1b Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 10 Oct 2023 17:51:28 +0000 Subject: [PATCH] Built site --- _site/css/tomorrow-night.css | 2 +- _site/docs/v5/autonomic.html | 8 +- _site/docs/v5/bridges.html | 8 +- _site/docs/v5/bucket-explorer.html | 8 +- _site/docs/v5/calendar.html | 8 +- _site/docs/v5/cfs.html | 8 +- _site/docs/v5/cmd-sender.html | 8 +- _site/docs/v5/cmd-tlm-server.html | 8 +- _site/docs/v5/command.html | 8 +- _site/docs/v5/contributing.html | 8 +- _site/docs/v5/custom-widgets.html | 8 +- _site/docs/v5/data-extractor.html | 8 +- _site/docs/v5/data-viewer.html | 8 +- _site/docs/v5/development.html | 8 +- _site/docs/v5/format.html | 8 +- _site/docs/v5/gettingstarted.html | 8 +- _site/docs/v5/handbooks.html | 8 +- _site/docs/v5/host-install.html | 8 +- _site/docs/v5/index.html | 8 +- _site/docs/v5/installation.html | 8 +- _site/docs/v5/interfaces.html | 8 +- _site/docs/v5/json-api.html | 10 +- _site/docs/v5/limits-monitor.html | 8 +- _site/docs/v5/little-endian-bitfields.html | 8 +- _site/docs/v5/local-mode.html | 8 +- _site/docs/v5/log-structure.html | 8 +- _site/docs/v5/logging.html | 8 +- _site/docs/v5/monitoring.html | 8 +- _site/docs/v5/packet-viewer.html | 8 +- _site/docs/v5/performance.html | 8 +- _site/docs/v5/philosophy.html | 8 +- _site/docs/v5/plugins.html | 8 +- _site/docs/v5/podman.html | 8 +- _site/docs/v5/protocols.html | 8 +- _site/docs/v5/raspberrypi.html | 8 +- _site/docs/v5/requirements.html | 8 +- _site/docs/v5/roadmap.html | 8 +- _site/docs/v5/script-runner.html | 8 +- ...est-practices.html => script-writing.html} | 361 +++- .../v5/{scripting.html => scripting-api.html} | 1875 +++++++---------- _site/docs/v5/ssl-tls.html | 8 +- _site/docs/v5/streaming-api.html | 8 +- _site/docs/v5/table-manager.html | 8 +- _site/docs/v5/table.html | 8 +- _site/docs/v5/target.html | 8 +- _site/docs/v5/telemetry-screens.html | 8 +- _site/docs/v5/telemetry.html | 8 +- _site/docs/v5/testing.html | 8 +- _site/docs/v5/tlm-grapher.html | 8 +- _site/docs/v5/tlm-viewer.html | 8 +- _site/docs/v5/tools.html | 8 +- _site/docs/v5/upgrading.html | 8 +- _site/docs/v5/xtce.html | 8 +- _site/feed.xml | 4 +- _site/scripts/verify_scripting_api.rb | 57 + 55 files changed, 1394 insertions(+), 1307 deletions(-) rename _site/docs/v5/{scripting-best-practices.html => script-writing.html} (70%) rename _site/docs/v5/{scripting.html => scripting-api.html} (73%) create mode 100644 _site/scripts/verify_scripting_api.rb diff --git a/_site/css/tomorrow-night.css b/_site/css/tomorrow-night.css index f56a191..fcc2823 100644 --- a/_site/css/tomorrow-night.css +++ b/_site/css/tomorrow-night.css @@ -59,7 +59,7 @@ .highlight .sr { color: #b5bd68 !important; } /* Literal.String.Regex */ .highlight .s1 { color: #b5bd68 !important; } /* Literal.String.Single */ .highlight .ss { color: #b5bd68 !important; } /* Literal.String.Symbol */ -.highlight .bp { color: #c5c8c6 !important; } /* Name.Builtin.Pseudo */ +.highlight .bp { color: #b294bb !important; } /* Name.Builtin.Pseudo (previously c5c8c6) */ .highlight .vc { color: #cc6666 !important; } /* Name.Variable.Class */ .highlight .vg { color: #cc6666 !important; } /* Name.Variable.Global */ .highlight .vi { color: #cc6666 !important; } /* Name.Variable.Instance */ diff --git a/_site/docs/v5/autonomic.html b/_site/docs/v5/autonomic.html index 44c34e5..d878bdf 100644 --- a/_site/docs/v5/autonomic.html +++ b/_site/docs/v5/autonomic.html @@ -2176,11 +2176,13 @@

Guides

+ +
  • - Scripting Guide + Scripting API Guide
  • @@ -2264,13 +2266,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/bridges.html b/_site/docs/v5/bridges.html index a253b75..fda26c5 100644 --- a/_site/docs/v5/bridges.html +++ b/_site/docs/v5/bridges.html @@ -2215,11 +2215,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2303,13 +2305,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/bucket-explorer.html b/_site/docs/v5/bucket-explorer.html index 7470bf0..0f7a427 100644 --- a/_site/docs/v5/bucket-explorer.html +++ b/_site/docs/v5/bucket-explorer.html @@ -2130,11 +2130,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2218,13 +2220,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/calendar.html b/_site/docs/v5/calendar.html index b088863..baa3345 100644 --- a/_site/docs/v5/calendar.html +++ b/_site/docs/v5/calendar.html @@ -2169,11 +2169,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2257,13 +2259,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/cfs.html b/_site/docs/v5/cfs.html index eb10c38..d57b1f0 100644 --- a/_site/docs/v5/cfs.html +++ b/_site/docs/v5/cfs.html @@ -2458,11 +2458,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2546,13 +2548,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/cmd-sender.html b/_site/docs/v5/cmd-sender.html index bbf89ee..faa54c8 100644 --- a/_site/docs/v5/cmd-sender.html +++ b/_site/docs/v5/cmd-sender.html @@ -2162,11 +2162,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2250,13 +2252,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/cmd-tlm-server.html b/_site/docs/v5/cmd-tlm-server.html index 4d0e19f..39e1c77 100644 --- a/_site/docs/v5/cmd-tlm-server.html +++ b/_site/docs/v5/cmd-tlm-server.html @@ -2181,11 +2181,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2269,13 +2271,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/command.html b/_site/docs/v5/command.html index 3cec2d7..af6e49f 100644 --- a/_site/docs/v5/command.html +++ b/_site/docs/v5/command.html @@ -3419,11 +3419,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -3507,13 +3509,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/contributing.html b/_site/docs/v5/contributing.html index 11721c4..4245c6c 100644 --- a/_site/docs/v5/contributing.html +++ b/_site/docs/v5/contributing.html @@ -2174,11 +2174,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2262,13 +2264,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/custom-widgets.html b/_site/docs/v5/custom-widgets.html index d7b69ce..c48e9b0 100644 --- a/_site/docs/v5/custom-widgets.html +++ b/_site/docs/v5/custom-widgets.html @@ -2173,11 +2173,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2261,13 +2263,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/data-extractor.html b/_site/docs/v5/data-extractor.html index 674a84c..360d2d8 100644 --- a/_site/docs/v5/data-extractor.html +++ b/_site/docs/v5/data-extractor.html @@ -2243,11 +2243,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2331,13 +2333,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/data-viewer.html b/_site/docs/v5/data-viewer.html index 787a189..4938659 100644 --- a/_site/docs/v5/data-viewer.html +++ b/_site/docs/v5/data-viewer.html @@ -2152,11 +2152,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2240,13 +2242,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/development.html b/_site/docs/v5/development.html index 45c0424..c8b35c7 100644 --- a/_site/docs/v5/development.html +++ b/_site/docs/v5/development.html @@ -2272,11 +2272,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2360,13 +2362,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/format.html b/_site/docs/v5/format.html index f68f1ab..1f9158b 100644 --- a/_site/docs/v5/format.html +++ b/_site/docs/v5/format.html @@ -2246,11 +2246,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2334,13 +2336,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/gettingstarted.html b/_site/docs/v5/gettingstarted.html index e6337b7..9604038 100644 --- a/_site/docs/v5/gettingstarted.html +++ b/_site/docs/v5/gettingstarted.html @@ -2308,11 +2308,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2396,13 +2398,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/handbooks.html b/_site/docs/v5/handbooks.html index d43e126..77d49ef 100644 --- a/_site/docs/v5/handbooks.html +++ b/_site/docs/v5/handbooks.html @@ -2105,11 +2105,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2193,13 +2195,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/host-install.html b/_site/docs/v5/host-install.html index 75939d2..f8c7d67 100644 --- a/_site/docs/v5/host-install.html +++ b/_site/docs/v5/host-install.html @@ -2149,11 +2149,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2237,13 +2239,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/index.html b/_site/docs/v5/index.html index 735af1d..fa6db94 100644 --- a/_site/docs/v5/index.html +++ b/_site/docs/v5/index.html @@ -2153,11 +2153,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2241,13 +2243,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/installation.html b/_site/docs/v5/installation.html index c424806..1e74810 100644 --- a/_site/docs/v5/installation.html +++ b/_site/docs/v5/installation.html @@ -2222,11 +2222,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2310,13 +2312,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/interfaces.html b/_site/docs/v5/interfaces.html index 20a83c5..9ffc12b 100644 --- a/_site/docs/v5/interfaces.html +++ b/_site/docs/v5/interfaces.html @@ -2514,11 +2514,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2602,13 +2604,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/json-api.html b/_site/docs/v5/json-api.html index 699c379..f292b89 100644 --- a/_site/docs/v5/json-api.html +++ b/_site/docs/v5/json-api.html @@ -130,7 +130,7 @@

    Socket Connections

    Supported Methods

    -

    The list of methods supported by the COSMOS API may be found in the api source code on Github. The @api_whitelist variable is initialized with an array of all methods accepted by the CTS. This page will not show the full argument list for every method in the API, but it should be noted that the JSON API methods correspond to the COSMOS scripting API methods documented in the Scripting Guide. This page will show a few example JSON requests and responses, and the scripting guide can be used as a reference to extrapolate how to build requests and parse responses for methods not explicitly documented here.

    +

    The list of methods supported by the COSMOS API may be found in the api source code on Github. The @api_whitelist variable is initialized with an array of all methods accepted by the CTS. This page will not show the full argument list for every method in the API, but it should be noted that the JSON API methods correspond to the COSMOS scripting API methods documented in the Ruby Scripting Guide. This page will show a few example JSON requests and responses, and the scripting guide can be used as a reference to extrapolate how to build requests and parse responses for methods not explicitly documented here.

    Existing Implementations

    @@ -2274,11 +2274,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2362,13 +2364,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/limits-monitor.html b/_site/docs/v5/limits-monitor.html index 447a588..c13ec5f 100644 --- a/_site/docs/v5/limits-monitor.html +++ b/_site/docs/v5/limits-monitor.html @@ -2144,11 +2144,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2232,13 +2234,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/little-endian-bitfields.html b/_site/docs/v5/little-endian-bitfields.html index 50c8a65..70c0b16 100644 --- a/_site/docs/v5/little-endian-bitfields.html +++ b/_site/docs/v5/little-endian-bitfields.html @@ -2126,11 +2126,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2214,13 +2216,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/local-mode.html b/_site/docs/v5/local-mode.html index e9e50a3..bcf90ce 100644 --- a/_site/docs/v5/local-mode.html +++ b/_site/docs/v5/local-mode.html @@ -2150,11 +2150,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2238,13 +2240,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/log-structure.html b/_site/docs/v5/log-structure.html index c855c1d..0c11036 100644 --- a/_site/docs/v5/log-structure.html +++ b/_site/docs/v5/log-structure.html @@ -2340,11 +2340,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2428,13 +2430,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/logging.html b/_site/docs/v5/logging.html index def3a38..9c3dda9 100644 --- a/_site/docs/v5/logging.html +++ b/_site/docs/v5/logging.html @@ -2146,11 +2146,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2234,13 +2236,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/monitoring.html b/_site/docs/v5/monitoring.html index 510848b..0df59c7 100644 --- a/_site/docs/v5/monitoring.html +++ b/_site/docs/v5/monitoring.html @@ -2314,11 +2314,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2402,13 +2404,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/packet-viewer.html b/_site/docs/v5/packet-viewer.html index a1a775b..206b385 100644 --- a/_site/docs/v5/packet-viewer.html +++ b/_site/docs/v5/packet-viewer.html @@ -2159,11 +2159,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2247,13 +2249,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/performance.html b/_site/docs/v5/performance.html index 0dbd943..672e3bc 100644 --- a/_site/docs/v5/performance.html +++ b/_site/docs/v5/performance.html @@ -2380,11 +2380,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2468,13 +2470,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/philosophy.html b/_site/docs/v5/philosophy.html index 30aaafb..bdb7798 100644 --- a/_site/docs/v5/philosophy.html +++ b/_site/docs/v5/philosophy.html @@ -2127,11 +2127,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2215,13 +2217,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/plugins.html b/_site/docs/v5/plugins.html index 3f70f12..3e262ea 100644 --- a/_site/docs/v5/plugins.html +++ b/_site/docs/v5/plugins.html @@ -3987,11 +3987,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -4075,13 +4077,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/podman.html b/_site/docs/v5/podman.html index 650d3b3..4945f50 100644 --- a/_site/docs/v5/podman.html +++ b/_site/docs/v5/podman.html @@ -2246,11 +2246,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2334,13 +2336,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/protocols.html b/_site/docs/v5/protocols.html index f5e29ce..15b4429 100644 --- a/_site/docs/v5/protocols.html +++ b/_site/docs/v5/protocols.html @@ -2775,11 +2775,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2863,13 +2865,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/raspberrypi.html b/_site/docs/v5/raspberrypi.html index 4119e16..0952f1d 100644 --- a/_site/docs/v5/raspberrypi.html +++ b/_site/docs/v5/raspberrypi.html @@ -2188,11 +2188,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2276,13 +2278,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/requirements.html b/_site/docs/v5/requirements.html index d82681c..50ca121 100644 --- a/_site/docs/v5/requirements.html +++ b/_site/docs/v5/requirements.html @@ -3116,11 +3116,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -3204,13 +3206,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/roadmap.html b/_site/docs/v5/roadmap.html index 3eb24b9..06e5e83 100644 --- a/_site/docs/v5/roadmap.html +++ b/_site/docs/v5/roadmap.html @@ -2101,11 +2101,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2189,13 +2191,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/script-runner.html b/_site/docs/v5/script-runner.html index 11d1e50..3b2b1ba 100644 --- a/_site/docs/v5/script-runner.html +++ b/_site/docs/v5/script-runner.html @@ -2310,11 +2310,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2398,13 +2400,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/scripting-best-practices.html b/_site/docs/v5/script-writing.html similarity index 70% rename from _site/docs/v5/scripting-best-practices.html rename to _site/docs/v5/script-writing.html index 0c3d24d..85d3af6 100644 --- a/_site/docs/v5/scripting-best-practices.html +++ b/_site/docs/v5/script-writing.html @@ -2,7 +2,7 @@ - Scripting Best Practices + Script Writing Guide @@ -105,6 +105,11 @@

    -

    Scripting Best Practices

    +

    Script Writing Guide

    Introduction

    This guide aims to provide the best practices for using the scripting capabilities provided by COSMOS. Scripts are used to automate a series of activities for operations or testing. The goal of this document is to ensure scripts are written that are simple, easy to understand, maintainable, and correct. Guidance on some of the key details of using the COSMOS Script Runner is also provided.

    +

    +Concepts

    + +

    COSMOS supports both Ruby and Python for writing scripts. Ruby and Python are very similar scripting languages and most of this guide applies directly to both. Where examples are used, both a Ruby and Python example are given.

    + +

    +Ruby vs Python in COSMOS

    + +

    There are many similaritys and a few key differences between Ruby and Python when it comes to writing COSMOS scripts.

    + +
      +
    1. There is no 80 character limit on line length. Lines can be as long as you like, but be careful to not make them too long as it makes printed reviews of scripts more difficult.
    2. +
    3. Indentation white space: +
        +
      1. Ruby: Not significant. Ruby uses the end keyword to determine indented code blocks with a standard of 2 spaces.
      2. +
      3. Python: Significant. Python uses indentation to determine code blocks with a standard of 4 spaces.
      4. +
      +
    4. +
    5. Variables do not have to be declared ahead of time and can be reassigned later, i.e. Ruby and Python are dynamically typed.
    6. +
    7. Variable interpolation: +
        +
      1. Ruby: Variable values can be placed into strings using the "#{variable}" syntax.
      2. +
      3. Python: Variable values can be placed into f-strings using the f"{variable}" syntax.
      4. +
      +
    8. +
    9. A variable declared inside of a block or loop will not exist outside of that block unless it was already declared.
    10. +
    + +

    Both languages provides a script writer a lot of power. But with great power comes great responsibility. Remember when writing your scripts that you or someone else will come along later and need to understand them. Therefore use the following style guidelines:

    + + +
    +

    The following is an example of good Ruby style:

    + +
    load 'TARGET/lib/upload_utility.rb' # library we do NOT want to show executing
    +load_utility 'TARGET/lib/helper_utility.rb' # library we do want to show executing
    +
    +# Declare constants
    +OUR_TARGETS = ['INST','INST2']
    +
    +# Clear the collect counter of the passed in target name
    +def clear_collects(target)
    +  cmd("#{target} CLEAR")
    +  wait_check("#{target} HEALTH_STATUS COLLECTS == 0", 5)
    +end
    +
    +######################################
    +# START
    +######################################
    +helper = HelperUtility.new
    +helper.setup
    +
    +# Perform collects on all the targets
    +OUR_TARGETS.each do |target|
    +  collects = tlm("#{target} HEALTH_STATUS COLLECTS")
    +  cmd("#{target} COLLECT with TYPE SPECIAL")
    +  wait_check("#{target} HEALTH_STATUS COLLECTS == #{collects + 1}", 5)
    +end
    +
    +clear_collects('INST')
    +clear_collects('INST2')
    +
    + +

    The following is an example of good Python style:

    + +
    from openc3.script import *
    +
    +load('TARGET/lib/upload_utility.rb') # library we do NOT want to show executing
    +load_utility('TARGET/lib/helper_utility.rb') # library we do want to show executing
    +
    +# Declare constants
    +OUR_TARGETS = ['INST','INST2']
    +
    +# Clear the collect counter of the passed in target name
    +def clear_collects(target):
    +    cmd(f"{target} CLEAR")
    +    wait_check(f"{target} HEALTH_STATUS COLLECTS == 0", 5)
    +
    +######################################
    +# START
    +######################################
    +helper = HelperUtility()
    +helper.setup()
    +
    +# Perform collects on all the targets
    +for target in OUR_TARGETS:
    +    collects = tlm(f"{target} HEALTH_STATUS COLLECTS")
    +    cmd(f"{target} COLLECT with TYPE SPECIAL")
    +    wait_check(f"{target} HEALTH_STATUS COLLECTS == {collects + 1}", 5)
    +
    +clear_collects('INST')
    +clear_collects('INST2')
    +
    + +

    Both examples shows several features of COSMOS scripting in action. Notice the difference between ‘load’ and ‘load_utility’. The first is to load additional scripts which will NOT be shown in Script Runner when executing. This is a good place to put code which takes a long time to run such as image analysis or other looping code where you just want the output. ‘load_utility’ will visually execute the code line by line to show the user what is happening.

    + +

    Next we declare our constants and create an array of strings which we store in OUR_TARGETS. Notice the constant is all uppercase with underscores.

    + +

    Then we declare our local methods of which we have one called clear_collects. Please provide a comment at the beginning of each method describing what it does and the parameters that it takes.

    + +

    The ‘helper_utility’ is then created. Note the similarity in the class name and the file name we loaded.

    + +

    The collect example shows how you can iterate over the array of strings we previously created and use variables when commanding and checking telemetry. The Ruby pound bracket #{} notation and python f-string f”{} notation puts whatever the variable holds into the string. You can even execute additional code inside the brackets like we do when checking for the collect count to increment.

    + +

    Finally we call our ‘clear_collects’ method on each target by passing the target name.

    +

    Scripting Philosophy

    @@ -190,19 +320,28 @@

    wait_check("INST HEALTH_STATUS TYPE == 'NORMAL'", 5) -

    or similarly with a counter that is sampled before the command:

    +

    or similarly with a counter that is sampled before the command.

    + +

    Ruby:

    count = tlm("INST HEALTH_STATUS COLLECTS")
     cmd("INST COLLECT with TYPE NORMAL, TEMP 10.0")
     wait_check("INST HEALTH_STATUS COLLECTS >= #{count + 1}", 5)
     
    +

    Python:

    + +
    count = tlm("INST HEALTH_STATUS COLLECTS")
    +cmd("INST COLLECT with TYPE NORMAL, TEMP 10.0")
    +wait_check(f"INST HEALTH_STATUS COLLECTS >= {count + 1}", 5)
    +
    +

    90% of the COSMOS scripts you write should be the simple patterns shown above except that you may need to check more than one item after each command to make sure the command worked as expected.

    KISS (Keep It Simple Stupid)

    -

    Ruby is a very powerful language with many ways to accomplish the same thing. Given that, always choose the method that is easiest to understand for yourself and others. While it is possible to create complex one liners or obtuse regular expressions, you’ll thank yourself later by expanding complex one liners and breaking up and documenting regular expressions.

    +

    Ruby and Python are very powerful languages with many ways to accomplish the same thing. Given that, always choose the method that is easiest to understand for yourself and others. While it is possible to create complex one liners or obtuse regular expressions, you’ll thank yourself later by expanding complex one liners and breaking up and documenting regular expressions.

    Keep things DRY (Don’t Repeat Yourself)

    @@ -213,11 +352,19 @@

    For example, a script that powers on a subsystem and ensures correct telemetry would become:

    +

    Ruby:

    +
    def power_on_subsystem
       # 100 lines of cmd(), wait_check(), etc
     end
     
    +

    Python:

    + +
    def power_on_subsystem():
    +    # 100 lines of cmd(), wait_check(), etc
    +
    +

    Ideally, the above methods would be stored in another file where it could be used by other scripts. If it is truly only useful in the one script, then it could be at the top of the file. The updated script would then look like:

    power_on_subsystem()
    @@ -231,19 +378,29 @@ 

    # etc.

    -

    Blocks of code where only the only variation is the mnemonics or values checked can be replaced by methods with arguments like this:

    +

    Blocks of code where only the only variation is the mnemonics or values checked can be replaced by methods with arguments.

    + +

    Ruby:

    def test_minimum_temp(enable_cmd_name, enable_tlm, temp_tlm, expected_temp)
       cmd("TARGET #{enable_cmd_name} with ENABLE TRUE")
    -  wait_check("TARGET #{enable_tlm} == 'TRUE;", 5)
    +  wait_check("TARGET #{enable_tlm} == 'TRUE'", 5)
       wait_check("TARGET #{temp_tlm} >= #{expected_temp}", 50)
     end
     
    +

    Python:

    + +
    def test_minimum_temp(enable_cmd_name, enable_tlm, temp_tlm, expected_temp):
    +    cmd(f"TARGET {enable_cmd_name} with ENABLE TRUE")
    +    wait_check(f"TARGET {enable_tlm} == 'TRUE'", 5)
    +    wait_check(f"TARGET {temp_tlm} >= {expected_temp}", 50)
    +
    +

    Use Comments Appropriately

    -

    Use comments when what you are doing is unclear or there is a higher-level purpose to a set of lines. Try to avoid putting numbers or other details in a comment as they can become out of sync with the underlying code. Ruby comments start with a # pound symbol and can be anywhere on a line.

    +

    Use comments when what you are doing is unclear or there is a higher-level purpose to a set of lines. Try to avoid putting numbers or other details in a comment as they can become out of sync with the underlying code. Ruby and Python comments start with a # pound symbol and can be anywhere on a line.

    # This line sends an abort command - BAD COMMENT, UNNECCESSARY
     cmd("INST ABORT")
    @@ -256,7 +413,7 @@ 

    COSMOS provides two unique ways to run scripts (also known as procedures). Script Runner provides both a script execution environment and a script editor. The script editor includes code completion for both COSMOS methods and command/telemetry item names. It is also a great environment to develop and test scripts. Script Runner provides a framework for users that are familiar with a traditional scripting model with longer style procedures, and for users that want to be able to edit their scripts in place.

    -

    When opening a suite file (named with ‘suite’) Script Runner provides a more formal, but also more powerful, environment for running scripts. Suite files breaks scripts down into suites, groups, and scripts (individual methods). Suites are the highest-level concept and would typically cover a large procedure such as a thermal vacuum test, or a large operations scenario such as performing on orbit checkout. Groups capture a related set of scripts such as all the scripts regarding a specific mechanism. A Group might be a collection of scripts all related to a subsystem, or a specific series of tests such as an RF checkout. Scripts capture individual activities that can either pass or fail. Script Runner allows for running an entire suite, one or more groups, or one or more scripts easily. It also automatically produces reports indentifing test timing, pass / fail counts, etc.

    +

    When opening a suite file (named with ‘suite’) Script Runner provides a more formal, but also more powerful, environment for running scripts. Suite files breaks scripts down into suites, groups, and scripts (individual methods). Suites are the highest-level concept and would typically cover a large procedure such as a thermal vacuum test, or a large operations scenario such as performing on orbit checkout. Groups capture a related set of scripts such as all the scripts regarding a specific mechanism. A Group might be a collection of scripts all related to a subsystem, or a specific series of tests such as an RF checkout. Scripts capture individual activities that can either pass or fail. Script Runner allows for running an entire suite, one or more groups, or one or more scripts easily. It also automatically produces reports containing timing, pass / fail counts, etc.

    The correct environment for the job is up to individual users, and many programs will use both script formats to complete their goals.

    @@ -265,13 +422,19 @@

    Loops are powerful constructs that allow you to perform the same operations multiple times without having to rewrite the same code over and over (See the DRY Concept). However, they can make restarting a COSMOS script at the point of a failure difficult or impossible. If there is a low probability of something failing, then loops are an excellent choice. If a script is running a loop over a list of telemetry points, it may be a better choice to “unroll” the loop by making the loop body into a method, and then calling that method directly for each iteration of a loop that would have occurred.

    -

    For example:

    +

    Ruby:

    10.times do |temperature_number|
       check_temperature(temperature_number + 1)
     end
     
    +

    Python:

    + +
    for temperature_number in range(1, 11):
    +    check_temperature(temperature_number)
    +
    +

    If the above script was stopped after temperature number 3, there would be no way to restart the loop at temperature number 4. A better solution for small loop counts is to unroll the loop.

    check_temperature(1)
    @@ -291,7 +454,7 @@ 

    Script Organization

    -

    All scripts must be part of a [Plugin]((/docs/v5/plugins). You can create a simple plugin called SCRIPTS or PROCEDURES that only contains lib and procedures directories to store scripts. If COSMOS detects a plugin without defined cmd/tlm it will not spawn microservices for telemetry processing.

    +

    All scripts must be part of a Plugin. You can create a simple plugin called SCRIPTS or PROCEDURES that only contains lib and procedures directories to store scripts. If COSMOS detects a plugin without defined cmd/tlm it will not spawn microservices for telemetry processing.

    Organizing Your Scripts into a Plugin

    @@ -317,8 +480,10 @@

    In your main procedure you will usually bring in the other files with instrumentation using load_utility.

    -
    load_utility('TARGET/lib/my_other_script.rb')
    -load_utility('TARGET/procedures/my_other_script.rb')
    +
    # Ruby:
    +load_utility('TARGET/lib/my_other_script.rb')
    +# Python:
    +load_utility('TARGET/procedures/my_other_script.py')
     

    @@ -326,6 +491,8 @@

    Put each activity into a distinct method. Putting your scripts into methods makes organization easy and gives a great high-level overview of what the overall script does (assuming you name the methods well). There are no bonus points for vague, short method names. Make your method names long and clear.

    +

    Ruby:

    +
    def test_1_heater_zone_control
       puts "Verifies requirements 304, 306, and 310"
       # Test code here
    @@ -337,35 +504,78 @@ 

    end

    +

    Python:

    + +
    def test_1_heater_zone_control():
    +    print("Verifies requirements 304, 306, and 310")
    +    # Test code here
    +
    +def script_1_heater_zone_control():
    +    print("Verifies requirements 304, 306, and 310")
    +    # Test code here
    +
    +

    Using Classes vs Unscoped Methods

    Classes in object-oriented programing allow you to organize a set of related methods and some associated state. The most important aspect is that the methods work on some shared state. For example, if you have code that moves a gimbal around, and need to keep track of the number of moves, or steps, performed across methods, then that is a wonderful place to use a class. If you just need a helper method to do something that happens multiple times in a script without copy and pasting, it probably does not need to be in a class.

    -

    NOTE: The convention in COSMOS is to have a TARGET/lib/target.rb file which is named after the TARGET name and contains a class called Target. This discussion refers to scripts in the TARGET/procedures directory.

    +

    NOTE: The convention in COSMOS is to have a TARGET/lib/target.[rb/py] file which is named after the TARGET name and contains a class called Target. This discussion refers to scripts in the TARGET/procedures directory.

    + +

    Ruby:

    class Gimbal
       attr_accessor :gimbal_steps
    +  def initialize()
    +    @gimbal_steps = 0
    +  end
       def move(steps_to_move)
         # Move the gimbal
         @gimbal_steps += steps_to_move
       end
       def home_gimbal
         # Home the gimbal
    -    @gimbal_steps += steps_moved
    +    @gimbal_steps = 0
       end
     end
     
     def perform_common_math(x, y)
    -   # Do the math and return result
    +  x + y
     end
     
     gimbal = Gimbal.new
    -gimbal.home
    +gimbal.home_gimbal
    +gimbal.move(100)
    +gimbal.move(200)
    +puts "Moved gimbal #{gimbal.gimbal_steps}"
    +result = perform_common_math(gimbal.gimbal_steps, 10)
    +puts "Math:#{result}"
    +
    + +

    Python:

    + +
    class Gimbal:
    +    def __init__(self):
    +        self.gimbal_steps = 0
    +
    +    def move(self, steps_to_move):
    +        # Move the gimbal
    +        self.gimbal_steps += steps_to_move
    +
    +    def home_gimbal(self):
    +        # Home the gimbal
    +        self.gimbal_steps = 0
    +
    +def perform_common_math(x, y):
    +    return x + y
    +
    +gimbal = Gimbal()
    +gimbal.home_gimbal()
     gimbal.move(100)
     gimbal.move(200)
    -puts "Moved gimbal #{gimbal.steps}"
    -perform_common_math(gimbal.steps, other_value)
    +print(f"Moved gimbal {gimbal.gimbal_steps}")
    +result = perform_common_math(gimbal.gimbal_steps, 10)
    +print(f"Math:{result}")
     

    @@ -375,16 +585,32 @@

    load_utility (and the deprecated require_utility), bring in instrumented code from other files. When COSMOS runs the code in the other file, Script Runner will dive into the other file and show each line highlighted as it executes. This should be the default way to bring in other files, as it allows continuing if something fails, and provides better visibility to operators.

    -

    However, sometimes you don’t want to display code executing from other files. Externally developed ruby libraries generally do not like to be instrumented, and code that contains large loops or that just takes a long time to execute when highlighting lines, will be much faster if included in a method that does not instrument lines. Ruby provides two ways to bring in uninstrumented code. The first is the “load” keyword. Load will bring in the code from another file and will bring in any changes to the file if it is updated on the next call to load. “require” is like load but is optimized to only bring in the code from another file once. Therefore, if you use require and then change the file it requires, you must restart Script Runner to re-require the file and bring in the changes. In general, load is recommended over require for COSMOS scripting. One gotcha with load is that it requires the full filename including extension, while the require keyword does not.

    +

    However, sometimes you don’t want to display code executing from other files. Externally developed libraries generally do not like to be instrumented, and code that contains large loops or that just takes a long time to execute when highlighting lines, will be much faster if included in a method that does not instrument lines. Ruby provides two ways to bring in uninstrumented code. The first is the “load” keyword. Load will bring in the code from another file and will bring in any changes to the file if it is updated on the next call to load. “require” is like load but is optimized to only bring in the code from another file once. Therefore, if you use require and then change the file it requires, you must restart Script Runner to re-require the file and bring in the changes. In general, load is recommended over require for COSMOS scripting. One gotcha with load is that it requires the full filename including extension, while the require keyword does not.

    + +

    In Python, libraries are included using the import syntax. Any code imported using import is not instrumented. Only the code imported using require_utility is instrumented.

    Finally, COSMOS scripting has a special syntax for disabling instrumentation in the middle of an instrumented script, with the disable_instrumentation method. This allows you to disable instrumentation for large loops and other activities that are too slow when running instrumented.

    -
    disable_instrumentation do
    +

    Ruby:

    + +
    temp = 0
    +disable_instrumentation do
       # Make sure nothing in here will raise exceptions!
       5000000.times do
         temp += 1
       end
     end
    +puts temp
    +
    + +

    Python:

    + +
    temp = 0
    +with disable_instrumentation():
    +    # Make sure nothing in here will raise exceptions!
    +    for x in range(0,5000000):
    +        temp += 1
    +print(temp)
     
    @@ -448,6 +674,8 @@

    COSMOS provides several different methods to gather manual user input in scripts. When using user input methods that allow for arbitrary values (like ask() and ask_string()), it is very important to validate the value given in your script before moving on. When asking for text input, it is extra important to handle different casing possibilities and to ensure that invalid input will either re-prompt the user or take a safe path.

    +

    Ruby:

    +
    answer = ask_string("Do you want to continue (y/n)?")
     if answer != 'y' and answer != 'Y'
       raise "User entered: #{answer}"
    @@ -459,6 +687,17 @@ 

    end

    +

    Python:

    + +
    answer = ask_string("Do you want to continue (y/n)?")
    +if answer != 'y' and answer != 'Y':
    +    raise RuntimeError(f"User entered: {answer}")
    +
    +temp = 0.0
    +while temp < 10.0 or temp > 50.0:
    +    temp = ask("Enter the desired temperature between 10.0 and 50.0")
    +
    +

    When possible, always use one of the other user input methods that has a constrained list of choices for your users (message_box, vertical_message_box, combo_box).

    Note that all these user input methods provide the user the option to “Cancel”. When cancel is clicked, the script is paused but remains at the user input line. When hitting “Go” to the continue, the user will be re-prompted to enter the value.

    @@ -468,6 +707,8 @@

    When possible, a useful design pattern is to write your scripts such that they can run without prompting for any user input. This allows the scripts to be more easily tested and provides a documented default value for any user input choices or values. To implement this pattern, all manual steps such as ask(), prompt(), and infinite wait() statements need to be wrapped with an if statement that checks the value of the $manual variable. If $manual is set, then the manual steps should be executed. If not, then a default value should be used.

    +

    Ruby Only:

    +
    # Set the $manual variable – Only needed outside of suites
     answer = ask("Prompt for manual entry (Y/n)?")
     if answer == 'n' or answer == 'N'
    @@ -492,11 +733,13 @@ 

    Outputing Extra Information to a Report

    -

    COSMOS Script Runner operating on a script suite automatically generates a report that shows the PASS/FAILED/SKIPPED state for each script. You can also inject arbitrary text into this report with using OpenC3::Group.puts “Your Text”. Alternatively, you can simply use puts to place text into the Script Runner message log.

    +

    COSMOS Script Runner operating on a script suite automatically generates a report that shows the PASS/FAILED/SKIPPED state for each script. You can also inject arbitrary text into this report using the example as follows. Alternatively, you can simply use print text into the Script Runner message log.

    + +

    Ruby:

    class MyGroup < OpenC3::Group
       def script_1
    -    # The following text will be placed in the  report
    +    # The following text will be placed in the report
         OpenC3::Group.puts "Verifies requirements 304, 306, 310"
         # This puts line will show up in the sr_messages log file
         puts "script_1 complete"
    @@ -504,6 +747,17 @@ 

    end

    +

    Python:

    + +
    from openc3.script.suite import Group
    +class MyGroup(Group):
    +    def script_1():
    +        # The following text will be placed in the report
    +        Group.print("Verifies requirements 304, 306, 310")
    +        # This puts line will show up in the sr_messages log file
    +        print("script_1 complete")
    +
    +

    Getting the Most Recent Value of a Telemetry Point from Multiple Packets

    @@ -522,6 +776,8 @@

    When writing COSMOS scripts, checking the most recent value of a telemetry point normally gets the job done. The tlm(), tlm_raw(), etc methods all retrieve the most recent value of a telemetry point. Sometimes you need to perform analysis on every single sample of a telemetry point. This can be done using the COSMOS packet subscription system. The packet subscription system lets you choose one or more packets and receive them all from a queue. You can then pick out the specific telemetry points you care about from each packet.

    +

    Ruby:

    +
    id = subscribe_packets([['INST', 'HEALTH_STATUS'], ['INST', 'ADCS']])
     wait 1.5
     id, packets = get_packet(id)
    @@ -532,23 +788,45 @@ 

    id, packets = get_packet(id)

    +

    Python:

    + +
    id = subscribe_packets([['INST', 'HEALTH_STATUS'], ['INST', 'ADCS']])
    +wait(1.5)
    +id, packets = get_packet(id)
    +for packet in packets:
    +    print(f"{packet['PACKET_TIMESECONDS']}: {packet['target_name']} {packet['packet_name']}")
    +# Wait for some time later and re-use the last returned ID
    +id, packets = get_packet(id)
    +
    +

    Using Variables in Mnemonics

    Because command and telemetry mnemonics are just strings in COSMOS scripts, you can make use of variables in some contexts to make reusable code. For example, a method can take a target name as an input to support multiple instances of a target. You could also pass in the value for a set of numbered telemetry points.

    +

    Ruby:

    +
    def example(target_name, temp_number)
       cmd("#{target_name} COLLECT with TYPE NORMAL")
       wait_check("#{target_name} TEMP#{temp_number} > 50.0")
     end
     
    +

    Python:

    + +
    def example(target_name, temp_number):
    +    cmd(f"{target_name} COLLECT with TYPE NORMAL")
    +    wait_check(f"{target_name} TEMP{temp_number} > 50.0")
    +
    +

    This can also be useful when looping through a numbered set of telemetry points but be considerate of the downsides of looping as discussed in the Looping vs Unrolled Loops section.

    Using Custom wait_check_expression

    -

    The COSMOS wait_check_expression (and check_expression) allow you to perform more complicated checks and still stop the script with a CHECK error message if something goes wrong. For example, you can check variables against each other or check a telemetry point against a range. The exact string of text passed to wait_check_expression is repeatedly evaled in Ruby until it passes, or a timeout occurs. It is important to not use Ruby string interpolation #{} within the actual expression or the values inside of the Ruby interpolation syntax #{} will only be evaluated once when it is converted into a string. PROTIP: Using #{} inside a comment inside the expression can give more insight if the expression fails, but be careful as it will show the first evaluation of the values when the check passes which can be confusing if they go from failing to passing after waiting a few seconds.

    +

    The COSMOS wait_check_expression (and check_expression) allow you to perform more complicated checks and still stop the script with a CHECK error message if something goes wrong. For example, you can check variables against each other or check a telemetry point against a range. The exact string of text passed to wait_check_expression is repeatedly evaluated until it passes, or a timeout occurs. It is important to not use string interpolation within the actual expression or the values inside of the string interpolation syntax will only be evaluated once when it is converted into a string.

    + +

    Ruby:

    one = 1
     two = 2
    @@ -556,14 +834,22 @@ 

    wait_check_expression("one == two", 1) # ERROR: CHECK: one == two is FALSE after waiting 1.017035 seconds -# With PROTIP to see the values at the first evaluation of the expression -wait_check_expression("one == two # #{one} == #{two}", 1) -# ERROR: CHECK: one == two # 1 == 2 is FALSE after waiting 1.015817 seconds - # Checking an integer range wait_check_expression("one > 0 and one < 10 # init value one = #{one}", 1)

    +

    Python:

    + +
    one = 1
    +two = 2
    +
    +wait_check_expression("one == two", 1, 0.25, locals())
    +# ERROR: CHECK: one == two is FALSE after waiting 1.017035 seconds
    +
    +# Checking an integer range
    +wait_check_expression("one > 0 and one < 10", 1, 0.25, locals())
    +
    +

    COSMOS Scripting Differences from Regular Ruby Scripting

    @@ -664,8 +950,8 @@

    puts ss[0][0][0]

    -

    -When to use Modules

    +

    +When to use Ruby Modules

    Modules in Ruby have two purposes: namespacing and mixins. Namespacing allows having classes and methods with the same name, but with different meanings. For example, if they are namespaced, COSMOS can have a Packet class and another Ruby library can have a Packet class. This isn’t typically useful for COSMOS scripting though.

    @@ -683,11 +969,6 @@

    end

    -

    -Further Reading

    - -

    Please see the Scripting Guide for the full list of available scripting methods provided by COSMOS.

    -
    @@ -2676,11 +2957,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2764,13 +3047,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/scripting.html b/_site/docs/v5/scripting-api.html similarity index 73% rename from _site/docs/v5/scripting.html rename to _site/docs/v5/scripting-api.html index db7e5c1..a9c1187 100644 --- a/_site/docs/v5/scripting.html +++ b/_site/docs/v5/scripting-api.html @@ -2,7 +2,7 @@ - Scripting Guide + Scripting API Guide @@ -106,32 +106,14 @@

  • Handling Telemetry
  • -

    Scripting Guide

    +

    Scripting API Guide

    This document provides the information necessary to write test procedures using the COSMOS scripting API. Scripting in COSMOS is designed to be simple and intuitive. The code completion ability for command and telemetry mnemonics makes Script Runner the ideal place to write your procedures, however any text editor will do. If there is functionality that you don’t see here or perhaps an easier syntax for doing something, please submit a ticket.

    Concepts

    -

    -Ruby Programming Language

    - -

    COSMOS scripting is implemented using the Ruby Programming language. This should be largely transparent to the user, but if advanced processing needs to be done such as writing files, then knowledge of Ruby is necessary. Please see the Ruby Guide for more information about Ruby.

    - -

    A basic summary of Ruby:

    - -
      -
    1. There is no 80 character limit on line length. Lines can be as long as you like, but be careful to not make them too long as it makes printed reviews of scripts more difficult.
    2. -
    3. Variables do not have to be declared ahead of time and can be reassigned later, i.e. Ruby is dynamically typed.
    4. -
    5. Variable values can be placed into strings using the “#{variable}” syntax. This is called variable interpolation.
    6. -
    7. A variable declared inside of a block or loop will not exist outside of that block unless it was already declared (see Ruby’s variable scoping for more information).
    8. -
    +

    +Programming Languages

    -

    The Ruby programming language provides a script writer a lot of power. But with great power comes great responsibility. Remember when writing your scripts that you or someone else will come along later and need to understand them. Therefore use the following style guidelines:

    +

    COSMOS scripting is implemented using either Ruby or Python. Ruby and Python are very similar scripting languages and in many cases the COSMOS APIs are identical between the two. This guide is written to support both with additional language specific information found in the Script Writing Guide.

    -
      -
    • Use two spaces for indentation and do NOT use tabs
    • -
    • Constants should be all caps with underscores -
        -
      • SPEED_OF_LIGHT = 299792458 # meters per s
      • -
      -
    • -
    • Variable names and method names should be in lowercase with underscores -
        -
      • last_name = "Smith"
      • -
      • perform_setup_operation()
      • -
      -
    • -
    • Class names (when used) should be camel case and the files which contain them should match but be lowercase with underscores -
        -
      • class DataUploader # in 'data_uploader.rb'
      • -
      • class CcsdsUtility # in 'ccsds_utility.rb'
      • -
      -
    • -
    • Don’t add useless comments but instead describe intent
    • -
    - -
    - -

    The following is an example of good style:

    - -
    load 'TARGET/lib/upload_utility.rb' # library we do NOT want to show executing
    -load_utility 'TARGET/lib/helper_utility.rb' # library we do want to show executing
    -
    -# Declare constants
    -OUR_TARGETS = ['INST','INST2']
    -
    -# Clear the collect counter of the passed in target name
    -def clear_collects(target)
    -  cmd("#{target} CLEAR")
    -  wait_check("#{target} HEALTH_STATUS COLLECTS == 0", 5)
    -end
    -
    -######################################
    -# START
    -######################################
    -helper = HelperUtility.new
    -helper.setup
    -
    -# Perform collects on all the targets
    -OUR_TARGETS.each do |target|
    -  collects = tlm("#{target} HEALTH_STATUS COLLECTS")
    -  cmd("#{target} COLLECT with TYPE SPECIAL")
    -  wait_check("#{target} HEALTH_STATUS COLLECTS == #{collects + 1}", 5)
    -end
    -
    -clear_collects('INST')
    -clear_collects('INST2')
    -
    - -

    This example shows several features of COSMOS scripting in action. Notice the difference between ‘load’ and ‘load_utility’. The first is to load additional scripts which will NOT be shown in Script Runner when executing. This is a good place to put code which takes a long time to run such as image analysis or other looping code where you just want the output. ‘load_utility’ will visually execute the code line by line to show the user what is happening.

    - -

    Next we declare our constants and create an array of strings which we store in OUR_TARGETS. Notice the constant is all uppercase with underscores.

    +

    +Using Script Runner

    -

    Then we declare our local methods of which we have one called clear_collects. Please provide a comment at the beginning of each method describing what it does and the parameters that it takes.

    +

    Script Runner is a graphical application that provides the ideal environment for running and implementing your test procedures. The Script Runner tool is broken into 4 main sections. At the top of the tool is a menu bar that allows you to do such things as open and save files, perform a syntax check, and execute your script.

    -

    The ‘helper_utility’ is then created by HelperUtility.new. Note the similarity in the class name and the file name we loaded.

    +

    Next is a tool bar that displays the currently executing script and three buttons, “Start/Go”, “Pause/Retry”, and “Stop”. The Start/Go button is used to start the script and continue past errors or waits. The Pause/Retry button will pause the executing script. If an error is encountered the Pause button changes to Retry to re-execute the errored line. Finally, the Stop button will stop the executing script at any time.

    -

    The collect example shows how you can iterate over the array of strings we previously created and use variables when commanding and checking telemetry. The pound bracket #{} notation puts whatever the variable holds inside the #{} into the string. You can even execute additional code inside the #{} like we do when checking for the collect count to increment.

    +

    Third is the display of the actual script. While the script is not running, you may edit and compose scripts in this area. A handy code completion feature is provided that will list out the available commands or telemetry points as you are writing your script. Simply begin writing a cmd( or tlm( line to bring up code completion. This feature greatly reduces typos in command and telemetry mnemonics.

    -

    Finally we call our clear_collects method on each target by passing the target name. You’ll notice there we used single quotes instead of double quotes. The only difference is that double quotes allow for the #{} syntax and support escape characters like newlines (\n) while single quotes do not. Otherwise it’s just a personal style preference.

    +

    Finally, the bottom of the display is the log messages. All commands that are sent, errors that occur, and user print statements appear in this area.

    Telemetry Types

    @@ -435,168 +334,18 @@

    -

    -Writing Test Procedures

    - -

    -Using Subroutines

    - -

    Subroutines in COSMOS scripting are first class citizens. They can allow you to perform repetitive tasks without copying the same code multiple times and in multiple different test procedures. This reduces errors and makes your test procedures more maintainable. For example, if multiple test procedures need to turn on a power supply and check telemetry, they can both use a common subroutine. If a change needs to be made to how the power supply is turned on, then it only has to be done in one location and all test procedures reap the benefits. No need to worry about forgetting to update one. Additionally using subroutines allows your high level procedure to read very cleanly and makes it easier for others to review. See the Subroutine Example example.

    - -

    -Example Test Procedures

    - -

    -Subroutines

    - -
    # My Utility Procedure: program_utilities.rb
    -# Author: Bob
    -
    -#################################################################
    -# Define helpful subroutines useful by multiple test procedures
    -#################################################################
    -
    -# This subroutine will put the instrument into safe mode
    -def goto_safe_mode
    -  cmd("INST SAFE")
    -  wait_check("INST SOH MODE == 'SAFE'", 30)
    -  check("INST SOH VOLTS1 < 1.0")
    -  check("INST SOH TEMP1 > 20.0")
    -  puts("The instrument is in SAFE mode")
    -end
    -
    -# This subroutine will put the instrument into run mode
    -def goto_run_mode
    -  cmd("INST RUN")
    -  wait_check("INST SOH MODE == 'RUN'", 30)
    -  check("INST SOH VOLTS1 > 27.0")
    -  check("INST SOH TEMP1 > 20.0")
    -  puts("The instrument is in RUN mode")
    -end
    -
    -# This subroutine will turn on the power supply
    -def turn_on_power
    -  cmd("GSE POWERON")
    -  wait_check("GSE SOH VOLTAGE > 27.0")
    -  check("GSE SOH CURRENT < 2.0")
    -  puts("WARNING: Power supply is ON!")
    -end
    -
    -# This subroutine will turn off the power supply
    -def turn_off_power
    -  cmd("GSE POWEROFF")
    -  wait_check("GSE SOH VOLTAGE < 1.0")
    -  check("GSE SOH CURRENT < 0.1")
    -  puts("Power supply is OFF")
    -end
    -
    +

    +Script Runner API

    -
    # My Test Procedure: run_instrument.rb
    -# Author: Larry
    +

    The following methods are designed to be used in Script Runner procedures. Many can also be used in custom built COSMOS tools. Please see the COSMOS Tool API section for methods that are more efficient to use in custom tools.

    -load_utility("TARGET/lib/program_utilities.rb") - -turn_on_power() -goto_run_mode() - -# Perform unique tests here - -goto_safe_mode() -turn_off_power() -
    - -

    -Ruby Control Structures

    - -
    #if, elsif, else structure
    -
    -x = 3
    -
    -if tlm("INST HEALTH_STATUS COLLECTS") > 5
    -  puts "More than 5 collects!"
    -elsif (x == 4)
    -  puts "variable equals 4!"
    -else
    -  puts "Nothing interesting going on"
    -end
    -
    -# Endless loop and single-line if
    -
    -loop do
    -  break if tlm("INST HEALTH_STATUS TEMP1") > 25.0
    -  wait(1)
    -end
    +
    +
    +Python Import Script API
    +

    All Python examples assume you first import the openc3.script APIs by doing:

    -# Do something a given number of times - -5.times do - cmd("INST COLLECT") -end -
    - -

    -Iterating over similarly named telemetry points

    - -
    # This block of code goes through the range of numbers 1 through 4 (1..4)
    -# and checks telemetry items TEMP1, TEMP2, TEMP3, and TEMP4
    -
    -(1..4).each do |num|
    -  check("INST HEALTH_STATUS TEMP#{num} > 25.0")
    -end
    -
    -# You could also do
    -num = 1
    -4.times do
    -  check("INST HEALTH_STATUS TEMP#{num} > 25.0")
    -  num = num + 1
    -end
    -
    - -

    -Prompting for User Input

    - -
    numloops = ask("Please enter the number of times to loop")
    -
    -numloops.times do
    -  puts "Looping"
    -end
    -
    - -

    -Skipping a test case in TestRunner

    - -
    def test_feature_x
    -  continue = ask("Test feature x?")
    -
    -  if continue == 'y'
    -    # Test goes here
    -  else
    -    raise SkipTestCase, "Skipping feature x test"
    -  end
    -end
    -
    - -

    -Running Test Procedures

    - -

    -Execution Environment

    - -

    -Using Script Runner

    - -

    Script Runner is a graphical application that provides the ideal environment for running and implementing your test procedures. The Script Runner tool is broken into 4 main sections. At the top of the tool is a menu bar that allows you to do such things as open and save files, perform a syntax check, and execute your script.

    - -

    Next is a tool bar that displays the currently executing script and three buttons, “Start/Go”, “Pause/Retry”, and “Stop”. The Start/Go button is used to start the script and continue past errors or waits. The Pause/Retry button will pause the executing script. If an error is encountered the Pause button changes to Retry to re-execute the errored line. Finally, the Stop button will stop the executing script at any time.

    - -

    Third is the display of the actual script. While the script is not running, you may edit and compose scripts in this area. A handy code completion feature is provided that will list out the available commands or telemetry points as you are writing your script. Simply begin writing a cmd( or tlm( line to bring up code completion. This feature greatly reduces typos in command and telemetry mnemonics.

    - -

    Finally, displayed is the log messages. All commands that are sent, errors that occur, and user puts statements appear in this area.

    - -

    -Test Procedure API

    - -

    The following methods are designed to be used in test procedures. However, they can also be used in custom built COSMOS tools. Please see the COSMOS Tool API section for methods that are more efficient to use in custom tools.

    +

    from openc3.script import *

    +

    Migration from COSMOS v4

    @@ -612,60 +361,40 @@

    - - check_raw - Script Runner - Deprecated, use check(…, type: :RAW) - - - check_formatted - Script Runner - Deprecated, use check(…, type: :FORMATTED) - - - check_with_units - Script Runner - Deprecated, use check(…, type: :WITH_UNITS) - - - check_tolerance_raw - Script Runner - Deprecated, use check_tolerance(…, type: :RAW) - clear Telemetry Viewer - Unimplemented + Deprecated, use clear_screen clear_all Telemetry Viewer - Unimplemented - - - clear_disconnected_targets - Script Runner - Unimplemented + Deprecated, use clear_all_screens close_local_screens Telemetry Viewer - Unimplemented + Deprecated, use clear_screen + + + clear_disconnected_targets + Script Runner + Deprecated cmd_tlm_clear_counters Command and Telemetry Server - Unimplemented + Deprecated cmd_tlm_reload Command and Telemetry Server - Unimplemented + Deprecated display Telemetry Viewer - Unimplemented + Deprecated, use display_screen get_all_packet_logger_info @@ -682,6 +411,16 @@

    Command and Telemetry Server Deprecated + + get_all_cmd_info + Command and Telemetry Server + Deprecated, use get_all_commands + + + get_all_tlm_info + Command and Telemetry Server + Deprecated, use get_all_telemetry + get_cmd_list Command and Telemetry Server @@ -752,16 +491,6 @@

    Command and Telemetry Server Deprecated, use get_router - - get_screen_definition - Telemetry Viewer - Unimplemented - - - get_screen_list - Telemetry Viewer - Unimplemented - get_scriptrunner_message_log_filename Command and Telemetry Server @@ -780,7 +509,12 @@

    get_server_status Command and Telemetry Server - Unimplemented + Deprecated + + + get_stale + Command and Telemetry Server + Deprecated get_target_ignored_items @@ -797,6 +531,11 @@

    Command and Telemetry Server Deprecated, use get_target + + get_target_list + Command and Telemetry Server + Deprecated, use get_target_names + get_tlm_details Command and Telemetry Server @@ -822,11 +561,6 @@

    Command and Telemetry Server Deprecated, use get_interface - - local_screen - Script Runner - Unimplemented - override_tlm_raw Command and Telemetry Server @@ -892,16 +626,16 @@

    Replay Deprecated + + require_utility + Script Runner + Deprecated but still exists for backwards compatibility, use load_utility + router_state Command and Telemetry Server Deprecated, use get_router - - run_mode - Script Runner - Unimplemented - save_file_dialog Script Runner @@ -925,7 +659,7 @@

    set_stdout_max_lines Script Runner - Unimplemented + Deprecated set_tlm_raw @@ -967,11 +701,6 @@

    Command and Telemetry Server Deprecated - - step_mode - Script Runner - Unimplemented - stop_background_task Command and Telemetry Server @@ -995,7 +724,7 @@

    subscribe_limits_events Command and Telemetry Server - Unimplemented + Deprecated subscribe_packet_data @@ -1007,25 +736,10 @@

    Command and Telemetry Server Unimplemented - - tlm_raw - Script Runner - Deprecated, use tlm(…, type: :RAW) - - - tlm_formatted - Script Runner - Deprecated, use tlm(…, type: :FORMATTED) - - - tlm_with_units - Script Runner - Deprecated, use tlm(…, type: :WITH_UNITS) - tlm_variable Script Runner - Deprecated, use tlm() and pass type:) + Deprecated, use tlm() and pass type unsubscribe_limits_events @@ -1065,115 +779,6 @@

    -

    The following API methods are new in COSMOS 5:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodTool
    get_all_commandsCommand and Telemetry Server
    get_all_telemetryCommand and Telemetry Server
    get_commandCommand and Telemetry Server
    get_interfaceCommand and Telemetry Server
    get_itemCommand and Telemetry Server
    get_packetsCommand and Telemetry Server
    get_routerCommand and Telemetry Server
    get_settingCommand and Telemetry Server
    get_settingsCommand and Telemetry Server
    get_targetCommand and Telemetry Server
    get_target_fileScript Runner
    put_target_fileScript Runner
    delete_target_fileScript Runner
    get_telemetryCommand and Telemetry Server
    metadata_allScript Runner
    metadata_getScript Runner
    metadata_setScript Runner
    metadata_updateScript Runner
    metadata_inputScript Runner
    list_configsVarious
    list_settingsCommand and Telemetry Server
    load_configVarious
    save_settingCommand and Telemetry Server
    subscribe_packetsCommand and Telemetry Server
    -

    Retrieving User Input

    @@ -1184,9 +789,9 @@

    Prompts the user for input with a question. User input is automatically converted from a string to the appropriate data type. For example if the user enters “1”, the number 1 as an integer will be returned.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    ask("<question>")
    +
    ask("<question>", <blank_or_default>, <password>)
     
    @@ -1207,12 +812,12 @@

    - +
    passwordWhether to treat the entry as a password which is displayed with dots and not logged.Whether to treat the entry as a password which is displayed with dots and not logged. Default is false.
    -

    Example:

    +

    Ruby Example:

    value = ask("Enter an integer")
     value = ask("Enter a value or nothing", true)
    @@ -1220,14 +825,22 @@ 

    password = ask("Enter your password", false, true)

    +

    Python Example:

    + +
    value = ask("Enter an integer")
    +value = ask("Enter a value or nothing", True)
    +value = ask("Enter a value", 10)
    +password = ask("Enter your password", False, True)
    +
    +

    ask_string

    Prompts the user for input with a question. User input is always returned as a string. For exampe if the user enters “1”, the string “1” will be returned.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    ask_string("<question>")
    +
    ask_string("<question>", <blank_or_default>, <password>)
     
    @@ -1248,12 +861,12 @@

    - +
    passwordWhether to treat the entry as a password which is displayed with dots and not logged.Whether to treat the entry as a password which is displayed with dots and not logged. Default is false.
    -

    Example:

    +

    Ruby Example:

    string = ask_string("Enter a String")
     string = ask_string("Enter a value or nothing", true)
    @@ -1261,6 +874,14 @@ 

    password = ask_string("Enter your password", false, true)

    +

    Python Example:

    + +
    string = ask_string("Enter a String")
    +string = ask_string("Enter a value or nothing", True)
    +string = ask_string("Enter a value", "test")
    +password = ask_string("Enter your password", False, True)
    +
    +

    message_box

    @@ -1272,7 +893,7 @@

    The message_box, vertical_message_box, and combo_box methods create a message box with arbitrary buttons or selections that the user can click. The text of the button clicked is returned.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    message_box("<message>", "<button text 1>", ...)
     vertical_message_box("<message>", "<button text 1>", ...)
    @@ -1298,7 +919,7 @@ 

    -

    Example:

    +

    Ruby Example:

    value = message_box("Select the sensor number", 'One', 'Two')
     value = vertical_message_box("Select the sensor number", 'One', 'Two')
    @@ -1311,16 +932,33 @@ 

    end

    +

    Python Example:

    + +
    value = message_box("Select the sensor number", 'One', 'Two')
    +value = vertical_message_box("Select the sensor number", 'One', 'Two')
    +value = combo_box("Select the sensor number", 'One', 'Two')
    +match value:
    +    case 'One':
    +        print('Sensor One')
    +    case 'Two':
    +        print('Sensor Two')
    +
    +

    get_target_file

    Return a file handle to a file in the target directory

    -

    Syntax:

    +

    Ruby Syntax:

    get_target_file("<File Path>", original: false)
     
    +

    Python Syntax:

    + +
    get_target_file("<File Path>", original=False)
    +
    + @@ -1335,12 +973,12 @@

    - +
    originalWhether to get the original file from the plug-in, or any modifications to the fileWhether to get the original file from the plug-in, or any modifications to the file. Default is false which means to grab the modified file. If the modified file does not exist the API will automatically try to pull the original.
    -

    Example:

    +

    Ruby Example:

    file = get_target_file("INST/data/attitude.bin")
     puts file.read().formatted # format a binary file
    @@ -1350,12 +988,24 @@ 

    file.unlink # delete file

    +

    Python Example:

    + +
    from openc3.utilities.string import formatted
    +
    +file = get_target_file("INST/data/attitude.bin")
    +print(formatted(file.read())) # format a binary file
    +file.close() # delete file
    +file = get_target_file("INST/procedures/checks.rb", original=True)
    +print(file.read())
    +file.close() # delete file
    +
    +

    put_target_file

    Writes a file to the target directory

    -

    Syntax:

    +

    Ruby or Python Syntax:

    put_target_file("<File Path>", "IO or String")
     
    @@ -1379,7 +1029,7 @@

    -

    Example:

    +

    Ruby Example:

    put_target_file("INST/test1.txt", "this is a string test")
     file = Tempfile.new('test')
    @@ -1389,12 +1039,22 @@ 

    put_target_file("INST/test3.bin", "\x00\x01\x02\x03\xFF\xEE\xDD\xCC") # binary

    +

    Python Example:

    + +
    put_target_file("INST/test1.txt", "this is a string test")
    +file = tempfile.NamedTemporaryFile(mode="w+t")
    +file.write("this is a Io test")
    +file.seek(0)
    +put_target_file("INST/test2.txt", file)
    +put_target_file("INST/test3.bin", b"\x00\x01\x02\x03\xFF\xEE\xDD\xCC") # binary
    +
    +

    delete_target_file

    Delete a file in the target directory

    -

    Syntax:

    +

    Ruby / Python Syntax:

    delete_target_file("<File Path>")
     
    @@ -1414,7 +1074,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    put_target_file("INST/delete_me.txt", "to be deleted")
     delete_target_file("INST/delete_me.txt")
    @@ -1430,12 +1090,18 @@ 

    Note: COSMOS 5 has deprecated the save_file_dialog and open_directory_dialog methods. save_file_dialog can be replaced by put_target_file if you want to write a file back to the target. open_directory_dialog doesn’t make sense in new architecture so you must request individual files.

    -

    Syntax:

    +

    Ruby Syntax:

    open_file_dialog("<title>", "<message>", filter: "<filter>")
     open_files_dialog("<title>", "<message>", filter: "<filter>")
     
    +

    Python Syntax:

    + +
    open_file_dialog("<title>", "<message>", filter="<filter>")
    +open_files_dialog("<title>", "<message>", filter="<filter>")
    +
    + @@ -1453,13 +1119,13 @@

    - +
    The message to display in the dialog box. Optional parameter.
    Filterfilter Named parameter to filter allowed file types. Optional parameter, specified as comma delimited file types, e.g. “.txt,.doc”. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept for more information.
    -

    Example:

    +

    Ruby Example:

    file = open_file_dialog("Open a single file", "Choose something interesting", filter: ".txt")
     puts file # Ruby File object
    @@ -1475,6 +1141,21 @@ 

    end

    +

    Python Example:

    + +
    file = open_file_dialog("Open a single file", "Choose something interesting", filter=".txt")
    +print(file)
    +print(file.read())
    +file.close()
    +
    +files = open_files_dialog("Open multiple files") # message is optional
    +print(files) # Array of File objects (even if you select only one)
    +for file in files:
    +    print(file)
    +    print(file.read())
    +    file.close()
    +
    +

    Providing information to the user

    @@ -1485,7 +1166,7 @@

    Displays a message to the user and waits for them to press an ok button.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    prompt("<message>")
     
    @@ -1505,7 +1186,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    prompt("Press OK to continue")
     
    @@ -1520,12 +1201,18 @@

    Sends a specified command.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd("<Target Name>", "<Command Name>", "Param #1 Name" => <Param #1 Value>, "Param #2 Name" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd("<Target Name>", "<Command Name>", {"Param #1 Name": <Param #1 Value>, "Param #2 Name": <Param #2 Value>, ...})
    +
    + @@ -1553,10 +1240,18 @@

    -

    Example:

    +

    Ruby Example:

    cmd("INST COLLECT with DURATION 10, TYPE NORMAL")
    +# In Ruby the brackets around parameters are optional
     cmd("INST", "COLLECT", "DURATION" => 10, "TYPE" => "NORMAL")
    +cmd("INST", "COLLECT", { "DURATION" => 10, "TYPE" => "NORMAL" })
    +
    + +

    Python Example:

    + +
    cmd("INST COLLECT with DURATION 10, TYPE NORMAL")
    +cmd("INST", "COLLECT", { "DURATION": 10, "TYPE": "NORMAL" })
     

    @@ -1564,12 +1259,18 @@

    Sends a specified command without performing range checking on its parameters. This should only be used when it is necessary to intentionally send a bad command parameter to test a target.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_no_range_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_no_range_check("<Target Name>", "<Command Name>", "Param #1 Name" => <Param #1 Value>, "Param #2 Name" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_no_range_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_no_range_check("<Target Name>", "<Command Name>", {"Param #1 Name": <Param #1 Value>, "Param #2 Name": <Param #2 Value>, ...})
    +
    + @@ -1597,23 +1298,35 @@

    -

    Example:

    +

    Ruby Example:

    cmd_no_range_check("INST COLLECT with DURATION 11, TYPE NORMAL")
     cmd_no_range_check("INST", "COLLECT", "DURATION" => 11, "TYPE" => "NORMAL")
     
    +

    Python Example:

    + +
    cmd_no_range_check("INST COLLECT with DURATION 11, TYPE NORMAL")
    +cmd_no_range_check("INST", "COLLECT", {"DURATION": 11, "TYPE": "NORMAL"})
    +
    +

    cmd_no_hazardous_check

    Sends a specified command without performing the notification if it is a hazardous command. This should only be used when it is necessary to fully automate testing involving hazardous commands.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_no_hazardous_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_no_hazardous_check("<Target Name>", "<Command Name>", "Param #1 Name" => <Param #1 Value>, "Param #2 Name" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_no_hazardous_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_no_hazardous_check("<Target Name>", "<Command Name>", {"Param #1 Name": <Param #1 Value>, "Param #2 Name": <Param #2 Value>, ...})
    +
    + @@ -1641,7 +1354,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    cmd_no_hazardous_check("INST CLEAR")
     cmd_no_hazardous_check("INST", "CLEAR")
    @@ -1652,12 +1365,18 @@ 

    Sends a specified command without performing the parameter range checks or notification if it is a hazardous command. This should only be used when it is necessary to fully automate testing involving hazardous commands that intentially have invalid parameters.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_no_checks("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_no_checks("<Target Name>", "<Command Name>", "Param #1 Name" => <Param #1 Value>, "Param #2 Name" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_no_checks("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_no_checks("<Target Name>", "<Command Name>", {"Param #1 Name": <Param #1 Value>, "Param #2 Name": <Param #2 Value>, ...})
    +
    + @@ -1685,23 +1404,35 @@

    -

    Example:

    +

    Ruby Example:

    cmd_no_checks("INST COLLECT with DURATION 11, TYPE SPECIAL")
     cmd_no_checks("INST", "COLLECT", "DURATION" => 11, "TYPE" => "SPECIAL")
     
    +

    Python Example:

    + +
    cmd_no_checks("INST COLLECT with DURATION 11, TYPE SPECIAL")
    +cmd_no_checks("INST", "COLLECT", {"DURATION": 11, "TYPE": "SPECIAL"})
    +
    +

    cmd_raw

    Sends a specified command without running conversions.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_raw("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_raw("<Target Name>", "<Command Name>", "<Param #1 Name>" => <Param #1 Value>, "<Param #2 Name>" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_raw("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_raw("<Target Name>", "<Command Name>", {"<Param #1 Name>": <Param #1 Value>, "<Param #2 Name>": <Param #2 Value>, ...})
    +
    + @@ -1729,10 +1460,16 @@

    -

    Example:

    +

    Ruby Example:

    cmd_raw("INST COLLECT with DURATION 10, TYPE 0")
    -cmd_raw("INST", "COLLECT", "DURATION" => 10, TYPE => 0)
    +cmd_raw("INST", "COLLECT", "DURATION" => 10, "TYPE" => 0)
    +
    + +

    Python Example:

    + +
    cmd_raw("INST COLLECT with DURATION 10, TYPE 0")
    +cmd_raw("INST", "COLLECT", {"DURATION": 10, "TYPE": 0})
     

    @@ -1740,12 +1477,18 @@

    Sends a specified command without running conversions or performing range checking on its parameters. This should only be used when it is necessary to intentionally send a bad command parameter to test a target.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_raw_no_range_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_raw_no_range_check("<Target Name>", "<Command Name>", "<Param #1 Name>" => <Param #1 Value>, "<Param #2 Name>" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_raw_no_range_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_raw_no_range_check("<Target Name>", "<Command Name>", {"<Param #1 Name>": <Param #1 Value>, "<Param #2 Name>": <Param #2 Value>, ...})
    +
    + @@ -1773,23 +1516,35 @@

    -

    Example:

    +

    Ruby Example:

    cmd_raw_no_range_check("INST COLLECT with DURATION 11, TYPE 0")
     cmd_raw_no_range_check("INST", "COLLECT", "DURATION" => 11, "TYPE" => 0)
     
    +

    Python Example:

    + +
    cmd_raw_no_range_check("INST COLLECT with DURATION 11, TYPE 0")
    +cmd_raw_no_range_check("INST", "COLLECT", {"DURATION": 11, "TYPE": 0})
    +
    +

    cmd_raw_no_hazardous_check

    Sends a specified command without running conversions or performing the notification if it is a hazardous command. This should only be used when it is necessary to fully automate testing involving hazardous commands.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_raw_no_hazardous_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_raw_no_hazardous_check("<Target Name>", "<Command Name>", "<Param #1 Name>" => <Param #1 Value>, "<Param #2 Name>" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_raw_no_hazardous_check("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_raw_no_hazardous_check("<Target Name>", "<Command Name>", {"<Param #1 Name>": <Param #1 Value>, "<Param #2 Name>": <Param #2 Value>, ...})
    +
    + @@ -1817,7 +1572,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    cmd_raw_no_hazardous_check("INST CLEAR")
     cmd_raw_no_hazardous_check("INST", "CLEAR")
    @@ -1828,12 +1583,18 @@ 

    Sends a specified command without running conversions or performing the parameter range checks or notification if it is a hazardous command. This should only be used when it is necessary to fully automate testing involving hazardous commands that intentially have invalid parameters.

    -

    Syntax:

    +

    Ruby Syntax:

    cmd_raw_no_checks("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
     cmd_raw_no_checks("<Target Name>", "<Command Name>", "<Param #1 Name>" => <Param #1 Value>, "<Param #2 Name>" => <Param #2 Value>, ...)
     
    +

    Python Syntax:

    + +
    cmd_raw_no_checks("<Target Name> <Command Name> with <Param #1 Name> <Param #1 Value>, <Param #2 Name> <Param #2 Value>, ...")
    +cmd_raw_no_checks("<Target Name>", "<Command Name>", {"<Param #1 Name>": <Param #1 Value>, "<Param #2 Name>": <Param #2 Value>, ...})
    +
    + @@ -1861,18 +1622,68 @@

    -

    Example:

    +

    Ruby Example:

    cmd_raw_no_checks("INST COLLECT with DURATION 11, TYPE 1")
     cmd_raw_no_checks("INST", "COLLECT", "DURATION" => 11, "TYPE" => 1)
     
    +

    Python Example:

    + +
    cmd_raw_no_checks("INST COLLECT with DURATION 11, TYPE 1")
    +cmd_raw_no_checks("INST", "COLLECT", {"DURATION": 11, "TYPE": 1})
    +
    + +

    +build_command (since 5.8.0)

    + +

    Builds a command binary string

    + +

    Ruby Syntax:

    + +
    build_command(<args>, range_check: true, raw: false)
    +
    + +

    Python Syntax:

    + +
    build_command(<args>, range_check=True, raw=False)
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    ParameterDescription
    argsCommand parameters (see cmd)
    range_checkWhether to perform range checking on the command. Default is true.
    rawWhether to write the command arguments as RAW or CONVERTED value. Default is CONVERTED.
    + +

    Ruby / Python Example:

    + +
    x = build_command("INST COLLECT with DURATION 10, TYPE NORMAL")
    +print(x)  #=> {"id"=>"1696437370872-0", "result"=>"SUCCESS", "time"=>"1696437370872305961", "received_time"=>"1696437370872305961", "target_name"=>"INST", "packet_name"=>"COLLECT", "received_count"=>"3", "buffer"=>"\x13\xE7\xC0\x00\x00\f\x00\x01\x00\x00A \x00\x00\xAB\x00\x00\x00\x00"}
    +
    +

    send_raw

    Sends raw data on an interface.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    send_raw(<Interface Name>, <data>)
     
    @@ -1896,7 +1707,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    send_raw("INST_INT", data)
     
    @@ -1906,7 +1717,7 @@

    Returns an array of the commands that are available for a particular target. The returned array is an array of hashes which fully describe the command packet.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_all_commands("<Target Name>")
     
    @@ -1926,10 +1737,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    cmd_list = get_all_commands("INST")
    -pp cmd_list
    +print(cmd_list)
     #[{"target_name"=>"INST",
     #  "packet_name"=>"ABORT",
     #  "endianness"=>"BIG_ENDIAN",
    @@ -1947,7 +1758,7 @@ 

    Returns a command hash which fully describes the command packet.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_command("<Target Name>", "<Packet Name>")
     
    @@ -1971,10 +1782,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    cmd = get_command("INST", "ABORT")
    -pp cmd
    +print(cmd)
     #[{"target_name"=>"INST",
     #  "packet_name"=>"ABORT",
     #  "endianness"=>"BIG_ENDIAN",
    @@ -1992,7 +1803,7 @@ 

    Returns a hash of the given command parameter

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_parameter("<Target Name>", "<Command Name>", "<Parameter Name>")
     
    @@ -2020,10 +1831,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    param = get_parameter("INST", "COLLECT", "TYPE")
    -pp param
    +print(param)
     # {"name"=>"TYPE",
     # "bit_offset"=>64,
     # "bit_size"=>16,
    @@ -2043,7 +1854,7 @@ 

    Returns a packet hash (similar to get_command) along with the raw packet buffer as a Ruby string.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    buffer = get_cmd_buffer("<Target Name>", "<Packet Name>")['buffer']
     
    @@ -2067,10 +1878,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    packet = get_cmd_buffer("INST", "COLLECT")
    -packet['buffer'].unpack('C*') # See the Ruby documentation for class String method unpack
    +print(packet['buffer'])
     

    @@ -2078,7 +1889,7 @@

    Returns true/false indicating whether a particular command is flagged as hazardous.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_cmd_hazardous("<Target Name>", "<Command Name>", <Command Params - optional>)
     
    @@ -2106,17 +1917,22 @@

    -

    Example:

    +

    Ruby Example:

    hazardous = get_cmd_hazardous("INST", "COLLECT", {'TYPE' => 'SPECIAL'})
     
    +

    Python Example:

    + +
    hazardous = get_cmd_hazardous("INST", "COLLECT", {'TYPE': 'SPECIAL'})
    +
    +

    get_cmd_value

    Returns reads a value from the most recently sent command packet. The pseudo-parameters ‘PACKET_TIMESECONDS’, ‘PACKET_TIMEFORMATTED’, ‘RECEIVED_COUNT’, ‘RECEIVED_TIMEFORMATTED’, and ‘RECEIVED_TIMESECONDS’ are also supported.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_cmd_value("<Target Name>", "<Command Name>", "<Parameter Name>", <Value Type - optional>)
     
    @@ -2143,14 +1959,19 @@

    Value Type - Value Type to read. :RAW, :CONVERTED, :FORMATTED, or :WITH_UNITS + Value Type to read. RAW, CONVERTED, FORMATTED, or WITH_UNITS. NOTE: Symbol in Ruby and str in Python -

    Example:

    +

    Ruby Example:

    + +
    value = get_cmd_value("INST", "COLLECT", "TEMP", :RAW)
    +
    -
    value = get_cmd_value("INST", "COLLECT", "TEMP")
    +

    Python Example:

    + +
    value = get_cmd_value("INST", "COLLECT", "TEMP", "RAW")
     

    @@ -2158,7 +1979,7 @@

    Returns the time of the most recent command sent.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_cmd_time("<Target Name - optional>", "<Command Name - optional>")
     
    @@ -2182,7 +2003,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    target_name, command_name, time = get_cmd_time() # Name of the most recent command sent to any target and time
     target_name, command_name, time = get_cmd_time("INST") # Name of the most recent command sent to the INST target and time
    @@ -2194,7 +2015,7 @@ 

    Returns the number of times a specified command has been sent.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_cmd_cnt("<Target Name>", "<Command Name>")
     
    @@ -2218,35 +2039,22 @@

    -

    Example:

    +

    Ruby / Python Example:

    cmd_cnt = get_cmd_cnt("INST", "COLLECT") # Number of times the INST COLLECT command has been sent
     
    -

    -get_all_cmd_info

    - -

    Returns the number of times each command has been sent. The return value is an array of arrays where each subarray contains the target name, command name, and packet count for a command.

    - -

    Syntax / Example:

    - -
    cmd_info = get_all_cmd_info()
    -cmd_info.each do |target_name, cmd_name, pkt_count|
    -  puts "Target: #{target_name}, Command: #{cmd_name}, Packet count: #{pkt_count}"
    -end
    -
    -

    Handling Telemetry

    These methods allow the user to interact with telemetry items.

    -

    -check

    +

    +check, check_raw, check_formatted, check_with_units

    -

    Performs a verification of a telemetry item using its converted telemetry type. If the verification fails then the script will be paused with an error. If no comparision is given to check then the telemetry item is simply printed to the script output. Note: In most cases using wait_check is a better choice than using check.

    +

    Performs a verification of a telemetry item using its specified telemetry type. If the verification fails then the script will be paused with an error. If no comparision is given to check then the telemetry item is simply printed to the script output. Note: In most cases using wait_check is a better choice than using check.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    check("<Target Name> <Packet Name> <Item Name> <Comparison - optional>")
     
    @@ -2278,39 +2086,24 @@

    -

    Example:

    +

    Ruby Example:

    check("INST HEALTH_STATUS COLLECTS > 1")
    +check_raw("INST HEALTH_STATUS COLLECTS > 1")
    +check_formatted("INST HEALTH_STATUS COLLECTS > 1")
    +check_with_units("INST HEALTH_STATUS COLLECTS > 1")
    +# Ruby passes type as symbol
    +check("INST HEALTH_STATUS COLLECTS > 1", type: :RAW)
     
    -

    -check_raw

    - -

    Deprecated: Use check with type: :RAW

    - -

    Example:

    - -
    check("INST HEALTH_STATUS COLLECTS > 1", type: :RAW)
    -
    - -

    -check_formatted

    - -

    Deprecated: Use check with type: :FORMATTED

    - -

    Example:

    - -
    check("INST HEALTH_STATUS COLLECTS == '1'", type: :FORMATTED)
    -
    - -

    -check_with_units

    - -

    Deprecated: Use check with type: :WITH_UNITS

    - -

    Example:

    +

    Python Example:

    -
    check("INST HEALTH_STATUS COLLECTS == '1'", type: :WITH_UNITS)
    +
    check("INST HEALTH_STATUS COLLECTS > 1")
    +check_raw("INST HEALTH_STATUS COLLECTS > 1")
    +check_formatted("INST HEALTH_STATUS COLLECTS > 1")
    +check_with_units("INST HEALTH_STATUS COLLECTS > 1")
    +# Python passes type as string
    +check("INST HEALTH_STATUS COLLECTS > 1", type='RAW')
     

    @@ -2318,7 +2111,7 @@

    Checks a converted telemetry item against an expected value with a tolerance. If the verification fails then the script will be paused with an error. Note: In most cases using wait_check_tolerance is a better choice than using check_tolerance.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    check_tolerance("<Target Name> <Packet Name> <Item Name>", <Expected Value>, <Tolerance>)
     
    @@ -2352,26 +2145,22 @@

    ± Tolerance on the expected value. - type: - :CONVERTED (default) or :RAW + type + CONVERTED (default) or RAW (Ruby symbol, Python string) -

    Example:

    +

    Ruby Example:

    check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0)
     check_tolerance("INST HEALTH_STATUS TEMP1", 50000, 20000, type: :RAW)
     
    -

    -check_tolerance_raw

    - -

    Deprecated: Use check_tolerance with type: :RAW

    +

    Python Example:

    -

    Example:

    - -
    check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, type: :RAW)
    +
    check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0)
    +check_tolerance("INST HEALTH_STATUS TEMP1", 50000, 20000, type='RAW')
     

    @@ -2379,7 +2168,7 @@

    Evaluates an expression. If the expression evaluates to false the script will be paused with an error. This method can be used to perform more complicated comparisons than using check as shown in the example. Note: In most cases using wait_check_expression is a better choice than using check_expression.

    -

    Remember that everything inside the check_expression string will be evaluated directly by the Ruby interpreter and thus must be valid syntax. A common mistake is to check a variable like so:

    +

    Remember that everything inside the check_expression string will be evaluated directly and thus must be valid syntax. A common mistake is to check a variable like so (Ruby variable interpolation):

    check_expression("#{answer} == 'yes'") # where answer contains 'yes'

    @@ -2389,7 +2178,7 @@

    Now this evaluates to 'yes' == 'yes' which is true so the check passes.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    check_expression("<Expression>")
     
    @@ -2404,12 +2193,12 @@

    Expression - A ruby expression to evaluate. + An expression to evaluate. -

    Example:

    +

    Ruby / Python Example:

    check_expression("tlm('INST HEALTH_STATUS COLLECTS') > 5 and tlm('INST HEALTH_STATUS TEMP1') > 25.0")
     
    @@ -2419,7 +2208,7 @@

    Executes a method and expects an exception to be raised. If the method does not raise an exception, a CheckError is raised.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    check_exception("<Method Name>", "<Method Params - optional>")
     
    @@ -2443,17 +2232,22 @@

    -

    Example:

    +

    Ruby Example:

    check_exception("cmd", "INST", "COLLECT", "TYPE" => "NORMAL")
     
    -

    -tlm

    +

    Python Example:

    + +
    check_exception("cmd", "INST", "COLLECT", {"TYPE": "NORMAL"})
    +
    + +

    +tlm, tlm_raw, tlm_formatted, tlm_with_units

    -

    Reads the converted form of a specified telemetry item.

    +

    Reads the specified form of a telemetry item.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    tlm("<Target Name> <Packet Name> <Item Name>")
     
    @@ -2479,67 +2273,38 @@

    Name of the telemetry item. - type: - Named parameter specifying the type. :RAW, :CONVERTED (default), :FORMATTED, :WITH_UNITS. + type + Named parameter specifying the type. RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string). -

    Example:

    +

    Ruby Example:

    value = tlm("INST HEALTH_STATUS COLLECTS")
    +value = tlm_raw("INST HEALTH_STATUS COLLECTS")
    +value = tlm_formatted("INST HEALTH_STATUS COLLECTS")
    +value = tlm_with_units("INST HEALTH_STATUS COLLECTS")
    +# Equivalent to tlm_raw
     raw_value = tlm("INST HEALTH_STATUS COLLECTS", type: :RAW)
     
    -

    -tlm_raw

    - -

    Deprecated: Use tlm with type: :FORMATTED

    - -

    Example:

    - -
    value = tlm("INST HEALTH_STATUS COLLECTS", type: :RAW)
    -
    - -

    -tlm_formatted

    - -

    Deprecated: Use tlm with type: :FORMATTED

    - -

    Example:

    - -
    value = tlm("INST HEALTH_STATUS COLLECTS", type: :FORMATTED)
    -
    - -

    -tlm_with_units

    - -

    Deprecated: Use tlm with type: :WITH_UNITS

    - -

    Example:

    - -
    value = tlm("INST HEALTH_STATUS COLLECTS", type: WITH_UNITS)
    -
    - -

    -tlm_variable

    - -

    Deprecated: Use tlm with type: :RAW, type: :CONVERTED (default), type: :FORMATTED, or type: :WITH_UNITS

    - -

    Example:

    +

    Python Example:

    -
    value = tlm("INST HEALTH_STATUS COLLECTS", type: :RAW)
    -value = tlm("INST HEALTH_STATUS COLLECTS", type: :CONVERTED)
    -value = tlm("INST HEALTH_STATUS COLLECTS", type: :FORMATTED)
    -value = tlm("INST HEALTH_STATUS COLLECTS", type: :WITH_UNITS)
    +
    value = tlm("INST HEALTH_STATUS COLLECTS")
    +value = tlm_raw("INST HEALTH_STATUS COLLECTS")
    +value = tlm_formatted("INST HEALTH_STATUS COLLECTS")
    +value = tlm_with_units("INST HEALTH_STATUS COLLECTS")
    +# Equivalent to tlm_raw
    +raw_value = tlm("INST HEALTH_STATUS COLLECTS", type='RAW')
     

    get_tlm_buffer

    -

    Returns a packet hash (similar to get_telemetry) along with the raw packet buffer as a Ruby string.

    +

    Returns a packet hash (similar to get_telemetry) along with the raw packet buffer.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    buffer = get_tlm_buffer("<Target Name>", "<Packet Name>")['buffer']
     
    @@ -2563,10 +2328,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    packet = get_tlm_buffer("INST", "HEALTH_STATUS")
    -packet['buffer'].unpack('C*') # See the Ruby documentation for class String method unpack
    +packet['buffer']
     

    @@ -2574,9 +2339,9 @@

    Returns the names, values, and limits states of all telemetry items in a specified packet. The value is returned as an array of arrays with each entry containing [item_name, item_value, limits_state].

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    get_tlm_packet("<Target Name>", "<Packet Name>", type: :CONVERTED)
    +
    get_tlm_packet("<Target Name>", "<Packet Name>", <type>)
     
    @@ -2596,23 +2361,28 @@

    - - + +
    Name of the packet.
    type:Named parameter specifying the type. :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS.typeNamed parameter specifying the type. RAW, CONVERTED (default), FORMATTED, or WITH_UNITS (Ruby symbol, Python string).
    -

    Example:

    +

    Ruby Example:

    names_values_and_limits_states = get_tlm_packet("INST", "HEALTH_STATUS", type: :FORMATTED)
     
    +

    Python Example:

    + +
    names_values_and_limits_states = get_tlm_packet("INST", "HEALTH_STATUS", type='FORMATTED')
    +
    +

    get_tlm_values (modified in 5.0.0)

    Returns the values and current limits state for a specified set of telemetry items. Items can be in any telemetry packet in the system. They can all be retrieved using the same value type or a specific value type can be specified for each item.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    values, limits_states, limits_settings, limits_set = get_tlm_values(<items>)
     
    @@ -2632,8 +2402,10 @@

    +

    Ruby / Python Example:

    +
    values = get_tlm_values(["INST__HEALTH_STATUS__TEMP1__CONVERTED", "INST__HEALTH_STATUS__TEMP2__RAW"])
    -pp values # [[-100.0, :RED_LOW], [0, :RED_LOW]]
    +print(values) # [[-100.0, :RED_LOW], [0, :RED_LOW]]
     

    @@ -2641,7 +2413,7 @@

    Returns an array of all target packet hashes.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_all_telemetry("<Target Name>")
     
    @@ -2661,10 +2433,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    packets = get_all_telemetry("INST")
    -pp packets
    +print(packets)
     #[{"target_name"=>"INST",
     #  "packet_name"=>"ADCS",
     #  "endianness"=>"BIG_ENDIAN",
    @@ -2682,7 +2454,7 @@ 

    Returns a packet hash.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_telemetry("<Target Name>", "<Packet Name>")
     
    @@ -2706,10 +2478,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    packet = get_telemetry("INST", "HEALTH_STATUS")
    -pp packet
    +print(packet)
     #{"target_name"=>"INST",
     # "packet_name"=>"HEALTH_STATUS",
     # "endianness"=>"BIG_ENDIAN",
    @@ -2734,7 +2506,7 @@ 

    Returns an item hash.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_item("<Target Name>", "<Packet Name>", "<Item Name>")
     
    @@ -2762,10 +2534,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    item = get_item("INST", "HEALTH_STATUS", "CCSDSVER")
    -pp item
    +print(item)
     #{"name"=>"CCSDSVER",
     # "bit_offset"=>0,
     # "bit_size"=>3,
    @@ -2781,7 +2553,7 @@ 

    Returns the number of times a specified telemetry packet has been received.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_tlm_cnt("<Target Name>", "<Packet Name>")
     
    @@ -2805,32 +2577,19 @@

    -

    Example:

    +

    Ruby / Python Example:

    tlm_cnt = get_tlm_cnt("INST", "HEALTH_STATUS") # Number of times the INST HEALTH_STATUS telemetry packet has been received.
     
    -

    -get_all_tlm_info

    - -

    Returns the number of times each telemetry packet has been received. The return value is an array of arrays where each subarray contains the target name, telemetry packet name, and packet count for a telemetry packet.

    - -

    Syntax / Example:

    - -
    tlm_info = get_all_tlm_info()
    -tlm_info.each do |target_name, pkt_name, pkt_count|
    -  puts "Target: #{target_name}, Packet: #{pkt_name}, Packet count: #{pkt_count}"
    -end
    -
    -

    set_tlm

    Sets a telemetry item value in the Command and Telemetry Server. This value will be overwritten if a new packet is received from an interface. For that reason this method is most useful if interfaces are disconnected or for testing via the Script Runner disconnect mode. Manually setting telemetry values allows for the execution of many logical paths in scripts.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    set_tlm("<Target> <Packet> <Item> = <Value>")
    +
    set_tlm("<Target> <Packet> <Item> = <Value>", <type>)
     
    @@ -2858,13 +2617,13 @@

    - - + +
    Value to set
    type:Value type :RAW, :CONVERTED (default), :FORMATTED, :WITH_UNITStypeValue type RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string)
    -

    Example:

    +

    Ruby Example:

    set_tlm("INST HEALTH_STATUS COLLECTS = 5") # type is :CONVERTED by default
     check("INST HEALTH_STATUS COLLECTS == 5")
    @@ -2872,14 +2631,22 @@ 

    check("INST HEALTH_STATUS COLLECTS == 10", type: :RAW)

    +

    Python Example:

    + +
    set_tlm("INST HEALTH_STATUS COLLECTS = 5") # type is CONVERTED by default
    +check("INST HEALTH_STATUS COLLECTS == 5")
    +set_tlm("INST HEALTH_STATUS COLLECTS = 10", type='RAW')
    +check("INST HEALTH_STATUS COLLECTS == 10", type='RAW')
    +
    +

    inject_tlm

    Injects a packet into the system as if it was received from an interface.

    -

    Syntax:

    +

    Ruby / Packet Syntax:

    -
    inject_tlm("<target_name>", "<packet_name>", <item_hash>, type: :CONVERTED)
    +
    inject_tlm("<target_name>", "<packet_name>", <item_hash>, <type>)
     
    @@ -2903,25 +2670,30 @@

    - - + +
    Hash of item name/value for each item. If an item is not specified in the hash, the current value table value will be used. Optional parameter, defaults to nil.
    type:Type of values in the item hash, :RAW, :CONVERTED (default), :FORMATTED, :WITH_UNITStypeType of values in the item hash, RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string)
    -

    Example:

    +

    Ruby Example:

    inject_tlm("INST", "PARAMS", {'VALUE1' => 5.0, 'VALUE2' => 7.0})
     
    +

    Python Example:

    + +
    inject_tlm("INST", "PARAMS", {'VALUE1': 5.0, 'VALUE2': 7.0})
    +
    +

    override_tlm

    Sets the converted value for a telmetry point in the Command and Telemetry Server. This value will be maintained even if a new packet is received on the interface unless the override is canceled with the normalize_tlm method.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    override_tlm("<Target> <Packet> <Item> = <Value>")
    +
    override_tlm("<Target> <Packet> <Item> = <Value>", <type>)
     
    @@ -2949,26 +2721,32 @@

    - - + +
    Value to set
    type:Type to override, :ALL (default), :RAW, :CONVERTED, :FORMATTED, :WITH_UNITStypeType to override, ALL (default), RAW, CONVERTED, FORMATTED, WITH_UNITS (Ruby symbol, Python string)
    -

    Example:

    +

    Ruby Example:

    override_tlm("INST HEALTH_STATUS TEMP1 = 5") # All requests for TEMP1 return 5
     override_tlm("INST HEALTH_STATUS TEMP2 = 0", type: :RAW) # Only RAW tlm set to 0
     
    +

    Python Example:

    + +
    override_tlm("INST HEALTH_STATUS TEMP1 = 5") # All requests for TEMP1 return 5
    +override_tlm("INST HEALTH_STATUS TEMP2 = 0", type='RAW') # Only RAW tlm set to 0
    +
    +

    normalize_tlm

    Clears the override of a telmetry point in the Command and Telemetry Server.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    normalize_tlm("<Target> <Packet> <Item>")
    +
    normalize_tlm("<Target> <Packet> <Item>", <type>)
     
    @@ -2992,18 +2770,24 @@

    - - + +
    Item name
    type:Type to normalize, :ALL (default), :RAW, :CONVERTED, :FORMATTED, :WITH_UNITStypeType to normalize, ALL (default), RAW, CONVERTED, FORMATTED, WITH_UNITS (Ruby symbol, Python string)
    -

    Example:

    +

    Ruby Example:

    normalize_tlm("INST HEALTH_STATUS TEMP1") # clear all overrides
    -normalize_tlm("INST HEALTH_STATUS TEMP1", type: :RAW) # clear only the :RAW override
    +normalize_tlm("INST HEALTH_STATUS TEMP1", type: :RAW) # clear only the RAW override
     
    +

    Python Example:

    + +
    normalize_tlm("INST HEALTH_STATUS TEMP1") # clear all overrides
    +normalize_tlm("INST HEALTH_STATUS TEMP1", type='RAW') # clear only the RAW override
    +
    +

    Packet Data Subscriptions

    @@ -3014,7 +2798,7 @@

    Allows the user to listen for one or more telemetry packets of data to arrive. A unique id is returned which is used to retrieve the data.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    subscribe_packets(packets)
     
    @@ -3034,7 +2818,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    id = subscribe_packets([['INST', 'HEALTH_STATUS'], ['INST', 'ADCS']])
     
    @@ -3044,11 +2828,16 @@

    Streams packet data from a previous subscription.

    -

    Syntax:

    +

    Ruby Syntax:

    get_packets(id, block: nil, count: 1000)
     
    +

    Python Syntax:

    + +
    get_packets(id, block=None, count=1000)
    +
    + @@ -3063,7 +2852,7 @@

    - + @@ -3072,7 +2861,7 @@

    blockNumber of milliseconds to block while waiting for packets form ANY stream, default nil (do not block)Number of milliseconds to block while waiting for packets form ANY stream, default nil / None (do not block)
    count
    -

    Example:

    +

    Ruby Example:

    id = subscribe_packets([['INST', 'HEALTH_STATUS'], ['INST', 'ADCS']])
     wait 0.1
    @@ -3087,6 +2876,20 @@ 

    end

    +

    Python Example:

    + +
    id = subscribe_packets([['INST', 'HEALTH_STATUS'], ['INST', 'ADCS']])
    +wait(0.1)
    +id, packets = get_packets(id)
    +for packet in packets:
    +    print(f"{packet['PACKET_TIMESECONDS']}: {packet['target_name']} {packet['packet_name']}")
    +
    +# Reuse ID from last call, allow for 1s wait, only get 1 packet
    +id, packets = get_packets(id, block=1000, count=1)
    +for packet in packets:
    +    print(f"{packet['PACKET_TIMESECONDS']}: {packet['target_name']} {packet['packet_name']}")
    +
    +

    Delays

    @@ -3097,7 +2900,7 @@

    Pauses the script for a configurable amount of time (minimum 10ms) or until a converted telemetry item meets given criteria. It supports three different syntaxes as shown. If no parameters are given then an infinite wait occurs until the user presses Go. Note that on a timeout, wait does not stop the script, usually wait_check is a better choice.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    wait()
     wait(<Time>)
    @@ -3118,7 +2921,9 @@ 

    -
    wait("<Target Name> <Packet Name> <Item Name> <Comparison>", <Timeout>, <Polling Rate (optional)>)
    +

    Ruby / Python Syntax:

    + +
    wait("<Target Name> <Packet Name> <Item Name> <Comparison>", <Timeout>, <Polling Rate (optional)>, type, quiet)
     
    @@ -3153,24 +2958,31 @@

    + + + + + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    typeNamed parameter specifying the type. RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string).
    quietNamed parameter indicating whether to log the result. Defaults to true.
    -

    Examples:

    +

    Ruby Example:

    -
    wait()
    -wait(5)
    +
    wait
    +wait 5
     wait("INST HEALTH_STATUS COLLECTS == 3", 10)
    +wait("INST HEALTH_STATUS COLLECTS == 3", 10, type: :RAW, quiet: false)
     
    -

    -wait_raw

    - -

    Deprecated: Use wait with type: :RAW

    +

    Python Example:

    -

    Examples:

    - -
    wait("INST HEALTH_STATUS COLLECTS == 3", 10, type: :RAW)
    +
    wait()
    +wait(5)
    +wait("INST HEALTH_STATUS COLLECTS == 3", 10)
    +wait("INST HEALTH_STATUS COLLECTS == 3", 10, type='RAW', quiet=False)
     

    @@ -3178,9 +2990,9 @@

    Pauses the script for a configurable amount of time or until a converted telemetry item meets equals an expected value within a tolerance. Note that on a timeout, wait_tolerance does not stop the script, usually wait_check_tolerance is a better choice.

    -

    Syntax:

    +

    Ruby Python Syntax:

    -
    wait_tolerance("<Target Name> <Packet Name> <Item Name>", <Expected Value>, <Tolerance>, <Timeout>, <Polling Rate (optional)>)
    +
    wait_tolerance("<Target Name> <Packet Name> <Item Name>", <Expected Value>, <Tolerance>, <Timeout>, <Polling Rate (optional), type, quiet>)
     
    @@ -3219,22 +3031,27 @@

    + + + + + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    typeNamed parameter specifying the type. RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string).
    quietNamed parameter indicating whether to log the result. Defaults to true.
    -

    Examples:

    +

    Ruby Examples:

    wait_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10)
    +wait_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10, type: :RAW, quiet: true)
     
    -

    -wait_tolerance_raw

    +

    Python Examples:

    -

    Deprecated: Use wait_tolerance with type: :RAW

    - -

    Examples:

    - -
    wait_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10, type: :RAW)
    +
    wait_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10)
    +wait_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10, type='RAW', quiet=True)
     

    @@ -3244,7 +3061,7 @@

    Syntax:

    -
    wait_expression("<Expression>", <Timeout>, <Polling Rate (optional)>)
    +
    wait_expression("<Expression>", <Timeout>, <Polling Rate (optional)>, quiet)
     
    @@ -3267,10 +3084,14 @@

    + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    quietNamed parameter indicating whether to log the result. Defaults to true.
    -

    Example:

    +

    Ruby / Python Example:

    wait_expression("tlm('INST HEALTH_STATUS COLLECTS') > 5 and tlm('INST HEALTH_STATUS TEMP1') > 25.0", 10)
     
    @@ -3280,9 +3101,9 @@

    Pauses the script until a certain number of packets have been received. If a timeout occurs the script will continue. Note that on a timeout, wait_packet does not stop the script, usually wait_check_packet is a better choice.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    wait_packet("<Target>", "<Packet>", <Num Packets>, <Timeout>, <Polling Rate (optional)>)
    +
    wait_packet("<Target>", "<Packet>", <Num Packets>, <Timeout>, <Polling Rate (optional)>, quiet)
     
    @@ -3313,10 +3134,14 @@

    + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    quietNamed parameter indicating whether to log the result. Defaults to true.
    -

    Example:

    +

    Ruby / Python Example:

    wait_packet('INST', 'HEALTH_STATUS', 5, 10) # Wait for 5 INST HEALTH_STATUS packets over 10s
     
    @@ -3326,9 +3151,9 @@

    Combines the wait and check keywords into one. This pauses the script until the converted value of a telemetry item meets given criteria or times out. On a timeout the script stops.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    wait_check("<Target Name> <Packet Name> <Item Name> <Comparison>", <Timeout>, <Polling Rate (optional)>)
    +
    wait_check("<Target Name> <Packet Name> <Item Name> <Comparison>", <Timeout>, <Polling Rate (optional)>, type)
     
    @@ -3363,22 +3188,23 @@

    + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    typeNamed parameter specifying the type. RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string).
    -

    Example:

    +

    Ruby Example:

    wait_check("INST HEALTH_STATUS COLLECTS > 5", 10)
    +wait_check("INST HEALTH_STATUS COLLECTS > 5", 10, type: :RAW)
     
    -

    -wait_check_raw

    - -

    Deprecated: Use wait_check with type: :RAW

    - -

    Example:

    +

    Python Example:

    -
    wait_check("INST HEALTH_STATUS COLLECTS > 5", 10, type: :RAW)
    +
    wait_check("INST HEALTH_STATUS COLLECTS > 5", 10)
    +wait_check("INST HEALTH_STATUS COLLECTS > 5", 10, type='RAW')
     

    @@ -3386,9 +3212,9 @@

    Pauses the script for a configurable amount of time or until a converted telemetry item equals an expected value within a tolerance. On a timeout the script stops.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    wait_check_tolerance("<Target Name> <Packet Name> <Item Name>", <Expected Value>, <Tolerance>, <Timeout>, <Polling Rate (optional)>)
    +
    wait_check_tolerance("<Target Name> <Packet Name> <Item Name>", <Expected Value>, <Tolerance>, <Timeout>, <Polling Rate (optional)>, type)
     
    @@ -3427,22 +3253,23 @@

    + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    typeNamed parameter specifying the type. RAW, CONVERTED (default), FORMATTED, WITH_UNITS (Ruby symbol, Python string).
    -

    Examples:

    +

    Ruby Example:

    wait_check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10)
    +wait_check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10, type: :RAW)
     
    -

    -wait_check_tolerance_raw

    - -

    Deprecated: Use wait_check_tolerance with type: :RAW

    +

    Python Example:

    -

    Examples:

    - -
    wait_check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10, type: :RAW)
    +
    wait_check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10)
    +wait_check_tolerance("INST HEALTH_STATUS COLLECTS", 10.0, 5.0, 10, type='RAW')
     

    @@ -3450,7 +3277,7 @@

    Pauses the script until an expression is evaluated to be true or a timeout occurs. If a timeout occurs the script will stop. This method can be used to perform more complicated comparisons than using wait as shown in the example. Also see the syntax notes for check_expression.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    wait_check_expression("<Expression>", <Timeout>, <Polling Rate (optional)>)
     
    @@ -3478,7 +3305,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    wait_check_expression("tlm('INST HEALTH_STATUS COLLECTS') > 5 and tlm('INST HEALTH_STATUS TEMP1') > 25.0", 10)
     
    @@ -3488,9 +3315,9 @@

    Pauses the script until a certain number of packets have been received. If a timeout occurs the script will stop.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    wait_check_packet("<Target>", "<Packet>", <Num Packets>, <Timeout>, <Polling Rate (optional)>)
    +
    wait_check_packet("<Target>", "<Packet>", <Num Packets>, <Timeout>, <Polling Rate (optional)>, quiet)
     
    @@ -3521,10 +3348,14 @@

    + + + +
    Polling Rate How often the comparison is evaluated in seconds. Defaults to 0.25 if not specified.
    quietNamed parameter indicating whether to log the result. Defaults to true.
    -

    Example:

    +

    Ruby / Python Example:

    wait_check_packet('INST', 'HEALTH_STATUS', 5, 10) # Wait for 5 INST HEALTH_STATUS packets over 10s
     
    @@ -3538,16 +3369,21 @@

    These methods deal with handling telemetry limits.

    -

    -limits_enabled?

    +

    +limits_enabled?, limits_enabled

    The limits_enabled? method returns true/false depending on whether limits are enabled for a telemetry item.

    -

    Syntax:

    +

    Ruby Syntax:

    limits_enabled?("<Target Name> <Packet Name> <Item Name>")
     
    +

    Python Syntax:

    + +
    limits_enabled("<Target Name> <Packet Name> <Item Name>")
    +
    + @@ -3571,17 +3407,22 @@

    -

    Example:

    +

    Ruby Example:

    -
    enabled = limits_enabled?("INST HEALTH_STATUS TEMP1")
    +
    enabled = limits_enabled?("INST HEALTH_STATUS TEMP1") # => true or false
     
    +

    Python Example:

    + +
    enabled = limits_enabled("INST HEALTH_STATUS TEMP1") # => True or False
    +
    +

    enable_limits

    Enables limits monitoring for the specified telemetry item.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    enable_limits("<Target Name> <Packet Name> <Item Name>")
     
    @@ -3609,7 +3450,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    enable_limits("INST HEALTH_STATUS TEMP1")
     
    @@ -3619,7 +3460,7 @@

    Disables limits monitoring for the specified telemetry item.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    disable_limits("<Target Name> <Packet Name> <Item Name>")
     
    @@ -3647,7 +3488,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    disable_limits("INST HEALTH_STATUS TEMP1")
     
    @@ -3657,7 +3498,7 @@

    Enables limits monitoring on a set of telemetry items specified in a limits group.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    enable_limits_group("<Limits Group Name>")
     
    @@ -3677,7 +3518,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    enable_limits_group("SAFE_MODE")
     
    @@ -3687,7 +3528,7 @@

    Disables limits monitoring on a set of telemetry items specified in a limits group.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    disable_limits_group("<Limits Group Name>")
     
    @@ -3707,7 +3548,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    disable_limits_group("SAFE_MODE")
     
    @@ -3717,7 +3558,7 @@

    Returns the list of limits groups in the system.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    limits_groups = get_limits_groups()
     
    @@ -3725,9 +3566,9 @@

    set_limits_set

    -

    Sets the current limits set. The default limits set is :DEFAULT.

    +

    Sets the current limits set. The default limits set is DEFAULT.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    set_limits_set("<Limits Set Name>")
     
    @@ -3747,7 +3588,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    set_limits_set("DEFAULT")
     
    @@ -3755,9 +3596,9 @@

    get_limits_set

    -

    Returns the name of the current limits set. The default limits set is :DEFAULT.

    +

    Returns the name of the current limits set. The default limits set is DEFAULT.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    limits_set = get_limits_set()
     
    @@ -3767,7 +3608,7 @@

    Returns the list of limits sets in the system.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    limits_sets = get_limits_sets()
     
    @@ -3777,7 +3618,7 @@

    Returns limits settings for a telemetry point.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_limits(<Target Name>, <Packet Name>, <Item Name>, <Limits Set (optional)>)
     
    @@ -3809,7 +3650,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    limits_set, persistence_setting, enabled, red_low, yellow_low, yellow_high, red_high, green_low, green_high = get_limits('INST', 'HEALTH_STATUS', 'TEMP1')
     
    @@ -3819,7 +3660,7 @@

    The set_limits_method sets limits settings for a telemetry point. Note: In most cases it would be better to update your config files or use different limits sets rather than changing limits settings in realtime.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    set_limits(<Target Name>, <Packet Name>, <Item Name>, <Red Low>, <Yellow Low>, <Yellow High>, <Red High>, <Green Low (optional)>, <Green High (optional)>, <Limits Set (optional)>, <Persistence (optional)>, <Enabled (optional)>)
     
    @@ -3870,7 +3711,7 @@

    Limits Set - Optional. Set the limits for a specific limits set. If not given then it defaults to setting limts for the :CUSTOM limits set. + Optional. Set the limits for a specific limits set. If not given then it defaults to setting limts for the CUSTOM limits set. Persistence @@ -3883,9 +3724,9 @@

    -

    Example:

    +

    Ruby / Python Example:

    -
    set_limits('INST', 'HEALTH_STATUS', 'TEMP1', -10.0, 0.0, 50.0, 60.0, 30.0, 40.0, :TVAC, 1, true)
    +
    set_limits('INST', 'HEALTH_STATUS', 'TEMP1', -10.0, 0.0, 50.0, 60.0, 30.0, 40.0, 'TVAC', 1, true)
     

    @@ -3893,7 +3734,7 @@

    Returns an array with the target_name, packet_name, item_name, and limits_state of all items that are out of their limits ranges.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    out_of_limits_items = get_out_of_limits()
     
    @@ -3901,9 +3742,9 @@

    get_overall_limits_state

    -

    Returns the overall limits state for the COSMOS system. Returns :GREEN, :YELLOW, :RED, or :STALE.

    +

    Returns the overall limits state for the COSMOS system. Returns ‘GREEN’, ‘YELLOW’, or ‘RED’.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    get_overall_limits_state(<ignored_items> (optional))
     
    @@ -3923,62 +3764,20 @@

    -

    Example:

    +

    Ruby / Python Example:

    overall_limits_state = get_overall_limits_state()
     overall_limits_state = get_overall_limits_state([['INST', 'HEALTH_STATUS', 'TEMP1']])
     
    -

    -get_stale

    - -

    Returns a list of stale packets. The return value is an array of arrays where each subarray contains the target name and packet name for a stale packet.

    - -

    Syntax:

    - -
    get_stale(with_limits_only: false, target_name: nil, staleness_sec: 30)
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    ParameterDescription
    with_limits_only:If true, return only the packets that have limits items and thus affect the overall limits state of the system. Defaults to false.
    target_name:If specified, return only the packets associated with the given target. Defaults to nil.
    staleness_sec:Return packets that haven’t been received since X seconds ago. Defaults to 30.
    - -

    Example:

    - -
    stale_packets = get_stale()
    -stale_packets.each do |target, packet|
    -  puts "Stale packet: #{target} #{packet}"
    -end
    -inst_stale_packets = get_stale(target_name: "INST")
    -
    -

    get_limits_events

    Returns limits events based on an offset returned from the last time it was called.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    get_limits_event(offset, count: 100)
    +
    get_limits_event(<offset>, count)
     
    @@ -3994,16 +3793,16 @@

    - - + +
    Offset returned by the previous call to get_limits_event. Default is nil for the initial call
    count:Maximum number of limits events to return. Default is 100countNamed parameter specifying the maximum number of limits events to return. Default is 100
    -

    Example:

    +

    Ruby / Python Example:

    events = get_limits_event()
    -pp events
    +print(events)
     #[["1613077715557-0",
     #  {"type"=>"LIMITS_CHANGE",
     #   "target_name"=>"TGT",
    @@ -4024,7 +3823,7 @@ 

    # "message"=>"message"}]] # The last offset is the first item ([0]) in the last event ([-1]) events = get_limits_event(events[-1][0]) -pp events +print(events) #[["1613077715657-0", # {"type"=>"LIMITS_CHANGE", # ... @@ -4035,14 +3834,14 @@

    Methods for getting knowledge about targets.

    -

    -get_target_list

    +

    +get_target_names

    Returns a list of the targets in the system in an array.

    -

    Syntax / Example:

    +

    Ruby Syntax / Example:

    -
    targets = get_target_list()
    +
    targets = get_target_names() # => ['INST', 'INST2', 'EXAMPLE', 'TEMPLATED']
     

    @@ -4050,8 +3849,10 @@

    Returns a target hash containing all the information about the target.

    -

    Syntax: -get_target("<Target Name>")

    +

    Ruby Syntax:

    + +
    get_target("<Target Name>")
    +
    @@ -4068,10 +3869,10 @@

    -

    Example:

    +

    Ruby Example:

    target = get_target("INST")
    -pp target
    +print(target)
     #{"name"=>"INST",
     # "folder_name"=>"INST",
     # "requires"=>[],
    @@ -4129,8 +3930,10 @@ 

    Returns an interface status including the as built interface and its current status (cmd/tlm counters, etc).

    -

    Syntax: -get_interface("<Interface Name>")

    +

    Ruby / Python Syntax:

    + +
    get_interface("<Interface Name>")
    +
    @@ -4147,10 +3950,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    interface = get_interface("INST_INT")
    -pp interface
    +print(interface)
     #{"name"=>"INST_INT",
     # "config_params"=>["interface.rb"],
     # "target_names"=>["INST"],
    @@ -4179,9 +3982,9 @@ 

    Returns a list of the interfaces in the system in an array.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    -
    interface_names = get_interface_names()
    +
    interface_names = get_interface_names() # => ['INST_INT', 'INST2_INT', 'EXAMPLE_INT', 'TEMPLATED_INT']
     

    @@ -4189,7 +3992,7 @@

    Connects to targets associated with a COSMOS interface.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    connect_interface("<Interface Name>", <Interface Parameters (optional)>)
     
    @@ -4213,7 +4016,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    connect_interface("INT1")
     connect_interface("INT1", hostname, port)
    @@ -4224,7 +4027,7 @@ 

    Disconnects from targets associated with a COSMOS interface.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    disconnect_interface("<Interface Name>")
     
    @@ -4244,7 +4047,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    disconnect_interface("INT1")
     
    @@ -4254,7 +4057,7 @@

    Starts logging of raw data on one or all interfaces. This is for debugging purposes only.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    start_raw_logging_interface("<Interface Name (optional)>")
     
    @@ -4274,7 +4077,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    start_raw_logging_interface("int1")
     
    @@ -4284,7 +4087,7 @@

    Stops logging of raw data on one or all interfaces. This is for debugging purposes only.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    stop_raw_logging_interface("<Interface Name (optional)>")
     
    @@ -4304,7 +4107,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    stop_raw_logging_interface("int1")
     
    @@ -4314,7 +4117,7 @@

    Returns information about all interfaces. The return value is an array of arrays where each subarray contains the interface name, connection state, number of connected clients, transmit queue size, receive queue size, bytes transmitted, bytes received, command count, and telemetry count.

    -

    Syntax / Example:

    +

    Ruby Syntax / Example:

    interface_info = get_all_interface_info()
     interface_info.each do |interface_name, connection_state, num_clients, tx_q_size, rx_q_size, tx_bytes, rx_bytes, cmd_count, tlm_count|
    @@ -4324,14 +4127,24 @@ 

    end

    +

    Python Syntax / Example:

    + +
    interface_info = get_all_interface_info()
    +for interface in interface_info():
    +    # [interface_name, connection_state, num_clients, tx_q_size, rx_q_size, tx_bytes, rx_bytes, cmd_count, tlm_count]
    +    print(f"Interface: {interface[0]}, Connection state: {interface[1]}, Num connected clients: {interface[2]}")
    +    print(f"Transmit queue size: {interface[3]}, Receive queue size: {interface[4]}, Bytes transmitted: {interface[5]}, Bytes received: {interface[6]}")
    +    print(f"Cmd count: {interface[7]}, Tlm count: {interface[8]}")
    +
    +

    map_target_to_interface

    Map a target to an interface allowing target commands and telemetry to be processed by that interface.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    map_target_to_interface("<Target Name>", "<Interface Name>")
    +
    map_target_to_interface("<Target Name>", "<Interface Name>", cmd_only, tlm_only, unmap_old)
     
    @@ -4351,25 +4164,30 @@

    - - + + - - + + - - + +
    Name of the interface
    cmd_only:Whether to map target commands only to the interface (default: false)cmd_onlyNamed parameter whether to map target commands only to the interface (default: false)
    tlm_only:Whether to map target telemetry only to the interface (default: false)tlm_onlyNamed parameter whether to map target telemetry only to the interface (default: false)
    unmap_old:Whether remove the target from all existing interfaces (default: true)unmap_oldNamed parameter whether remove the target from all existing interfaces (default: true)
    -

    Example:

    +

    Ruby Example:

    map_target_to_interface("INST", "INST_INT", unmap_old: false)
     
    +

    Python Example:

    + +
    map_target_to_interface("INST", "INST_INT", unmap_old=False)
    +
    +

    interface_cmd

    @@ -4460,7 +4278,7 @@

    Connects a COSMOS router.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    connect_router("<Router Name>", <Router Parameters (optional)>)
     
    @@ -4484,7 +4302,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    connect_ROUTER("INST_ROUTER")
     connect_router("INST_ROUTER", 7779, 7779, nil, 10.0, 'PREIDENTIFIED')
    @@ -4495,7 +4313,7 @@ 

    Disconnects a COSMOS router.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    disconnect_router("<Router Name>")
     
    @@ -4515,7 +4333,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    disconnect_router("INT1_ROUTER")
     
    @@ -4525,9 +4343,9 @@

    Returns a list of the routers in the system in an array.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    -
    router_names = get_router_names()
    +
    router_names = get_router_names() # => ['ROUTER_INT']
     

    @@ -4535,8 +4353,10 @@

    Returns a router status including the as built router and its current status (cmd/tlm counters, etc).

    -

    Syntax: -get_router("<Router Name>")

    +

    Ruby / Python Syntax:

    + +
    get_router("<Router Name>")
    +
    @@ -4553,10 +4373,10 @@

    -

    Example:

    +

    Ruby / Python Example:

    router = get_router("ROUTER_INT")
    -pp router
    +print(router)
     #{"name"=>"ROUTER_INT",
     # "config_params"=>["router.rb"],
     # "target_names"=>["INST"],
    @@ -4585,7 +4405,7 @@ 

    Returns information about all routers. The return value is an array of arrays where each subarray contains the router name, connection state, number of connected clients, transmit queue size, receive queue size, bytes transmitted, bytes received, packets received, and packets sent.

    -

    Syntax / Example:

    +

    Ruby Syntax / Example:

    router_info = get_all_router_info()
     router_info.each do |router_name, connection_state, num_clients, tx_q_size, rx_q_size, tx_bytes, rx_bytes, pkts_rcvd, pkts_sent|
    @@ -4595,12 +4415,22 @@ 

    end

    +

    Python Syntax / Example:

    + +
    router_info = get_all_router_info()
    +# router_name, connection_state, num_clients, tx_q_size, rx_q_size, tx_bytes, rx_bytes, pkts_rcvd, pkts_sent
    +for router in router_info:
    +    print(f"Router: {router[0]}, Connection state: {router[1]}, Num connected clients: {router[2]}")
    +    print(f"Transmit queue size: {router[3]}, Receive queue size: {router[4]}, Bytes transmitted: {router[5]}, Bytes received: {router[6]}")
    +    print(f"Packets received: {router[7]}, Packets sent: {router[8]}")
    +
    +

    start_raw_logging_router

    Starts logging of raw data on one or all routers. This is for debugging purposes only.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    start_raw_logging_router("<Router Name (optional)>")
     
    @@ -4620,7 +4450,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    start_raw_logging_router("router1")
     
    @@ -4630,7 +4460,7 @@

    Stops logging of raw data on one or all routers. This is for debugging purposes only.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    stop_raw_logging_router("<Router Name (optional)>")
     
    @@ -4650,7 +4480,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    stop_raw_logging_router("router1")
     
    @@ -4693,9 +4523,9 @@

    load_utility

    -

    Reads in a script file that contains useful subroutines for use in your test procedure. When these subroutines run in ScriptRunner or TestRunner, their lines will be highlighted. If you want to import subroutines but do not want their lines to be highlighted in ScriptRunner or TestRunner, use the standard Ruby ‘load’ or ‘require’ statement.

    +

    Reads in a script file that contains useful subroutines for use in your test procedure. When these subroutines run in ScriptRunner or TestRunner, their lines will be highlighted. If you want to import subroutines but do not want their lines to be highlighted in ScriptRunner or TestRunner, use the standard Ruby ‘load’ or ‘require’ statement or Python ‘import’ statement.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    load_utility("TARGET/lib/<Utility Filename>")
     
    @@ -4710,33 +4540,30 @@

    Utility Filename - Name of the script file containing subroutines including the .rb extension. You need to include the full target name and path such as TARGET/lib/utility.rb + Name of the script file containing subroutines including the .rb or .py extension. You need to include the full target name and path such as TARGET/lib/utility.rb

    Example:

    -
    load_utility("TARGET/lib/mode_changes.rb")
    +
    load_utility("TARGET/lib/mode_changes.rb") # Ruby
    +load_utility("TARGET/lib/mode_changes.py") # Python
     

    Opening, Closing & Creating Telemetry Screens

    -
    -

    Screen APIs not yet implemented in COSMOS 5

    -
    -

    These methods allow the user to open, close or create unique telemetry screens from within a test procedure.

    -

    -display

    +

    +display_screen

    Opens a telemetry screen at the specified position.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    display("<Display Name>", <X Position (optional)>, <Y Position (optional)>)
    +
    display_screen("<Display Name>", <X Position (optional)>, <Y Position (optional)>)
     
    @@ -4762,19 +4589,19 @@

    -

    Example:

    +

    Ruby / Python Example:

    display("INST ADCS", 100, 200)
     
    -

    -clear

    +

    +clear_screen

    Closes an open telemetry screen.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    -
    clear("<Display Name>")
    +
    clear_screen("<Display Name>")
     
    @@ -4792,40 +4619,19 @@

    -

    Example:

    +

    Ruby / Python Example:

    -
    clear("INST ADCS")
    +
    clear_screen("INST ADCS")
     
    -

    -clear_all

    - -

    Closes all open screens or all screens of a particular target.

    - -

    Syntax:

    - -
    clear_all("<Target Name>")
    -
    +

    +clear_all_screens

    - - - - - - - - - - - - - -
    ParameterDescription
    Target NameClose all screens associated with the target. If no target is passed, all screens are closed.
    +

    Closes all open screens.

    -

    Example:

    +

    Ruby / Python Syntax / Example:

    -
    clear_all("INST") # Clear all INST screens
    -clear_all() # Clear all screens
    +
    clear_all_screens()
     

    @@ -4833,33 +4639,9 @@

    The get_screen_list returns a list of available telemetry screens.

    -

    Syntax:

    - -
    get_screen_list("<config_filename>", <force_refresh>)
    -
    - - - - - - - - - - - - - - - - - - -
    ParameterDescription
    Config filenameA telemetry viewer config file to parse. If nil, the default config file will be used. Optional parameter, defaults to nil.
    Force refreshIf true the config file will be re-parsed. Optional parameter, defaults to false.
    - -

    Example:

    +

    Ruby / Python Syntax / Example:

    -
    screen_list = get_screen_list()
    +
    get_screen_list() # => ['INST ADCS', 'INST COMMANDING', ...]
     

    @@ -4869,7 +4651,7 @@

    Syntax:

    -
    get_screen_definition("<screen_full_name>", "<config_filename>", <force_refresh>)
    +
    get_screen_definition("<target name>", "<screen name>")
     
    @@ -4881,33 +4663,29 @@

    - - - - - - + + - - + +
    Screen full nameTelemetry screen name.
    Config filenameA telemetry viewer config file to parse. If nil, the default config file will be used. Optional parameter, defaults to nil.Screen target nameTelemetry screen target name.
    Force refreshIf true the config file will be re-parsed. Optional parameter, defaults to false.Screen nameScreen name within the specified target
    -

    Example:

    +

    Ruby / Python Example:

    -
    screen_definition = get_screen_definition("INST HS")
    +
    screen_definition = get_screen_definition("INST", "HS")
     
    -

    -local_screen

    +

    +create_screen

    -

    The local_screen allows you to create a temporary screen directly from a script. This also has the ability to use local variables from within your script in your screen.

    +

    The create_screen allows you to create a screen directly from a script.

    -

    Syntax:

    +

    Python / Ruby Syntax:

    -
    local_screen("<title>", "<screen definition>", <x position>, <y position>)
    +
    create_screen("<target name>", "<screen name>" "<screen definition>")
     
    @@ -4919,74 +4697,48 @@

    - - - - - - + + - - + + - - + +
    TitleScreen title
    Screen DefinitionYou can pass the entire screen definition as a Ruby String or define it inline in a block. Optional parameter, defaults to nil.Screen target nameTelemetry screen target name
    X PositionX Position in pixels to display the screen. Note the top left corner of the display is 0, 0. Optional parameter, defaults to nil.Screen nameScreen name within the specified target
    Y PositionY Position in pixels to display the screen. Note the top left corner of the display is 0, 0. Optional parameter, defaults to nil.Screen DefinitionThe entire screen definition as a String
    -

    Example:

    +

    Ruby Example:

    -
    temp = 0 # This variable is accessed in the screen
    -screen_def = '
    +
    screen_def = '
       SCREEN AUTO AUTO 0.1 FIXED
       VERTICAL
    -    TITLE "Local Variable"
    +    TITLE "Local Screen"
         VERTICALBOX
    -      LABELVALUE LOCAL LOCAL temp # Note LOCAL LOCAL
    +      LABELVALUE INST HEALTH_STATUS TEMP1
         END
       END
     '
     # Here we pass in the screen definition as a string
    -screen = local_screen("My Screen", screen_def, 100, 100)
    -disable_instrumentation do
    -  5000000.times do
    -    temp += 1 # Increment temp to update the screen
    -  end
    -end
    -screen.close # Close this local screen
    +create_screen("INST", "LOCAL", screen_def)
    +
    -temp = 0 -# The screen definition is nil so we define the screen in the block -local_screen("My Screen", nil, 500, 500) do - ' # Note the quote +

    Python Example:

    + +
    screen_def = '
       SCREEN AUTO AUTO 0.1 FIXED
       VERTICAL
    -    TITLE "Local Variable"
    +    TITLE "Local Screen"
         VERTICALBOX
    -      LABELVALUE LOCAL LOCAL temp # LOCAL LOCAL
    +      LABELVALUE INST HEALTH_STATUS TEMP1
         END
       END
    -  ' # Close quote
    -end
    -disable_instrumentation do
    -  5000000.times do
    -    temp += 1 # Increment temp to update the screen
    -  end
    -end
    -close_local_screens() # Close all open local screens
    -
    - -

    -close_local_screens

    - -

    The close_local_screens closes all temporary screens which were opened using local_screen.

    - -

    Syntax / Example:

    - -
    close_local_screens()
    +'
    +# Here we pass in the screen definition as a string
    +create_screen("INST", "LOCAL", screen_def)
     

    @@ -4999,7 +4751,7 @@

    This method sets the line delay in script runner.

    -

    Syntax:

    +

    Ruby / Python Syntax:

    set_line_delay(<delay>)
     
    @@ -5019,7 +4771,7 @@

    -

    Example:

    +

    Ruby / Python Example:

    set_line_delay(0.0)
     
    @@ -5029,29 +4781,49 @@

    The method gets the line delay that script runner is currently using.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    curr_line_delay = get_line_delay()
     
    -

    -get_scriptrunner_message_log_filename

    +

    +set_max_output

    -

    Returns the filename of the ScriptRunner message log.

    +

    This method sets the maximum number of characters to display in Script Runner output before truncating. Default is 50,000 characters.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax:

    -
    filename = get_scriptrunner_message_log_filename()
    +
    set_max_output(<characters>)
     
    -

    -start_new_scriptrunner_message_log

    + + + + + + + + + + + + + +
    ParameterDescription
    charactersNumber of characters to output before truncating
    -

    Starts a new ScriptRunner message log. Note: ScriptRunner will automatically start a new log whenever a script is started. This method is only needed for starting a new log mid-script execution.

    +

    Ruby / Python Example:

    -

    Syntax / Example:

    +
    set_max_output(100)
    +
    -
    filename = start_new_scriptrunner_message_log()
    +

    +get_max_output

    + +

    The method gets the maximum number of characters to display in Script Runner output before truncating. Default is 50,000 characters.

    + +

    Ruby / Python Syntax / Example:

    + +
    print(get_max_output()) # => 50000
     

    @@ -5062,7 +4834,7 @@

    _ WARNING: Use with caution. Disabling instrumentation will cause any error that occurs while disabled to cause your script to completely stop. _

    -

    Syntax / Example:

    +

    Ruby Syntax / Example:

    disable_instrumentation do
       1000.times do
    @@ -5071,35 +4843,12 @@ 

    end

    -

    -set_stdout_max_lines

    - -

    This method sets the maximum amount of lines of output that a single line in Scriptrunner can generate without being truncated.

    - -

    Syntax:

    - -
    set_stdout_max_lines(max_lines)
    -
    - - - - - - - - - - - - - - -
    ParameterDescription
    max_linesThe maximum number of lines that will be written to the ScriptRunner log at once
    - -

    Example:

    +

    Python Syntax / Example:

    -
    set_stdout_max_lines(2000)
    -
    +
    with disable_instrumentation:
    +    for x in range(0:1000):
    +        # Don't want this to have to highlight 1000 times
    +

    Debugging

    @@ -5111,7 +4860,7 @@

    Places ScriptRunner into step mode where Go must be hit to proceed to the next line.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    step_mode()
     
    @@ -5121,7 +4870,7 @@

    Places ScriptRunner into run mode where the next line is run automatically.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    run_mode()
     
    @@ -5131,7 +4880,7 @@

    Puts scripting into disconnect mode. In disconnect mode, commands are not sent to targets, checks are all successful, and waits expire instantly. Requests for telemetry (tlm()) typically return 0. Disconnect mode is useful for dry-running scripts without having connected targets.

    -

    Syntax / Example:

    +

    Ruby / Python Syntax / Example:

    disconnect_script()
     
    @@ -7124,11 +6873,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -7212,13 +6963,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/ssl-tls.html b/_site/docs/v5/ssl-tls.html index b01c8be..43ddf11 100644 --- a/_site/docs/v5/ssl-tls.html +++ b/_site/docs/v5/ssl-tls.html @@ -2349,11 +2349,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2437,13 +2439,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/streaming-api.html b/_site/docs/v5/streaming-api.html index 3d7a3ff..bc8aeff 100644 --- a/_site/docs/v5/streaming-api.html +++ b/_site/docs/v5/streaming-api.html @@ -2215,11 +2215,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2303,13 +2305,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/table-manager.html b/_site/docs/v5/table-manager.html index 9818ef3..817dae5 100644 --- a/_site/docs/v5/table-manager.html +++ b/_site/docs/v5/table-manager.html @@ -2189,11 +2189,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2277,13 +2279,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/table.html b/_site/docs/v5/table.html index f24fae8..a5fbfe0 100644 --- a/_site/docs/v5/table.html +++ b/_site/docs/v5/table.html @@ -2950,11 +2950,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -3038,13 +3040,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/target.html b/_site/docs/v5/target.html index a1f91e5..0ce3686 100644 --- a/_site/docs/v5/target.html +++ b/_site/docs/v5/target.html @@ -2271,11 +2271,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2359,13 +2361,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/telemetry-screens.html b/_site/docs/v5/telemetry-screens.html index ff60945..9d81a25 100644 --- a/_site/docs/v5/telemetry-screens.html +++ b/_site/docs/v5/telemetry-screens.html @@ -5946,11 +5946,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -6034,13 +6036,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/telemetry.html b/_site/docs/v5/telemetry.html index 65dfa13..ce04c59 100644 --- a/_site/docs/v5/telemetry.html +++ b/_site/docs/v5/telemetry.html @@ -3328,11 +3328,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -3416,13 +3418,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/testing.html b/_site/docs/v5/testing.html index 032c2b6..8d93ddc 100644 --- a/_site/docs/v5/testing.html +++ b/_site/docs/v5/testing.html @@ -2189,11 +2189,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2277,13 +2279,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/tlm-grapher.html b/_site/docs/v5/tlm-grapher.html index 4a5aaf0..6a1319d 100644 --- a/_site/docs/v5/tlm-grapher.html +++ b/_site/docs/v5/tlm-grapher.html @@ -2210,11 +2210,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2298,13 +2300,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/tlm-viewer.html b/_site/docs/v5/tlm-viewer.html index fe79f18..feb196d 100644 --- a/_site/docs/v5/tlm-viewer.html +++ b/_site/docs/v5/tlm-viewer.html @@ -2183,11 +2183,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2271,13 +2273,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/tools.html b/_site/docs/v5/tools.html index 41528b9..cb5d1ee 100644 --- a/_site/docs/v5/tools.html +++ b/_site/docs/v5/tools.html @@ -2273,11 +2273,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2361,13 +2363,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/upgrading.html b/_site/docs/v5/upgrading.html index 31cd871..0cca317 100644 --- a/_site/docs/v5/upgrading.html +++ b/_site/docs/v5/upgrading.html @@ -2147,11 +2147,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2235,13 +2237,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/docs/v5/xtce.html b/_site/docs/v5/xtce.html index 7f0e527..9943ca1 100644 --- a/_site/docs/v5/xtce.html +++ b/_site/docs/v5/xtce.html @@ -2213,11 +2213,13 @@

    Guides

    + +
  • - Scripting Guide + Scripting API Guide
  • @@ -2301,13 +2303,11 @@

    Guides

    - -
  • - Scripting Best Practices + Script Writing Guide
  • diff --git a/_site/feed.xml b/_site/feed.xml index c98f7f1..c50b6e3 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -11,8 +11,8 @@ OpenC3 News https://openc3.com/ - Tue, 10 Oct 2023 00:38:15 +0000 - Tue, 10 Oct 2023 00:38:15 +0000 + Tue, 10 Oct 2023 17:51:23 +0000 + Tue, 10 Oct 2023 17:51:23 +0000 en-US Jekyll v4.3.2 Open Source, Open Architecture - Command, Control and Communication diff --git a/_site/scripts/verify_scripting_api.rb b/_site/scripts/verify_scripting_api.rb new file mode 100644 index 0000000..ca4a29d --- /dev/null +++ b/_site/scripts/verify_scripting_api.rb @@ -0,0 +1,57 @@ +def parse_file(filename, methods) + File.open(filename) do |file| + file.each do |line| + if line.strip =~ /^def / + next if line.include?('def _') + next if line.include?('initialize') + method = line.strip.split(' ')[1] + if method.include?('(') + methods[method.split('(')[0]] = filename + else + methods[method] = filename + end + end + end + end +end + +api_methods = {} +Dir[File.join(File.dirname(__FILE__),'../../cosmos/openc3/lib/openc3/script/*.rb')].each do |filename| + next if filename.include?('extract') + parse_file(filename, api_methods) +end +Dir[File.join(File.dirname(__FILE__),'../../cosmos/openc3/lib/openc3/api/*.rb')].each do |filename| + parse_file(filename, api_methods) +end +# api_methods.uniq! + +documented_methods = [] +File.open(File.join(File.dirname(__FILE__),'../_docs_v5/4_guides/scripting_api.md')) do |file| + apis = false + file.each do |line| + if line.strip.include?('###') + if line.include?("Migration") + apis = true + next + end + next unless apis + line = line.strip[4..-1] + # Split off comments like '(since 5.0.0)' + line = line.split('(')[0].strip if line.include?('(') + if line.include?(",") # Split lines like '### check, check_raw' + line.split(',').each do |method| + documented_methods << method.strip + end + else + documented_methods << line + end + end + end +end +documented_methods.uniq! + +DEPRECATED = %w(require_utility get_all_target_info check_tolerance_raw wait_raw wait_check_raw wait_tolerance_raw wait_check_tolerance_raw) +puts "Documented but doesn't exist:" +puts documented_methods - api_methods.keys +puts "\nExists but not documented:" +puts api_methods.keys - documented_methods - DEPRECATED