DOI: 10.5281/zenodo.16309247
title: Time-Optimal Trajectory Planning for Anti-Sloshing Robotic Manipulation of Multiple Liquid-Filled Containers

description: This MATLAB script is used to load and visualize the trajectory data.It allows the user to compare optimized and non-optimized trajectories.The script generates plots for both Cartesian space and joint space,and includes sloshing simulation and experimental results.The data correspond to the paper entitled 'Time-Optimal Trajectory Planningfor Anti-Sloshing Robotic Manipulation of Multiple Liquid-Filled Containers'.

HOW TO USE:-----------1. Open the file "generate_plots.m" in MATLAB.

2. At the top of the script, in the section marked "CONFIGURATION", set the two parameters:      trajectory = "1A";      % Choose between: "1A", "2A", "1B", "2B"   motionLaw  = "OPT";     % Choose between: "OPT" (optimized), "NOPT" (non-optimized)

   NOTE: The "NOPT" (non-optimized) motion law is only available for trajectories "1A" and "2A".         If you select "1B" or "2B" with "NOPT", the script will show an error and stop.

3. Run the script. It will automatically:   - Load the correct .csv files based on your selection   - Plot the following:     - Cartesian position, velocity, and acceleration of the point O' of the tray     - Orientation angles, angular velocity, and angular acceleration of the tray about the x', y' and z' axes     - Robot joint positions and velocities     - Sloshing height (both model and experimental)

CSV FILES:----------The script reads the following CSV files (from the "CSV_files" folder):

1. <trajectory>_<suffix>_cartesian_trajectory.csv

   Note: "suffix" is a keyword automatically set by the script depending on the selected motion law (motionLaw).         - If motionLaw = "OPT", then suffix = "optimized"         - If motionLaw = "NOPT", then suffix = "nonoptimized"

   Example: 1A_optimized_cartesian_trajectory.csv

   Columns:   [1]  Time [s]   [2]  r_x tray position [m]   [3]  r_y tray position [m]   [4]  r_z tray position [m]   [5]  θx orientation [rad]   [6]  θy orientation [rad]   [7]  θz orientation [rad]   [8]  \dot{r}_x tray velocity [m/s]   [9]  \dot{r}_y tray velocity [m/s]   [10] \dot{r}_z tray velocity [m/s]   [11] ωx angular velocity [rad/s]   [12] ωy angular velocity [rad/s]   [13] ωz angular velocity [rad/s]   [14] \ddot{r}_x tray acceleration [m/s²]   [15] \ddot{r}_y tray acceleration [m/s²]   [16] \ddot{r}_z tray acceleration [m/s²]   [17] αx angular acceleration [rad/s²]   [18] αy angular acceleration [rad/s²]   [19] αz angular acceleration [rad/s²]

2. <trajectory>_<suffix>_joint_trajectory.csv

   Columns:   [1]  Time [s]   [2–7]  Robot joint positions  q_i (i = 1,...,6) [rad]   [8–13] Robot joint velocities \dot{q}_i (i = 1,...,6) [rad/s]

3. Sloshing data:   - <trajectory>_<suffix>_SH_model_IC.csv   - <trajectory>_<suffix>_SH_model_EC.csv   - <trajectory>_<suffix>_SH_exp_IC.csv   - <trajectory>_<suffix>_SH_exp_EC.csv

   Each file contains two columns:   [1] Time [s]   [2] Sloshing height η [mm]

OUTPUT:-------The script generates 3 figures:

Figure 1: Trajectory plots  - 3D trajectory   - Linear and angular velocities and accelerations along the three axes  - Orientation angles, angular velocities and angular accelerations

Figure 2: Joint space plots  - Joint positions q_i (i = 1,...,6)  - Joint velocities \dot{q}_i (i = 1,...,6)

Figure 3: Sloshing heights  - Model and experimental trends for IC and EC containers

CORRESPONDENCE WITH PAPER FIGURES:----------------------------------

3D TRAJECTORY PLOTS (Figure 1 - subplot "3D Trajectory"):- 1A OPT/NOPT → Blue path in Figure 6a- 1B OPT      → Red path in Figure 6a- 2A OPT/NOPT → Blue path in Figure 6b- 2B OPT      → Red path in Figure 6b

SLOSHING HEIGHT PLOTS (Figure 3):- 1A OPT  → Figure 7a- 1A NOPT → Figure 7b- 1B OPT  → Figure 7c- 2A OPT  → Figure 8a- 2A NOPT → Figure 8b- 2B OPT  → Figure 8c