def plot(self, ax, i, **kwargs_plot): m = self.logs[i] angles = m angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] ax.plot(x, y, 'grey', lw=4, **kwargs_plot) ax.plot(x[0], y[0], 'ok', ms=12, **kwargs_plot) for i in range(len(self.lengths)-1): ax.plot(x[i+1], y[i+1], 'ok', ms=12, **kwargs_plot) ax.plot(x[-1], y[-1], 'or', ms=12, **kwargs_plot)
def plot_step(self, ax, i, **kwargs_plot): m = self.logs[i] angles = m angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] ax.plot(x, y, 'grey', lw=4, **kwargs_plot) ax.plot(x[0], y[0], 'o', color='grey', ms=10, **kwargs_plot) for j in range(len(self.lengths)-1): ax.plot(x[j+1], y[j+1], 'o', color='grey', ms=10, **kwargs_plot) ax.plot(x[-1], y[-1], 'o', color='r', ms=14, markerfacecolor='white', markeredgewidth=4, markeredgecolor="r", **kwargs_plot)
def plot(self, ax, i, **kwargs_plot): m = self.logs[i] angles = np.array(m) angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] l = [] l += ax.plot(x, y, 'grey', lw=4, animated=True, **kwargs_plot) l += ax.plot(x[0], y[0], 'sk', ms=8, animated=True, **kwargs_plot) for i in range(len(self.lengths)-1): l += ax.plot(x[i+1], y[i+1], 'ok', ms=8, animated=True, **kwargs_plot) l += ax.plot(x[-1], y[-1], 'or', ms=8, animated=True, **kwargs_plot) self.lines = l return l
def plot(self, ax, i, **kwargs_plot): m = self.logs[i] angles = m[:-1] angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] ax.plot(x, y, 'grey', lw=4, **kwargs_plot) ax.plot(x[0], y[0], 'ok', ms=12, **kwargs_plot) for i in range(len(self.lengths)-1): ax.plot(x[i+1], y[i+1], 'ok', ms=12, **kwargs_plot) ax.plot(x[-1], y[-1], 'or', ms=4, **kwargs_plot) ax.axis([-1.6, 2.1, -1., 2.1]) # ax.set_xlabel('X') # ax.set_ylabel('Y') self.plot_gripper(ax, x[-1], y[-1], np.cumsum(m[:-1]), m[-1] >= 0., **kwargs_plot)
def plot_update(self, ax, i, **kwargs_plot): if self.lines is None: self.plot(ax, 0, **kwargs_plot) m = self.logs[i] angles = np.array(m) angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] l = [] l += [[x, y]] l += [[x[0], y[0]]] for i in range(len(self.lengths) - 1): l += [[x[i + 1], y[i + 1]]] l += [[x[-1], y[-1]]] for (line, data) in zip(self.lines, l): line.set_data(data[0], data[1]) return self.lines
def plot(self, ax, i, **kwargs_plot): m = self.logs[i] angles = m[:-1] angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] ax.plot(x, y, 'grey', lw=4, **kwargs_plot) ax.plot(x[0], y[0], 'ok', ms=12, **kwargs_plot) for i in range(len(self.lengths) - 1): ax.plot(x[i + 1], y[i + 1], 'ok', ms=12, **kwargs_plot) ax.plot(x[-1], y[-1], 'or', ms=4, **kwargs_plot) ax.axis([-1.6, 2.1, -1., 2.1]) # ax.set_xlabel('X') # ax.set_ylabel('Y') self.plot_gripper(ax, x[-1], y[-1], np.cumsum(m[:-1]), m[-1] >= 0., **kwargs_plot)
def plot_update(self, ax, i, **kwargs_plot): if self.lines is None: self.plot(ax, 0, **kwargs_plot) m = self.logs[i] angles = np.array(m) angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] l = [] l += [[x, y]] l += [[x[0], y[0]]] for i in range(len(self.lengths)-1): l += [[x[i+1], y[i+1]]] l += [[x[-1], y[-1]]] for (line, data) in zip(self.lines, l): line.set_data(data[0], data[1]) return self.lines
def plot(self, ax, i, **kwargs_plot): m = self.logs[i] angles = np.array(m) angles[0] += self.angle_shift x, y = joint_positions(angles, self.lengths, 'std') x, y = [np.hstack((0., a)) for a in x, y] l = [] l += ax.plot(x, y, 'grey', lw=4, animated=True, **kwargs_plot) l += ax.plot(x[0], y[0], 'sk', ms=8, animated=True, **kwargs_plot) for i in range(len(self.lengths) - 1): l += ax.plot(x[i + 1], y[i + 1], 'ok', ms=8, animated=True, **kwargs_plot) l += ax.plot(x[-1], y[-1], 'or', ms=8, animated=True, **kwargs_plot) self.lines = l return l