def create_unicycle(self):
        visual.set_viewer(self.scene)
        self.wheel_top = visual.box(color = (0.2, 0.5, 0.5), pos = (0, 1.0, 0), length = 1.6, width = 1.6, height = 0.04)
        self.spring = visual.helix(coils = 8, axis = (0.0, 1.0, 0.0), color = (0.8, 0.2, 0.8), pos = (0.14, 1.0, 0), radius = 0.1, length = 0.5)
        self.car = visual.box(color = (0.2, 0.2, 0.8), pos = (0.0, 1.7, 0.0), length = 0.6, height = 0.4, width = 0.6)
        self.dash_top = visual.cylinder(axis = (0.0, -1.0, 0.0), color = (0.8, 0.8, 0.2), pos = (-0.14, 1.7, 0.0), radius = 0.1, length = 0.3)
        self.dash_bottom = visual.cylinder(axis = (0.0, 1.0, 0.0), color = (0.8, 0.8, 0.2), pos = (-0.14, 1.0, 0.0), radius = 0.05, length = 0.6)

        self.scene.camera.azimuth(45)
        self.scene.camera.elevation(20)
 
        self.recompute_char_eq()
        self.update_chq_data()
        
        self.tdata = self.state_buf[:,0]
        self.ydata = self.state_buf[:,1]

        self._run_fired()
Exemple #2
0
    def test_helix(self):
        # Given/When
        h = visual.helix(pos=(1., 1.,1.))

        # Then
        bounds = get_bounds((1.5, 1.0, 1.0), (1.0, 0.4, 0.4))
        assert_allclose(h.polydata.bounds, bounds, atol=3e-2, rtol=0)

        # Given/When
        h.axis = 0., 1., 0.
        # Then
        bounds = get_bounds((1.0, 1.5, 1.0), (0.4, 1.0, 0.4))
        assert_allclose(h.polydata.bounds, bounds, atol=3e-2, rtol=0)

        # Given/When
        h.axis = 1, 0, 0
        # Then
        bounds = get_bounds((1.5, 1.0, 1.0), (1.0, 0.4, 0.4))
        assert_allclose(h.polydata.bounds, bounds, atol=3e-2, rtol=0)
Exemple #3
0
    def test_helix(self):
        # Given/When
        h = visual.helix(pos=(1., 1.,1.))

        # Then
        bounds = get_bounds((1.5, 1.0, 1.0), (1.0, 0.4, 0.4))
        assert_allclose(h.polydata.bounds, bounds, atol=3e-2, rtol=0)

        # Given/When
        h.axis = 0., 1., 0.
        # Then
        bounds = get_bounds((1.0, 1.5, 1.0), (0.4, 1.0, 0.4))
        assert_allclose(h.polydata.bounds, bounds, atol=3e-2, rtol=0)

        # Given/When
        h.axis = 1, 0, 0
        # Then
        bounds = get_bounds((1.5, 1.0, 1.0), (1.0, 0.4, 0.4))
        assert_allclose(h.polydata.bounds, bounds, atol=3e-2, rtol=0)