---
url: /dyad/dev/stdlib/MultibodyComponents/components/Universal.md
description: >-
  Dyad Universal docs.  Universal joint: two revolute joints in series with
  perpendicular axes.
---

# `Universal` {#Universal}

Universal joint: two revolute joints in series with perpendicular axes.

`frame_a` rotates around axis `n_a` (fixed in `frame_a`), then `frame_b` rotates around axis `n_b` (fixed in `frame_b`). The frames coincide when both angles are zero.

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

## Usage {#Usage}

`MultibodyComponents.Universal(render=true, color=world_default_joint_color(), specular_coefficient=1.5, n_a=[1, 0, 0], n_b=[0, 1, 0], radius=world_default_joint_width() / 2, cylinder_length=world_default_joint_length())`

## Parameters: {#Parameters:}

|                   Name |                                               Description | Units |             Default value |
| ----------------------:| ---------------------------------------------------------:| -----:| -------------------------:|
|               `rooted` |                                                           |     – | MultibodyCo...me.FrameA() |
|        `statePriority` |                                                           |     – |                        10 |
|               `render` |                                                           |     – |                      true |
|                `color` |                                                           |     – | world_defau...int_color() |
| `specular_coefficient` |                                                           |     – |                       1.5 |
|                  `n_a` | Axis of rotation of revolute joint a, resolved in frame_a |     – |                 \[1, 0, 0] |
|                  `n_b` | Axis of rotation of revolute joint b, resolved in frame_b |     – |                 \[0, 1, 0] |
|               `radius` |            Radius of the revolute cylinders in animations |     – | world_defau...width() / 2 |
|      `cylinder_length` |            Length of the revolute cylinders in animations |     – | world_defau...nt_length() |

## 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))

## Variables {#Variables}

|    Name |                              Description |  Units |
| -------:| ----------------------------------------:| ------:|
| `phi_a` |                Angle of revolute joint a |    rad |
| `phi_b` |                Angle of revolute joint b |    rad |
|   `w_a` |     Angular velocity of revolute joint a |  rad/s |
|   `w_b` |     Angular velocity of revolute joint b |  rad/s |
|   `a_a` | Angular acceleration of revolute joint a | rad/s2 |
|   `a_b` | Angular acceleration of revolute joint b | rad/s2 |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Universal joint: two revolute joints in series with perpendicular axes.

`frame_a` rotates around axis `n_a` (fixed in `frame_a`), then
`frame_b` rotates around axis `n_b` (fixed in `frame_b`).
The frames coincide when both angles are zero.
"""
component Universal
  extends PartialTwoFrames()
  extends Renderable(color = world_default_joint_color())
  revolute_a = Revolute(final n = n_a, rooted = rooted, render = render, color = color, radius = radius, cylinder_length = cylinder_length)
  revolute_b = Revolute(final n = n_b, rooted = rooted, render = render, color = color, radius = radius, cylinder_length = cylinder_length)
  structural parameter rooted::RootedFrame = MultibodyComponents.RootedFrame.FrameA()
  structural parameter statePriority::Integer = 10
  "Axis of rotation of revolute joint a, resolved in frame_a"
  parameter n_a::Real[3] = [1, 0, 0]
  "Axis of rotation of revolute joint b, resolved in frame_b"
  parameter n_b::Real[3] = [0, 1, 0]
  "Radius of the revolute cylinders in animations"
  parameter radius::Real = world_default_joint_width() / 2
  "Length of the revolute cylinders in animations"
  parameter cylinder_length::Real = world_default_joint_length()
  "Angle of revolute joint a"
  variable phi_a::Angle(statePriority = statePriority)
  "Angle of revolute joint b"
  variable phi_b::Angle(statePriority = statePriority)
  "Angular velocity of revolute joint a"
  variable w_a::AngularVelocity(statePriority = statePriority)
  "Angular velocity of revolute joint b"
  variable w_b::AngularVelocity(statePriority = statePriority)
  "Angular acceleration of revolute joint a"
  variable a_a::AngularAcceleration
  "Angular acceleration of revolute joint b"
  variable a_b::AngularAcceleration
relations
  phi_a = revolute_a.phi
  phi_b = revolute_b.phi
  w_a = der(phi_a)
  w_b = der(phi_b)
  a_a = der(w_a)
  a_b = der(w_b)
  connect(frame_a, revolute_a.frame_a)
  connect(revolute_a.frame_b, revolute_b.frame_a)
  connect(revolute_b.frame_b, frame_b)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Universal.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 240,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

```dyad
"""
Universal joint: two revolute joints in series with perpendicular axes.

`frame_a` rotates around axis `n_a` (fixed in `frame_a`), then
`frame_b` rotates around axis `n_b` (fixed in `frame_b`).
The frames coincide when both angles are zero.
"""
component Universal
  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
  revolute_a = Revolute(final n = n_a, rooted = rooted, render = render, color = color, radius = radius, cylinder_length = cylinder_length)
  revolute_b = Revolute(final n = n_b, rooted = rooted, render = render, color = color, radius = radius, cylinder_length = cylinder_length)
  structural parameter rooted::RootedFrame = MultibodyComponents.RootedFrame.FrameA()
  structural parameter statePriority::Integer = 10
  "Axis of rotation of revolute joint a, resolved in frame_a"
  parameter n_a::Real[3] = [1, 0, 0]
  "Axis of rotation of revolute joint b, resolved in frame_b"
  parameter n_b::Real[3] = [0, 1, 0]
  "Radius of the revolute cylinders in animations"
  parameter radius::Real = world_default_joint_width() / 2
  "Length of the revolute cylinders in animations"
  parameter cylinder_length::Real = world_default_joint_length()
  "Angle of revolute joint a"
  variable phi_a::Angle(statePriority = statePriority)
  "Angle of revolute joint b"
  variable phi_b::Angle(statePriority = statePriority)
  "Angular velocity of revolute joint a"
  variable w_a::AngularVelocity(statePriority = statePriority)
  "Angular velocity of revolute joint b"
  variable w_b::AngularVelocity(statePriority = statePriority)
  "Angular acceleration of revolute joint a"
  variable a_a::AngularAcceleration
  "Angular acceleration of revolute joint b"
  variable a_b::AngularAcceleration
relations
  phi_a = revolute_a.phi
  phi_b = revolute_b.phi
  w_a = der(phi_a)
  w_b = der(phi_b)
  a_a = der(w_a)
  a_b = der(w_b)
  connect(frame_a, revolute_a.frame_a)
  connect(revolute_a.frame_b, revolute_b.frame_a)
  connect(revolute_b.frame_b, frame_b)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Universal.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 240,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
