---
url: /dyad/stable/stdlib/MultibodyComponents/components/TrajectorySelector.md
description: >-
  Dyad TrajectorySelector docs.  Selects one axis from the vector-valued outputs
  of a multi-axis trajectory generator.
---

# `TrajectorySelector` {#TrajectorySelector}

Selects one axis from the vector-valued outputs of a multi-axis trajectory generator.

Given the position, velocity, acceleration, and jerk reference vectors of an `nin`-axis trajectory generator, this component picks the entry at `index` from each and exposes them as scalar references for a single-axis controller. Using one instance per axis turns the axis-major trajectory outputs into per-axis reference bundles.

## Usage {#Usage}

`MultibodyComponents.TrajectorySelector()`

## Parameters: {#Parameters:}

|    Name |                         Description | Units | Default value |
| -------:| -----------------------------------:| -----:| -------------:|
|   `nin` | Number of axes in the input vectors |     – |             1 |
| `index` |          Index of the selected axis |     – |             1 |

## Connectors {#Connectors}

* `q` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `qd` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `qdd` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `qddd` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `s` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

* `v` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

* `a` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

* `j` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

$$ \begin{align}
s\left( t \right) &= q\_{1}\left( t \right) \\
v\left( t \right) &= \mathtt{qd}\_{1}\left( t \right) \\
a\left( t \right) &= \mathtt{qdd}\_{1}\left( t \right) \\
j\left( t \right) &= \mathtt{qddd}\_{1}\left( t \right)
\end{align}
$$

## Source {#Source}

```dyad
"""
Selects one axis from the vector-valued outputs of a multi-axis trajectory
generator.

Given the position, velocity, acceleration, and jerk reference vectors of an
`nin`-axis trajectory generator, this component picks the entry at `index` from
each and exposes them as scalar references for a single-axis controller. Using
one instance per axis turns the axis-major trajectory outputs into per-axis
reference bundles.
"""
component TrajectorySelector
  "Position reference vector"
  q = [RealInput() for i in 1:nin] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 100, "x2": 50, "y2": 200, "rot": 0}
      },
      "tags": []
    }
  }
  "Velocity reference vector"
  qd = [RealInput() for i in 1:nin] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 300, "x2": 50, "y2": 400, "rot": 0}
      },
      "tags": []
    }
  }
  "Acceleration reference vector"
  qdd = [RealInput() for i in 1:nin] {
    "Dyad": {"placement": {"diagram": {"x1": -50, "y1": 570, "x2": 50, "y2": 670}}}
  }
  "Jerk reference vector"
  qddd = [RealInput() for i in 1:nin] {
    "Dyad": {"placement": {"diagram": {"x1": -50, "y1": 770, "x2": 50, "y2": 870}}}
  }
  "Selected position reference"
  s = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 100, "x2": 1050, "y2": 200, "rot": 0}
      },
      "tags": []
    }
  }
  "Selected velocity reference"
  v = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 300, "x2": 1050, "y2": 400, "rot": 0}
      },
      "tags": []
    }
  }
  "Selected acceleration reference"
  a = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 500, "x2": 1050, "y2": 600, "rot": 0}
      },
      "tags": []
    }
  }
  "Selected jerk reference"
  j = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 700, "x2": 1050, "y2": 800, "rot": 0}
      },
      "tags": []
    }
  }
  "Number of axes in the input vectors"
  structural parameter nin::Integer = 1
  "Index of the selected axis"
  structural parameter index::Integer = 1
relations
  s = q[index]
  v = qd[index]
  a = qdd[index]
  j = qddd[index]
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/TrajectorySelector.svg"},
    "labels": [
      {
        "label": "[$(index)]",
        "x": 500,
        "y": 850,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

```dyad
"""
Selects one axis from the vector-valued outputs of a multi-axis trajectory
generator.

Given the position, velocity, acceleration, and jerk reference vectors of an
`nin`-axis trajectory generator, this component picks the entry at `index` from
each and exposes them as scalar references for a single-axis controller. Using
one instance per axis turns the axis-major trajectory outputs into per-axis
reference bundles.
"""
component TrajectorySelector
  "Position reference vector"
  q = [RealInput() for i in 1:nin] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 100, "x2": 50, "y2": 200, "rot": 0}
      },
      "tags": []
    }
  }
  "Velocity reference vector"
  qd = [RealInput() for i in 1:nin] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 300, "x2": 50, "y2": 400, "rot": 0}
      },
      "tags": []
    }
  }
  "Acceleration reference vector"
  qdd = [RealInput() for i in 1:nin] {
    "Dyad": {"placement": {"diagram": {"x1": -50, "y1": 570, "x2": 50, "y2": 670}}}
  }
  "Jerk reference vector"
  qddd = [RealInput() for i in 1:nin] {
    "Dyad": {"placement": {"diagram": {"x1": -50, "y1": 770, "x2": 50, "y2": 870}}}
  }
  "Selected position reference"
  s = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 100, "x2": 1050, "y2": 200, "rot": 0}
      },
      "tags": []
    }
  }
  "Selected velocity reference"
  v = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 300, "x2": 1050, "y2": 400, "rot": 0}
      },
      "tags": []
    }
  }
  "Selected acceleration reference"
  a = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 500, "x2": 1050, "y2": 600, "rot": 0}
      },
      "tags": []
    }
  }
  "Selected jerk reference"
  j = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 700, "x2": 1050, "y2": 800, "rot": 0}
      },
      "tags": []
    }
  }
  "Number of axes in the input vectors"
  structural parameter nin::Integer = 1
  "Index of the selected axis"
  structural parameter index::Integer = 1
relations
  s = q[index]
  v = qd[index]
  a = qdd[index]
  j = qddd[index]
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/TrajectorySelector.svg"},
    "labels": [
      {
        "label": "[$(index)]",
        "x": 500,
        "y": 850,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
