def update(self, sp, refs):
        title = [r'$\phi$', r'$\theta$', r'$\psi$']
        legend = ['Ref1', 'Ref2', 'Setpoint']
        for i in range(0, 3):
            axis = self.f.add_subplot(331 + i)
            axis.clear()
            for ref in refs:
                axis.plot(sp.time, pu.deg_of_rad(ref.euler[:, i]))
            axis.plot(sp.time, pu.deg_of_rad(sp.euler[:, i]))
            self.decorate(axis, title[i], *(('deg', legend) if i == 0 else (None, None)))

        title = [r'$p$', r'$q$', r'$r$']
        for i in range(0, 3):
            axis = self.f.add_subplot(334 + i)
            axis.clear()
            for ref in refs:
                axis.plot(sp.time, pu.deg_of_rad(ref.vel[:, i]))
            self.decorate(axis, title[i], 'deg/s' if i == 0 else None)

        title = [r'$\dot{p}$', r'$\dot{q}$', r'$\dot{r}$']
        for i in range(0, 3):
            axis = self.f.add_subplot(337 + i)
            axis.clear()
            for ref in refs:
                axis.plot(sp.time, pu.deg_of_rad(ref.accel[:, i]))
            self.decorate(axis, title[i], 'deg/s2' if i == 0 else None)

        self.canvas.draw()
예제 #2
0
def plot_ref(time, xref=None, sp=None, figure=None):
    margins = (0.05, 0.05, 0.98, 0.96, 0.20, 0.34)
    figure = pu.prepare_fig(figure, window_title='Reference', figsize=(20.48, 10.24), margins=margins)
    plots = [("$\phi$", "deg"), ("$\\theta$", "deg"), ("$\\psi$", "deg"),
             ("$p$", "deg/s"), ("$q$", "deg/s"), ("$r$", "deg/s"),
             ("$\dot{p}$", "deg/s2"), ("$\dot{q}$", "deg/s2"), ("$\dot{r}$", "deg/s2")]
    for i, (title, ylab) in enumerate(plots):
        ax = plt.subplot(3, 3, i + 1)
        if xref is not None: plt.plot(time, pu.deg_of_rad(xref[:, i]))
        pu.decorate(ax, title=title, ylab=ylab)
        if sp is not None and i < 3:
            plt.plot(time, pu.deg_of_rad(sp[:, i]))
    return figure
예제 #3
0
def plot_ref(time, xref=None, sp=None, figure=None):
    margins = (0.05, 0.05, 0.98, 0.96, 0.20, 0.34)
    figure = pu.prepare_fig(figure,
                            window_title='Reference',
                            figsize=(20.48, 10.24),
                            margins=margins)
    plots = [("$\phi$", "deg"), ("$\\theta$", "deg"), ("$\\psi$", "deg"),
             ("$p$", "deg/s"), ("$q$", "deg/s"), ("$r$", "deg/s"),
             ("$\dot{p}$", "deg/s2"), ("$\dot{q}$", "deg/s2"),
             ("$\dot{r}$", "deg/s2")]
    for i, (title, ylab) in enumerate(plots):
        ax = plt.subplot(3, 3, i + 1)
        if xref is not None: plt.plot(time, pu.deg_of_rad(xref[:, i]))
        pu.decorate(ax, title=title, ylab=ylab)
        if sp is not None and i < 3:
            plt.plot(time, pu.deg_of_rad(sp[:, i]))
    return figure
    def register_setpoint(self):
        b = self.gui.b
        c_sp_type = b.get_object("combo_sp_type")
        for n in Setpoint.t_names:
            c_sp_type.append_text(n)
        c_sp_type.set_active(self.sp.type)
        c_sp_type.connect("changed", self.on_sp_changed)

        names = ["spin_sp_duration", "spin_sp_step_duration", "spin_sp_step_amplitude"]
        widgets = [b.get_object(name) for name in names]
        adjs = [Gtk.Adjustment(self.sp.duration, 1, 100, 1, 10, 0),
                Gtk.Adjustment(self.sp.step_duration, 0.1, 10., 0.1, 1., 0),
                Gtk.Adjustment(pu.deg_of_rad(self.sp.step_ampl), 0.1, 180., 1, 10., 0)]
        for i, w in enumerate(widgets):
            w.set_adjustment(adjs[i])
            w.update()
            w.connect("value-changed", self.on_sp_changed)