1 from __future__
import print_function, division
3 import matplotlib.pyplot
as plt
6 __all__ = [
"sig_int_handler",
"publish_pose",
"publish_trajectory",
7 "publish_time_indexed_trajectory",
"plot"]
11 raise KeyboardInterrupt
15 problem.get_scene().update(q, t)
16 problem.get_scene().get_kinematic_tree().publish_frames()
21 raise ValueError(
"Trajectory has zero elements")
22 signal.signal(signal.SIGINT, sig_int_handler)
23 print(
'Playing back trajectory ' + str(T) +
's')
24 dt = float(T) / float(len(traj))
30 if t >= len(traj) - 1
and once:
32 t = (t + 1) % len(traj)
33 except KeyboardInterrupt:
39 raise ValueError(
"Trajectory has zero elements")
40 signal.signal(signal.SIGINT, sig_int_handler)
41 print(
'Playing back trajectory ' + str(len(Ts)) +
42 ' states in ' + str(Ts[len(Ts) - 1]))
46 for i
in range(1, len(Ts) - 1):
48 sleep(Ts[i] - Ts[i-1])
51 except KeyboardInterrupt:
56 def plot(solution, labels=None, yscale=None):
57 print(
'Plotting the solution')
58 plt.plot(solution,
'.-')
59 if labels
is not None:
61 if yscale
is not None:
def publish_pose(q, problem, t=0.0)
def publish_trajectory(traj, T, problem, once=False)
def plot(solution, labels=None, yscale=None)
def publish_time_indexed_trajectory(traj, Ts, problem, once=False)
def sig_int_handler(signal, frame)