Ejemplo n.º 1
0
    def __init__(self, ocp, opts: dict = {}):
        """
        Parameters
        ----------
        ocp: OptimalControlProgram
            A reference to the ocp to show
        opts: dict
            Option to AnimateCallback method of CasADi
        """
        Callback.__init__(self)
        self.ocp = ocp
        self.nx = self.ocp.v.vector.shape[0]
        self.ng = 0
        self.construct("AnimateCallback", opts)

        self.queue = mp.Queue()
        self.plotter = self.ProcessPlotter(self.ocp)
        self.plot_process = mp.Process(target=self.plotter,
                                       args=(self.queue, ),
                                       daemon=True)
        self.plot_process.start()