munetauvsim.plotTimeSeries

Visualization functions for AUV simulation data.

Provides plotting functions for time-series analysis and 3D animated visualization of vehicle trajectories, states, controls, and ocean environment. Based on Fossen’s Python Vehicle Simulator plotting utilities.

Functions

plotVehicleStates(simTime, simData, vehId, figNo)

Plot 6-DOF vehicle states (position, attitude, velocities) vs time.

plotControls(simTime, simData, vehicle, figNo)

Plot vehicle control inputs (commanded and actual) vs time.

plot3D(simData, sampleTime, numDataPoints, FPS, filename, vehicles, ocean, …)

Create 3D animated visualization and save as GIF.

Utility Functions

R2D(value)

Convert radians to degrees.

cm2inch(value)

Convert centimeters to inches for figure sizing.

Notes

Default plot parameters (figure size, DPI, legend size) are defined as module-level globals and can be modified before calling plot functions.

References

[1] Fossen, T.I. Python Vehicle Simulator. GitHub repository. https://github.com/cybergalactic/PythonVehicleSimulator

Functions

R2D(value)

Convert radians to degrees.

cm2inch(value)

Convert centimeters to inches for matplotlib figure sizing.

plot3D(simData, sampleTime, numDataPoints, ...)

Create 3D animated visualization of vehicle trajectories and save as GIF.

plotControls(simTime, simData, vehicle, figNo)

Plot vehicle control inputs (commanded and actual) versus time.

plotVehicleStates(simTime, simData, vehId, figNo)

Plot 6-DOF vehicle states (position, attitude, velocities) versus time.

ssa(angle)

Compute the smallest signed angle to range [-pi, pi).

Classes

AnchoredText(s, loc, *[, pad, borderpad, prop])

AnchoredOffsetbox with Text.

Artist()

Abstract base class for objects that render into a FigureCanvas.

NDArray

alias of ndarray[Any, dtype[ScalarType]]

NPFltArr

alias of ndarray[Any, dtype[float64]]

Ocean([size, origin, N, h, name, plume, ...])

Container and manager for ocean environmental components.

Poly3DCollection(verts, *args[, zsort, ...])

A collection of 3D polygons.

Vehicle()

Abstract base class for structural hierarchy of vehicle classes.

munetauvsim.plotTimeSeries.R2D(value)[source]

Convert radians to degrees.

Parameters:

value (float) – Angle in radians.

Returns:

degrees (float) – Angle in degrees.

Return type:

float

munetauvsim.plotTimeSeries.cm2inch(value)[source]

Convert centimeters to inches for matplotlib figure sizing.

Parameters:

value (float) – Length in centimeters.

Returns:

inches (float) – Length in inches.

Return type:

float

munetauvsim.plotTimeSeries.plotVehicleStates(simTime, simData, vehId, figNo)[source]

Plot 6-DOF vehicle states (position, attitude, velocities) versus time.

Creates a multi-subplot figure showing comprehensive vehicle state evolution including position, attitude angles, velocities, and derived quantities like course angle and crab angle.

Parameters:
  • simTime (ndarray, shape (N+1,)) – Time vector in seconds. Includes t=0 initial condition.

  • simData (ndarray, shape (N+1, 18)) – Simulation data for single vehicle: [eta(6), nu(6), u_control(3), u_actual(3)].

  • vehId (int) – Vehicle identification number for plot title.

  • figNo (int) – Figure number for plot window.

Return type:

None

Notes

  • Creates 9 subplots:

    1. Position (path) in North-East plane (x-y plane)

    2. Depth (z) vs time

    3. Roll (phi) and pitch (theta) angles vs time

    4. Speed vs time

    5. Course angle (chi) vs time

    6. Pitch angle (theta) and flight path angle (alpha_c) vs time

    7. Body-frame velocities (surge (u), sway (v), heave (w)) vs time

    8. Angular rates (roll (p), pitch (q), yaw (r)) vs time

    9. Yaw angle (psi) and crab angle (beta_c) vs time

  • All angles displayed in degrees.

  • Uses smallest signed angle (ssa) wrapping.

munetauvsim.plotTimeSeries.plotControls(simTime, simData, vehicle, figNo)[source]

Plot vehicle control inputs (commanded and actual) versus time.

Creates subplots comparing commanded control inputs (u_control) with actual control responses (u_actual) after actuator dynamics and saturation.

Parameters:
  • simTime (ndarray, shape (N+1,)) – Time vector in seconds.

  • simData (ndarray, shape (N+1, 18)) – Simulation data: [eta(6), nu(6), u_control(3), u_actual(3)].

  • vehicle (Vehicle) – Vehicle object. Must have attributes: id, dimU, controls.

  • figNo (int) – Matplotlib figure number.

Notes

  • Number of subplots = vehicle.dimU (number of control inputs). For Remus100s: 3 subplots (rudder, stern plane, propeller).

  • Angles automatically converted to degrees based on control description strings.

  • Each subplot shows commanded (blue) vs actual (orange) control trajectory.

munetauvsim.plotTimeSeries.plot3D(simData, sampleTime, numDataPoints, FPS, filename, vehicles, ocean, figNo=1, showClock=True, showData=True, showTraj=True, showPos=True, showCur=True, showFloor=True)[source]

Create 3D animated visualization of vehicle trajectories and save as GIF.

Generates animated 3D plot showing vehicle motion in East-North-Down frame with optional ocean environment features (current vectors, floor bathymetry, surface). Includes time clock and simulation data display.

Parameters:
  • simData (ndarray, shape (n_vehicles, N+1, 18)) – Simulation data for all vehicles. (n_vehicles, N, [eta, nu, u_control, u_actual])

  • sampleTime (float) – Simulation time step in seconds.

  • numDataPoints (int) – Number of data points to use in plot. Divides simData into numDataPoints samples (downsampling).

  • FPS (int) – Frames per second for GIF animation.

  • filename (str) – Animated GIF file name.

  • vehicles (list of Vehicle) – Vehicle objects in order corresponding to simData.

  • ocean (Ocean) – Ocean environment object with floor and current data.

  • figNo (int, default=1) – Figure number for plot window.

  • showClock (bool, default=True) – Display simulation time clock overlay.

  • showData (bool, default=True) – Display simulation info panel (communication mode, depth range, current).

  • showTraj (bool, default=True) – Plot vehicle trajectory paths as lines.

  • showPos (bool, default=True) – Plot vehicle current positions as points.

  • showCur (bool, default=True) – Display animated ocean current vector field.

  • showFloor (bool, default=True) – Display ocean floor surface (if ocean.floor exists).

Return type:

None

Notes

Performance Considerations:

  • Downsampling via numDataPoints reduces computation time

  • Ocean floor rendering is major performance bottleneck (~2500 grid points default)

  • Animation saving takes ~1-5 minutes depending on numDataPoints and features

Visual Elements:

  • Ocean surface: Transparent blue plane at z=0

  • Current vectors: Blue arrows at fixed grid, updated each frame

  • Floor: Terrain-colored surface with depth-based shading

  • Trajectories: Colored lines, one per vehicle

  • Positions: Moving points along trajectories

  • Waypoints: Triangle markers at target positions

Coordinate System:

END (East-North-Down)

Data Display Box Contents:

  • COM: Communication mode (Direct Access, FDMA, TDMA)

  • DEP: Depth range min-max in meters

  • CUR: Ocean current speed and direction

Animation Function:

  • Uses matplotlib.animation.FuncAnimation with custom frame generation.

  • Each frame updates positions, trajectories, current vectors, and display boxes.