Skip to content
LIBRARY
PlanarMechanics.OneDOFSlippingWheelSegwayTest.md

PlanarMechanics.OneDOFSlippingWheelSegwayTest

Test for OneDOFSlippingWheelJoint: planar segway model.

Two bodies connected via a FixedTranslation on a slip-based wheel. The heavy body (m=10) acts as a pendulum on the wheel, creating a segway-like motion. Translates the segway test from test_OneDOFWheelJoint.jl.

Usage

MultibodyComponents.PlanarMechanics.OneDOFSlippingWheelSegwayTest()

Behavior

[connect(wheelJoint+framea,translationcm+frame_a,body2+framea)connect(body+framea,translationcm+frame_b)world.frameb.x(t)=0world.frameb.y(t)=0world.frameb.phi(t)=0connect(frameb,framevis+frame_a)world.framevis.phi(t)=world.framevis.frame_a.phi(t)world.framevis.x_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.x_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.x_shape.r_shape(t)=[000]world.framevis.x_shape.length_direction(t)=[100]world.framevis.x_shape.width_direction(t)=[001]world.framevis.x_shape.length(t)=world.framevis.axis_lengthworld.framevis.x_shape.width(t)=2world.framevis.axis_radiusworld.framevis.x_shape.height(t)=2world.framevis.axis_radiusworld.framevis.y_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.y_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.y_shape.r_shape(t)=[000]world.framevis.y_shape.length_direction(t)=[010]world.framevis.y_shape.width_direction(t)=[001]world.framevis.y_shape.length(t)=world.framevis.axis_lengthworld.framevis.y_shape.width(t)=2world.framevis.axis_radiusworld.framevis.y_shape.height(t)=2world.framevis.axis_radiusworld.framevis.z_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.z_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.z_shape.r_shape(t)=[000]world.framevis.z_shape.length_direction(t)=[001]world.framevis.z_shape.width_direction(t)=[100]world.framevis.z_shape.length(t)=world.framevis.axis_lengthworld.framevis.z_shape.width(t)=2world.framevis.axis_radiusworld.framevis.z_shape.height(t)=2world.framevis.axis_radiusbody.r(t)=arrayliteral([2],body.framea.x(t),body.framea.y(t))body.v(t)=dbody.r(t)dtbody.phi(t)=body.framea.phi(t)body.w(t)=dbody.phi(t)dtbody.a(t)=dbody.v(t)dtbody.alpha(t)=dbody.w(t)dtbody.f(t)=arrayliteral([2],body.framea.fx(t),body.framea.fy(t))body.f(t)+arrayliteral([2],body.mgn2d1,body.mgn2d2)=body.mbody.a(t)body.Ibody.alpha(t)=body.framea.tau(t)body.shape.r(t)=arrayliteral([3],body.framea.x(t),body.framea.y(t),body.zposition)body.shape.R(t)=arrayliteral([33],cos(body.phi(t)),sin(body.phi(t)),0,sin(body.phi(t)),cos(body.phi(t)),0,0,0,1)body.shape.rshape(t)=[000]body.shape.lengthdirection(t)=[001]body.shape.widthdirection(t)=[100]body.shape.length(t)=2body.radiusbody.shape.width(t)=2body.radiusbody.shape.height(t)=2body.radiusbody2.r(t)=arrayliteral([2],body2.framea.x(t),body2.framea.y(t))body2.v(t)=dbody2.r(t)dtbody2.phi(t)=body2.framea.phi(t)body2.w(t)=dbody2.phi(t)dtbody2.a(t)=dbody2.v(t)dtbody2.alpha(t)=dbody2.w(t)dtbody2.f(t)=arrayliteral([2],body2.framea.fx(t),body2.framea.fy(t))arrayliteral([2],body2.mgn2d1,body2.mgn2d2)+body2.f(t)=body2.mbody2.a(t)body2.Ibody2.alpha(t)=body2.framea.tau(t)body2.shape.r(t)=arrayliteral([3],body2.framea.x(t),body2.framea.y(t),body2.zposition)body2.shape.R(t)=arrayliteral([33],cos(body2.phi(t)),sin(body2.phi(t)),0,sin(body2.phi(t)),cos(body2.phi(t)),0,0,0,1)body2.shape.rshape(t)=[000]body2.shape.lengthdirection(t)=[001]body2.shape.widthdirection(t)=[100]body2.shape.length(t)=2body2.radiusbody2.shape.width(t)=2body2.radiusbody2.shape.height(t)=2body2.radiustranslationcm.phi(t)=translationcm.frame_a.phi(t)translationcm.w(t)=dtranslationcm.phi(t)dttranslationcm.r0(t)=arrayliteral([22],cos(translationcm.phi(t)),sin(translationcm.phi(t)),sin(translationcm.phi(t)),cos(translationcm.phi(t)))translationcm.rtranslationcm.r0(t)=arrayliteral([2],translationcm.frame_a.x(t)+translationcm.frame_b.x(t),translationcm.frame_b.y(t)translationcm.frame_a.y(t))translationcm.frame_a.phi(t)=translationcm.frame_b.phi(t)translationcm.frame_b.fx(t)+translationcm.frame_a.fx(t)=0translationcm.frame_b.fy(t)+translationcm.frame_a.fy(t)=0translationcm.frame_a.tau(t)+translationcm.frame_b.tau(t)+translationcm.r0_1(t)translationcm.frame_b.fy(t)translationcm.r0_2(t)translationcm.frame_b.fx(t)=0translationcm.shape.r(t)=arrayliteral([3],translationcm.frame_a.x(t),translationcm.frame_a.y(t),translationcm.z_position)translationcm.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)translationcm.shape.r_shape(t)=[000]translationcm.shape.length_direction(t)=arrayliteral([3],translationcm.r0_1(t)translationcm.l,translationcm.r0_2(t)translationcm.l,0)translationcm.shape.width_direction(t)=[001]translationcm.shape.length(t)=translationcm.ltranslationcm.shape.width(t)=2translationcm.radiustranslationcm.shape.height(t)=2translationcm.radiuswheelJoint.x(t)=wheelJoint.framea.x(t)wheelJoint.v(t)=dwheelJoint.x(t)dtwheelJoint.phiroll(t)=wheelJoint.framea.phi(t)wheelJoint.wroll(t)=dwheelJoint.phiroll(t)dtwheelJoint.vslip_long(t)=wheelJoint.v(t)wheelJoint.radiuswheelJoint.wroll(t)wheelJoint.vslip(t)=0.0001+|wheelJoint.vslip_long(t)|wheelJoint.vAdhesion(t)=max(wheelJoint.vAdhesionmin,wheelJoint.sAdhesion|wheelJoint.radiuswheelJoint.wroll(t)|)wheelJoint.vSlide(t)=max(wheelJoint.vSlidemin,wheelJoint.sSlide|wheelJoint.radiuswheelJoint.wroll(t)|)wheelJoint.f(t)=limitS_triple(wheelJoint.vAdhesion(t),wheelJoint.vSlide(t),wheelJoint.muA,wheelJoint.muS,wheelJoint.vslip(t))wheelJoint.fn(t)wheelJoint.flong(t)=wheelJoint.f(t)wheelJoint.vslip_long(t)wheelJoint.vslip(t)wheelJoint.framea.fx(t)=wheelJoint.flong(t)wheelJoint.framea.fy(t)=wheelJoint.fn(t)wheelJoint.framea.tau(t)=wheelJoint.radiuswheelJoint.flong(t)wheelJoint.framea.y(t)=wheelJoint.radiuswheelJoint.tireshape.r(t)=arrayliteral([3],wheelJoint.framea.x(t),wheelJoint.framea.y(t),wheelJoint.zposition)wheelJoint.tireshape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)wheelJoint.tireshape.r_shape(t)=arrayliteral([3],0,0,12wheelJoint.wheelwidth)wheelJoint.tireshape.length_direction(t)=[001]wheelJoint.tireshape.width_direction(t)=[010]wheelJoint.tireshape.length(t)=wheelJoint.wheelwidthwheelJoint.tireshape.width(t)=2wheelJoint.radiuswheelJoint.tireshape.height(t)=2wheelJoint.radiuswheelJoint.rim1shape.r(t)=arrayliteral([3],wheelJoint.framea.x(t),wheelJoint.framea.y(t),wheelJoint.zposition)wheelJoint.rim1shape.R(t)=arrayliteral([33],cos(wheelJoint.phiroll(t)),sin(wheelJoint.phiroll(t)),0,sin(wheelJoint.phiroll(t)),cos(wheelJoint.phiroll(t)),0,0,0,1)wheelJoint.rim1shape.r_shape(t)=arrayliteral([3],wheelJoint.radius,0,0)wheelJoint.rim1shape.length_direction(t)=[100]wheelJoint.rim1shape.width_direction(t)=[010]wheelJoint.rim1shape.length(t)=2wheelJoint.radiuswheelJoint.rim1shape.width(t)=wheelJoint.rimdiameterwheelJoint.rim1shape.height(t)=wheelJoint.rimdiameterwheelJoint.rim2shape.r(t)=arrayliteral([3],wheelJoint.framea.x(t),wheelJoint.framea.y(t),wheelJoint.zposition)wheelJoint.rim2shape.R(t)=arrayliteral([33],cos(1.570796326794895+wheelJoint.phiroll(t)),sin(1.570796326794895+wheelJoint.phiroll(t)),0,sin(1.570796326794895+wheelJoint.phiroll(t)),cos(1.570796326794895+wheelJoint.phiroll(t)),0,0,0,1)wheelJoint.rim2shape.r_shape(t)=arrayliteral([3],wheelJoint.radius,0,0)wheelJoint.rim2shape.length_direction(t)=[100]wheelJoint.rim2shape.width_direction(t)=[010]wheelJoint.rim2shape.length(t)=2wheelJoint.radiuswheelJoint.rim2shape.width(t)=wheelJoint.rimdiameterwheelJoint.rim2shape.height(t)=wheelJoint.rimdiameter]

