---
url: /dyad/dev/stdlib/MultibodyComponents/components/Prismatic.md
description: 'Dyad Prismatic docs.  Prismatic joint: translation along a single axis in 3D.'
---

# `Prismatic` {#Prismatic}

Prismatic joint: translation along a single axis in 3D.

The joint allows 1 translational degree-of-freedom along axis `n`. Orientation is rigidly transferred from frame_a to frame_b.

This component extends from [`PartialTwoFrames`](../types/PartialTwoFrames.md) This component extends from [`Renderable`](../types/Renderable.md) This component extends from [`CutJoint`](../types/CutJoint.md)

## Usage {#Usage}

`MultibodyComponents.Prismatic(render=true, color=world_default_prismatic_color(), specular_coefficient=1.5, n=[0, 0, 1], box_width=world_default_joint_width(), box_height=world_default_joint_width())`

## Parameters: {#Parameters:}

|                   Name |                          Description | Units |             Default value |
| ----------------------:| ------------------------------------:| -----:| -------------------------:|
|                `iscut` |                                      |     – |                     false |
|             `residual` |                                      |     – |                  zeros(3) |
|        `statePriority` |                                      |     – |                         3 |
|               `render` |                                      |     – |                      true |
|                `color` |                                      |     – | world_defau...tic_color() |
| `specular_coefficient` |                                      |     – |                       1.5 |
|                    `n` |                       axis of motion |     – |                 \[0, 0, 1] |
|            `box_width` |  Half-width of the box in animations |     – | world_defau...int_width() |
|           `box_height` | Half-height of the box in animations |     – | world_defau...int_width() |

## Connectors {#Connectors}

* `frame_a` - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several `Frame`

connectors that can be connected together ([`Frame3D`](/stdlib/Dyad/connectors/Frame3D#Frame3D))

* `frame_b` - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several `Frame`

connectors that can be connected together ([`Frame3D`](/stdlib/Dyad/connectors/Frame3D#Frame3D))

* `axis` - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. ([`Flange`](/stdlib/Dyad/connectors/Flange#Flange))

* `support` - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. ([`Flange`](/stdlib/Dyad/connectors/Flange#Flange))

## Variables {#Variables}

|    Name |                                       Description | Units |
| -------:| -------------------------------------------------:| -----:|
| `Rleaf` |                                                   |     – |
| `Rroot` |                                                   |     – |
|     `s` |     Relative distance between frame_a and frame_b |     m |
|     `v` |     Relative velocity between frame_a and frame_b |   m/s |
|     `a` | Relative acceleration between frame_a and frame_b |  m/s2 |
|     `f` |        Actuation force in direction of joint axis |     N |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Prismatic joint: translation along a single axis in 3D.

The joint allows 1 translational degree-of-freedom along axis `n`.
Orientation is rigidly transferred from frame_a to frame_b.
"""
component Prismatic
  extends PartialTwoFrames()
  extends Renderable(color = world_default_prismatic_color())
  extends CutJoint()
  axis = Flange() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  support = Flange() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 0}
      },
      "tags": []
    }
  }
  # Visualization shape
  shape = BoxShape(render = render, color = color, r = frame_a.r_0, R = transpose(frame_a.R), length_direction = n, length = s, width = box_width, height = box_height)
  structural parameter statePriority::Integer = 3 # One lower than revolute
  "axis of motion"
  parameter n::Real[3] = [0, 0, 1]
  "Half-width of the box in animations"
  parameter box_width::Real = world_default_joint_width()
  "Half-height of the box in animations"
  parameter box_height::Real = world_default_joint_width()
  "Relative distance between frame_a and frame_b"
  variable s::Length(statePriority = statePriority)
  "Relative velocity between frame_a and frame_b"
  variable v::Velocity(statePriority = statePriority)
  "Relative acceleration between frame_a and frame_b"
  variable a::Acceleration
  "Actuation force in direction of joint axis"
  variable f::Dyad.Force
relations
  # Kinematics
  v = der(s)
  a = der(v)
  # Position: frame_b offset from frame_a along n (resolved to world)
  frame_b.r_0 = frame_a.r_0 + transpose(frame_a.R) * (n * s)
  # Orientation rigidly transferred
  Rleaf = frame_b.R
  Rroot = frame_a.R
  # Force balance
  frame_a.f + frame_b.f = [0, 0, 0]
  # Torque balance (with lever arm from translation)
  frame_a.tau + frame_b.tau + cross(n * s, frame_b.f) = [0, 0, 0]
  # Actuation force along joint axis
  f = -dot(n, frame_b.f)
  # Axisflange: axis drives the joint, support is grounded
  axis.s = s
  axis.f = f
  support.s = 0
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Prismatic.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 280,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

```dyad
"""
Prismatic joint: translation along a single axis in 3D.

The joint allows 1 translational degree-of-freedom along axis `n`.
Orientation is rigidly transferred from frame_a to frame_b.
"""
component Prismatic
  frame_a = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  parameter render::Boolean = true
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  parameter specular_coefficient::Real = 1.5
  structural parameter iscut::Boolean = false
  final structural parameter residual::Real[3] = zeros(3) if iscut
  variable Rleaf::Real[3, 3]
  variable Rroot::Real[3, 3]
  axis = Flange() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  support = Flange() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 0}
      },
      "tags": []
    }
  }
  # Visualization shape
  shape = BoxShape(render = render, color = color, r = frame_a.r_0, R = transpose(frame_a.R), length_direction = n, length = s, width = box_width, height = box_height)
  structural parameter statePriority::Integer = 3 # One lower than revolute
  "axis of motion"
  parameter n::Real[3] = [0, 0, 1]
  "Half-width of the box in animations"
  parameter box_width::Real = world_default_joint_width()
  "Half-height of the box in animations"
  parameter box_height::Real = world_default_joint_width()
  "Relative distance between frame_a and frame_b"
  variable s::Length(statePriority = statePriority)
  "Relative velocity between frame_a and frame_b"
  variable v::Velocity(statePriority = statePriority)
  "Relative acceleration between frame_a and frame_b"
  variable a::Acceleration
  "Actuation force in direction of joint axis"
  variable f::Dyad.Force
relations
  if iscut
    residue(Rleaf, Rroot) = residual
  else
    Rleaf = Rroot
  end
  # Kinematics
  v = der(s)
  a = der(v)
  # Position: frame_b offset from frame_a along n (resolved to world)
  frame_b.r_0 = frame_a.r_0 + transpose(frame_a.R) * (n * s)
  # Orientation rigidly transferred
  Rleaf = frame_b.R
  Rroot = frame_a.R
  # Force balance
  frame_a.f + frame_b.f = [0, 0, 0]
  # Torque balance (with lever arm from translation)
  frame_a.tau + frame_b.tau + cross(n * s, frame_b.f) = [0, 0, 0]
  # Actuation force along joint axis
  f = -dot(n, frame_b.f)
  # Axisflange: axis drives the joint, support is grounded
  axis.s = s
  axis.f = f
  support.s = 0
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Prismatic.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 280,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`ActuatedPrismaticTest`](Prismatic.md)
