---
url: /dyad/stable/stdlib/MultibodyComponents/components/PlanarMechanics.Revolute.md
description: >-
  Dyad PlanarMechanics.Revolute docs.  Revolute joint: allows rotation about the
  z-axis while rigidly connecting positions.
---

# `PlanarMechanics.Revolute` {#PlanarMechanics.Revolute}

Revolute joint: allows rotation about the z-axis while rigidly connecting positions.

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

## Usage {#Usage}

`MultibodyComponents.PlanarMechanics.Revolute(render=true, color=MultibodyComponents.world_default_joint_color(), specular_coefficient=1.5, radius=MultibodyComponents.world_default_joint_width(), cylinder_length=MultibodyComponents.world_default_joint_length(), z_position=0)`

## Parameters: {#Parameters:}

|                   Name |                                              Description | Units |             Default value |
| ----------------------:| --------------------------------------------------------:| -----:| -------------------------:|
|        `statePriority` |                                                          |     – |                        10 |
|               `render` |                                                          |     – |                      true |
|                `color` |                                                          |     – | MultibodyCo...int_color() |
| `specular_coefficient` |                                                          |     – |                       1.5 |
|               `radius` |            Radius of the revolute cylinder in animations |     – | MultibodyCo...int_width() |
|      `cylinder_length` |            Length of the revolute cylinder in animations |     – | MultibodyCo...nt_length() |
|           `z_position` | z-position of the revolute cylinder center in animations |     – |                         0 |

## Connectors {#Connectors}

* `frame_a` - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. ([`Frame2D`](/stdlib/Dyad/connectors/Frame2D#Frame2D))

* `frame_b` - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. ([`Frame2D`](/stdlib/Dyad/connectors/Frame2D#Frame2D))

* `flange_a` - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. ([`Spline`](/stdlib/Dyad/connectors/Spline#Spline))

## Variables {#Variables}

|    Name |                                     Description |  Units |
| -------:| -----------------------------------------------:| ------:|
|   `phi` | Relative rotation angle from frame_a to frame_b |    rad |
|     `w` |                                angular velocity |  rad/s |
| `alpha` |                            angular acceleration | rad/s2 |
|   `tau` |                                          torque |    N.m |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"Revolute joint: allows rotation about the z-axis while rigidly connecting positions."
component Revolute
  extends PartialTwoFrames
  extends MultibodyComponents.Renderable(color = MultibodyComponents.world_default_joint_color())
  structural parameter statePriority::Integer = 10
  flange_a = Spline() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 450, "x2": 550, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Visualization shape for the revolute cylinder"
  shape = MultibodyComponents.CylinderShape(render = render, color = color, r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, frame_a.phi)), r_shape = [0, 0, -cylinder_length / 2], length_direction = [0, 0, 1], width_direction = [1, 0, 0], length = cylinder_length, width = 2 * radius, height = 2 * radius)
  "Radius of the revolute cylinder in animations"
  parameter radius::Real = MultibodyComponents.world_default_joint_width()
  "Length of the revolute cylinder in animations"
  parameter cylinder_length::Real = MultibodyComponents.world_default_joint_length()
  "z-position of the revolute cylinder center in animations"
  parameter z_position::Real = 0
  "Relative rotation angle from frame_a to frame_b"
  variable phi::Angle(statePriority = statePriority)
  "angular velocity"
  variable w::AngularVelocity(statePriority = statePriority)
  "angular acceleration"
  variable alpha::AngularAcceleration
  "torque"
  variable tau::Torque
relations
  w = der(phi)
  alpha = der(w)
  # rigidly connect positions
  frame_a.x = frame_b.x
  frame_a.y = frame_b.y
  # rotation constraint
  frame_a.phi + phi = frame_b.phi
  # balance forces
  frame_a.fx + frame_b.fx = 0
  frame_a.fy + frame_b.fy = 0
  # balance torques
  frame_a.tau + frame_b.tau = 0
  frame_a.tau = tau
  flange_a.phi = phi
  flange_a.tau = tau
  # set shape position and orientation (2D lifted to 3D)
  #shape.r = [frame_a.x, frame_a.y, z_position]
  #shape.R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, frame_a.phi))
  #shape.r_shape = [0, 0, -cylinder_length / 2]
  #shape.length_direction = [0, 0, 1]
  #shape.width_direction = [1, 0, 0]
  #shape.length = cylinder_length
  #shape.width = 2 * radius
  #shape.height = 2 * radius
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Revolute.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 150,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

```dyad
"Revolute joint: allows rotation about the z-axis while rigidly connecting positions."
component Revolute
  frame_a = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": 150, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_b = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 850, "y1": 450, "x2": 950, "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 statePriority::Integer = 10
  flange_a = Spline() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 450, "x2": 550, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Visualization shape for the revolute cylinder"
  shape = MultibodyComponents.CylinderShape(render = render, color = color, r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, frame_a.phi)), r_shape = [0, 0, -cylinder_length / 2], length_direction = [0, 0, 1], width_direction = [1, 0, 0], length = cylinder_length, width = 2 * radius, height = 2 * radius)
  "Radius of the revolute cylinder in animations"
  parameter radius::Real = MultibodyComponents.world_default_joint_width()
  "Length of the revolute cylinder in animations"
  parameter cylinder_length::Real = MultibodyComponents.world_default_joint_length()
  "z-position of the revolute cylinder center in animations"
  parameter z_position::Real = 0
  "Relative rotation angle from frame_a to frame_b"
  variable phi::Angle(statePriority = statePriority)
  "angular velocity"
  variable w::AngularVelocity(statePriority = statePriority)
  "angular acceleration"
  variable alpha::AngularAcceleration
  "torque"
  variable tau::Torque
relations
  w = der(phi)
  alpha = der(w)
  # rigidly connect positions
  frame_a.x = frame_b.x
  frame_a.y = frame_b.y
  # rotation constraint
  frame_a.phi + phi = frame_b.phi
  # balance forces
  frame_a.fx + frame_b.fx = 0
  frame_a.fy + frame_b.fy = 0
  # balance torques
  frame_a.tau + frame_b.tau = 0
  frame_a.tau = tau
  flange_a.phi = phi
  flange_a.tau = tau
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Revolute.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 150,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`BodyShapePendulumTest`](PlanarMechanics.Revolute.md)

  * [`CentrifugalTest`](PlanarMechanics.Revolute.md)

  * [`CutForceTest`](PlanarMechanics.Revolute.md)

  * [`CutTorqueTest`](PlanarMechanics.Revolute.md)

  * [`PlanarToMultiBodyPendulumTest`](PlanarMechanics.Revolute.md)

  * [`RelativeForceTest`](PlanarMechanics.Revolute.md)

  * [`WorldForceTest`](PlanarMechanics.Revolute.md)