Source

dyad
"""
Test for OneDOFSlippingWheelJoint: planar segway model.

Two bodies connected via a FixedTranslation on a slip-based wheel. The heavy body
(m=10) acts as a pendulum on the wheel, creating a segway-like motion.
Translates the segway test from test_OneDOFWheelJoint.jl.
"""
test component OneDOFSlippingWheelSegwayTest
  world = World(g = 9.82) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 40, "y1": 710, "x2": 140, "y2": 810, "rot": 0}
      },
      "tags": []
    }
  }
  body = Body(m = 0.7, I = 0.0001, radius = 0.3) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 560, "y1": 80, "x2": 760, "y2": 280, "rot": 0}
      },
      "tags": []
    }
  }
  body2 = Body(I = 0.001, radius = 0.2, m = 0.4) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 560, "y1": 420, "x2": 760, "y2": 620, "rot": 0}
      },
      "tags": []
    }
  }
  translation_cm = FixedTranslation(r = [2, 0], color = [0.5, 0.5, 0.5, 0.5]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 230, "y1": 260, "x2": 430, "y2": 460, "rot": 270}
      },
      "tags": []
    }
  }
  wheelJoint = OneDOFSlippingWheelJoint(radius = 1, mu_A = 1, mu_S = 0.7, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 230, "y1": 620, "x2": 430, "y2": 820, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body.phi = 0.0
  initial body.w = 0.0
  initial wheelJoint.x = 0.0
  initial wheelJoint.v = 0.0
  connect(wheelJoint.frame_a, translation_cm.frame_a, body2.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [], "E": -1}
      ],
      "junctions": [{"x": 330, "y": 520}],
      "renderStyle": "standard"
    }
  }
  connect(body.frame_a, translation_cm.frame_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 330, "y": 180}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {"Dyad": {"tests": {"case1": {"stop": 50}}}}
