diff --git a/docs/usage/expressions-variables.md b/docs/usage/expressions-variables.md new file mode 100644 index 0000000000..561be98e99 --- /dev/null +++ b/docs/usage/expressions-variables.md @@ -0,0 +1,47 @@ +# Expressions and Variables + +The Choreo GUI uses a mathematical expression parser (https://mathjs.org/) in nearly every number input. This has several benefits over a plain number input: + +* Warnings for incorrect dimensions in inputs (i.e. an angle in a length field) +* Use of any appropriate unit in inputs, instead of having to convert to SI units. +* Addition of different units of the same dimension; `2 m + 1 in` is a valid length input. +* Use of a set of pre-provided mathematical functions within the expression +* Ability to define variables that can be referenced throughout the project. + +## Expressions + +Every expression input has an associated dimension. Some are length inputs, some are angle inputs, etc. Some are dimensionless, meaning they accept an expression without units or one where the units cancel out. + +!!! note + Due to limitations in the parser, radians (`rad`) is an angle unit, not a dimensionless expression. + +These are all the dimensions supported by expression inputs: +* Number (Dimensionless) +* Length +* Linear Velocity +* Linear Acceleration +* Angle +* Angular Velocity +* Angular Acceleration +* Time +* Mass +* Torque +* Moment of Inertia + +The units supported by the expression parser can be found [here](https://mathjs.org/docs/datatypes/units.html#reference) with the following Choreo-specific additions: +* RPM (alias rpm), angular velocity equal to `cycle / minute` + +## Variables + +Choreo also allows users to define a project-wide set of expressions that can be referenced as variables in any input. + +### The Variables Panel + +### Adding Variables + +### Using Variables + +### Renaming Variables + + + diff --git a/mkdocs.yml b/mkdocs.yml index 63ec0d3b74..558ed5c0c6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -96,6 +96,7 @@ nav: - Saving: usage/saving.md - View Options Panel: usage/view-options-panel.md - Estimating Moment of Inertia: usage/estimating-moi.md + - Expressions and Variables: usage/expressions-variables.md - ChoreoLib: - Getting Started: choreolib/getting-started.md - Auto Factory: choreolib/auto-factory.md