From a6b0444eb250d4f46114023bd970a3c65feb7dd1 Mon Sep 17 00:00:00 2001 From: pantor Date: Mon, 9 Oct 2023 19:25:23 +0200 Subject: [PATCH] examples properly import plotter --- examples/01_position.py | 7 ++++++- examples/03_waypoints.py | 7 ++++++- examples/04_waypoints_online.py | 7 ++++++- examples/05_velocity.py | 7 ++++++- examples/06_stop.py | 7 ++++++- examples/07_minimum_duration.py | 7 ++++++- examples/08_per_section_minimum_duration.py | 7 ++++++- examples/14_tracking.py | 5 ++++- 8 files changed, 46 insertions(+), 8 deletions(-) diff --git a/examples/01_position.py b/examples/01_position.py index 03641787..3ed25973 100644 --- a/examples/01_position.py +++ b/examples/01_position.py @@ -42,6 +42,11 @@ print(f'Trajectory duration: {first_output.trajectory.duration:0.4f} [s]') # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '1_trajectory.pdf', otg, inp, out_list, plot_jerk=False) + # Plotter.plot_trajectory(project_path / 'examples' / '01_trajectory.pdf', otg, inp, out_list, plot_jerk=False) diff --git a/examples/03_waypoints.py b/examples/03_waypoints.py index 83e08bfc..1d8b71c3 100644 --- a/examples/03_waypoints.py +++ b/examples/03_waypoints.py @@ -51,6 +51,11 @@ print(f'Trajectory duration: {first_output.trajectory.duration:0.4f} [s]') # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '3_trajectory.pdf', otg, inp, out_list, plot_jerk=False) + # Plotter.plot_trajectory(project_path / 'examples' / '03_trajectory.pdf', otg, inp, out_list, plot_jerk=False) diff --git a/examples/04_waypoints_online.py b/examples/04_waypoints_online.py index 8289f4be..07f1f6bc 100644 --- a/examples/04_waypoints_online.py +++ b/examples/04_waypoints_online.py @@ -52,6 +52,11 @@ out.pass_to_input(inp) # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '4_trajectory.pdf', otg, inp, out_list, plot_jerk=False) + # Plotter.plot_trajectory(project_path / 'examples' / '04_trajectory.pdf', otg, inp, out_list, plot_jerk=False) diff --git a/examples/05_velocity.py b/examples/05_velocity.py index fc344a92..27b4a313 100644 --- a/examples/05_velocity.py +++ b/examples/05_velocity.py @@ -42,6 +42,11 @@ print(f'Trajectory duration: {first_output.trajectory.duration:0.4f} [s]') # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '5_trajectory.pdf', otg, inp, out_list, plot_jerk=False) + # Plotter.plot_trajectory(project_path / 'examples' / '05_trajectory.pdf', otg, inp, out_list, plot_jerk=False) diff --git a/examples/06_stop.py b/examples/06_stop.py index 7a160241..519b6c13 100644 --- a/examples/06_stop.py +++ b/examples/06_stop.py @@ -56,6 +56,11 @@ print(f'Trajectory duration: {first_output.trajectory.duration:0.4f} [s]') # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '6_trajectory.pdf', otg, inp, out_list, plot_jerk=False, time_offsets=time_offsets) + # Plotter.plot_trajectory(project_path / 'examples' / '06_trajectory.pdf', otg, inp, out_list, plot_jerk=False, time_offsets=time_offsets) diff --git a/examples/07_minimum_duration.py b/examples/07_minimum_duration.py index 47c8a227..9e37c8a3 100644 --- a/examples/07_minimum_duration.py +++ b/examples/07_minimum_duration.py @@ -45,6 +45,11 @@ print(f'Trajectory duration: {first_output.trajectory.duration:0.4f} [s]') # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '7_trajectory.pdf', otg, inp, out_list, plot_jerk=False) + # Plotter.plot_trajectory(project_path / 'examples' / '07_trajectory.pdf', otg, inp, out_list, plot_jerk=False) diff --git a/examples/08_per_section_minimum_duration.py b/examples/08_per_section_minimum_duration.py index b0364faa..37825c3f 100644 --- a/examples/08_per_section_minimum_duration.py +++ b/examples/08_per_section_minimum_duration.py @@ -56,6 +56,11 @@ print(f'Trajectory duration: {first_output.trajectory.duration:0.4f} [s]') # Plot the trajectory + # from pathlib import Path + # import sys + # project_path = Path(__file__).parent.parent.absolute() + # sys.path.append(str(project_path / 'test')) # For plotter.py + # from plotter import Plotter - # Plotter.plot_trajectory(Path(__file__).parent.absolute() / '8_trajectory.pdf', otg, inp, out_list, plot_jerk=False) + # Plotter.plot_trajectory(project_path / 'examples' / '08_trajectory.pdf', otg, inp, out_list, plot_jerk=False) diff --git a/examples/14_tracking.py b/examples/14_tracking.py index 70adf6f0..f3688f23 100644 --- a/examples/14_tracking.py +++ b/examples/14_tracking.py @@ -66,6 +66,9 @@ def model_sinus(t, ramp_vel=0.4): # Plot the trajectory + # from pathlib import Path + # project_path = Path(__file__).parent.parent.absolute() + # import numpy as np # import matplotlib.pyplot as plt @@ -80,4 +83,4 @@ def model_sinus(t, ramp_vel=0.4): # plt.grid(True) # plt.legend() - # plt.savefig(Path(__file__).parent.absolute() / '13_trajectory.pdf') + # plt.savefig(project_path / 'examples' / '13_trajectory.pdf')