def test_has_gyroscopic_forces_when_spinning(self):
        # When the body is spinning, a torque should cause a
        # perpendicular acceleration

        # Set up rigid body spinning about x axis, and precessing about z axis
        precession = 0.1
        spin = 27.3
        A = 2.4  # perpendicular inertia
        C = 5.7  # polar inertia

        b = RigidBody('body', mass=7.04, inertia=diag([A, A, C]))
        b.Rp[:, :] = rotmat_y(pi / 2)
        b.vp[3:] = [spin, 0, precession]
        update_skewmat(b.wps, b.vp[3:])
        b.calc_mass()

        # Expect moment of momentum to be [C*spin, 0, A*precession] in global
        Jp = dot(b.Rp, dot(b.inertia, b.Rp.T))
        hp = dot(Jp, b.vp[3:])
        assert_array_almost_equal(hp, [C * spin, 0, A * precession])

        # Expect the torque to be (precession * spin_speed) * (C - A)
        # about the y axis
        expected_Q2 = spin * precession * (C - A)
        assert_array_almost_equal(b.quad_forces, [0, 0, 0, 0, expected_Q2, 0])
    def test_has_gyroscopic_forces_when_spinning(self):
        # When the body is spinning, a torque should cause a
        # perpendicular acceleration

        # Set up rigid body spinning about x axis, and precessing about z axis
        precession = 0.1
        spin = 27.3
        A = 2.4  # perpendicular inertia
        C = 5.7  # polar inertia

        b = RigidBody("body", mass=7.04, inertia=diag([A, A, C]))
        b.Rp[:, :] = rotmat_y(pi / 2)
        b.vp[3:] = [spin, 0, precession]
        update_skewmat(b.wps, b.vp[3:])
        b.calc_mass()

        # Expect moment of momentum to be [C*spin, 0, A*precession] in global
        Jp = dot(b.Rp, dot(b.inertia, b.Rp.T))
        hp = dot(Jp, b.vp[3:])
        assert_array_almost_equal(hp, [C * spin, 0, A * precession])

        # Expect the torque to be (precession * spin_speed) * (C - A)
        # about the y axis
        expected_Q2 = spin * precession * (C - A)
        assert_array_almost_equal(b.quad_forces, [0, 0, 0, 0, expected_Q2, 0])
示例#3
0
    def test_gyroscopic_acceleration(self):
        """When the body is spinning, a torque should cause a perpendicular
        acceleration"""

        from nose import SkipTest
        raise SkipTest

        # Set up rigid body spinning about x axis, and precessing about z axis
        precession = 0.1
        spin = 27.3
        length = 3.5
        radius = 1.2
        mass = 6.54

        # Calculate inertias
        A = mass * (3 * radius**2 +
                    2 * length**2) / 12  # perpendicular inertia
        C = mass * radius**2 / 2  # polar inertia

        # Make a uniform beam representing a gyroscope spinning around
        # the beam's axis
        b = UniformBeam('beam',
                        length=length,
                        density=mass / length,
                        Jx=C,
                        EA=1,
                        EIy=1,
                        EIz=1)  # these don't matter
        b.vp[3:] = [spin, 0, precession]
        update_skewmat(b.wps, b.vp[3:])
        b.calc_mass()

        # Expect moment of momentum to be [C*spin, 0, A*precession] in global
        Jp = dot(b.Rp, dot(diag([C, A, A]), b.Rp.T))
        hp = dot(Jp, b.vp[3:])
        assert_array_almost_equal(hp, [C * spin, 0, A * precession])

        # Expect the torque to be (precession * spin_speed) * (C - A)
        # about the y axis
        expected_Q2 = spin * precession * (C - A)
        Q2_at_centre = b.quad_forces[4] + b.quad_forces[10] + \
                       (length/2)*(b.quad_forces[2] - b.quad_forces[8])
        #assert_array_almost_equal(b.quad_forces, [0, 0, 0, 0, expected_Q2, 0])
        assert_array_almost_equal(Q2_at_centre, expected_Q2)
示例#4
0
    def test_gyroscopic_acceleration(self):
        """When the body is spinning, a torque should cause a perpendicular
        acceleration"""

        from nose import SkipTest
        raise SkipTest

        # Set up rigid body spinning about x axis, and precessing about z axis
        precession = 0.1
        spin = 27.3
        length = 3.5
        radius = 1.2
        mass = 6.54

        # Calculate inertias
        A = mass * (3*radius**2 + 2*length**2) / 12     # perpendicular inertia
        C = mass * radius**2 / 2                        # polar inertia

        # Make a uniform beam representing a gyroscope spinning around
        # the beam's axis
        b = UniformBeam('beam', length=length, density=mass/length, Jx=C,
                        EA=1, EIy=1, EIz=1)  # these don't matter
        b.vp[3:] = [spin, 0, precession]
        update_skewmat(b.wps, b.vp[3:])
        b.calc_mass()

        # Expect moment of momentum to be [C*spin, 0, A*precession] in global
        Jp = dot(b.Rp, dot(diag([C, A, A]), b.Rp.T))
        hp = dot(Jp, b.vp[3:])
        assert_array_almost_equal(hp, [C*spin, 0, A*precession])

        # Expect the torque to be (precession * spin_speed) * (C - A)
        # about the y axis
        expected_Q2 = spin * precession * (C - A)
        Q2_at_centre = b.quad_forces[4] + b.quad_forces[10] + \
                       (length/2)*(b.quad_forces[2] - b.quad_forces[8])
        #assert_array_almost_equal(b.quad_forces, [0, 0, 0, 0, expected_Q2, 0])
        assert_array_almost_equal(Q2_at_centre, expected_Q2)
示例#5
0
 def test_update_skew(self):
     x = zeros((3, 3))
     for v in ([0, 0, 0], [1, 2, 3]):
         update_skewmat(x, v)
         assert_array_equal(x, skewmat(v))
示例#6
0
 def test_update_skew(self):
     x = zeros((3, 3))
     for v in ([0, 0, 0], [1, 2, 3]):
         update_skewmat(x, v)
         assert_array_equal(x, skewmat(v))