end
Flattened Source
dyad
"""
Test for OneDOFSlippingWheelJoint: planar segway model.

Two bodies connected via a FixedTranslation on a slip-based wheel. The heavy body
(m=10) acts as a pendulum on the wheel, creating a segway-like motion.
Translates the segway test from test_OneDOFWheelJoint.jl.
"""
test component OneDOFSlippingWheelSegwayTest
  world = World(g = 9.82) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 40, "y1": 710, "x2": 140, "y2": 810, "rot": 0}
      },
      "tags": []
    }
  }
  body = Body(m = 0.7, I = 0.0001, radius = 0.3) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 560, "y1": 80, "x2": 760, "y2": 280, "rot": 0}
      },
      "tags": []
    }
  }
  body2 = Body(I = 0.001, radius = 0.2, m = 0.4) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 560, "y1": 420, "x2": 760, "y2": 620, "rot": 0}
      },
      "tags": []
    }
  }
  translation_cm = FixedTranslation(r = [2, 0], color = [0.5, 0.5, 0.5, 0.5]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 230, "y1": 260, "x2": 430, "y2": 460, "rot": 270}
      },
      "tags": []
    }
  }
  wheelJoint = OneDOFSlippingWheelJoint(radius = 1, mu_A = 1, mu_S = 0.7, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 230, "y1": 620, "x2": 430, "y2": 820, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body.phi = 0.0
  initial body.w = 0.0
  initial wheelJoint.x = 0.0
  initial wheelJoint.v = 0.0
  connect(wheelJoint.frame_a, translation_cm.frame_a, body2.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [], "E": -1}
      ],
      "junctions": [{"x": 330, "y": 520}],
      "renderStyle": "standard"
    }
  }
  connect(body.frame_a, translation_cm.frame_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 330, "y": 180}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {"Dyad": {"tests": {"case1": {"stop": 50}}}}
end


Test Cases

Test Case case1