API Reference

Complete API documentation for Mini-UUV control software and ROS2 interfaces

Vehicle Interface

class UUVehicle

Main vehicle control interface for the Mini-UUV system.

from mini_uuv import UUVehicle

# Initialize vehicle connection
vehicle = UUVehicle(port="/dev/ttyUSB0", baudrate=115200)

# Arm the vehicle
vehicle.arm()

# Set control mode
vehicle.set_mode(UUVehicle.MODE_DEPTH_HOLD)

# Command velocity
vehicle.set_velocity(forward=0.5, lateral=0.0, vertical=0.0)

# Get current state
state = vehicle.get_state()
print(f"Depth: {state.depth}m, Heading: {state.heading}°")

Methods

arm() -> bool

Arms the vehicle for operation. Returns True on success.

disarm() -> bool

Disarms the vehicle and stops all thrusters.

set_mode(mode: int) -> bool

Sets the control mode. Available modes: MANUAL, DEPTH_HOLD, HEADING_HOLD, STATION_KEEP.

set_velocity(forward: float, lateral: float, vertical: float) -> None

Commands body-frame velocities in m/s.

Control

class PIDController

from mini_uuv.control import PIDController

# Create depth controller
depth_pid = PIDController(
    kp=2.0, ki=0.5, kd=1.0,
    output_limits=(-1.0, 1.0),
    anti_windup=True
)

# Compute control output
control = depth_pid.update(
    setpoint=target_depth,
    measurement=current_depth,
    dt=0.02
)

class ThrusterAllocator

from mini_uuv.control import ThrusterAllocator

# Initialize with thruster configuration
allocator = ThrusterAllocator(config="vectored_4dof.yaml")

# Compute thruster commands from desired forces
thruster_cmds = allocator.allocate(
    force=[Fx, Fy, Fz],
    torque=[Mx, My, Mz]
)

Sensors

IMU

from mini_uuv.sensors import IMU
imu = IMU(port="/dev/ttyIMU")
data = imu.read()
# data.accel, data.gyro, data.mag

DVL

from mini_uuv.sensors import DVL
dvl = DVL(port="/dev/ttyDVL")
velocity = dvl.get_velocity()
altitude = dvl.get_altitude()

Depth Sensor

from mini_uuv.sensors import DepthSensor
depth = DepthSensor(i2c_addr=0x76)
d = depth.read_depth()
t = depth.read_temperature()

Sonar

from mini_uuv.sensors import Sonar
sonar = Sonar(port="/dev/ttySonar")
ranges, angles = sonar.scan()

ROS2 Topics & Services

Published Topics

Topic Type Rate Description
/uuv/posegeometry_msgs/PoseStamped50 HzVehicle pose
/uuv/velocitygeometry_msgs/TwistStamped50 HzBody velocities
/uuv/imusensor_msgs/Imu100 HzIMU data
/uuv/depthstd_msgs/Float6420 HzDepth measurement
/uuv/batterysensor_msgs/BatteryState1 HzBattery status

Subscribed Topics

Topic Type Description
/uuv/cmd_velgeometry_msgs/TwistVelocity commands
/uuv/depth_setpointstd_msgs/Float64Target depth
/uuv/heading_setpointstd_msgs/Float64Target heading

Services

Service Type Description
/uuv/armstd_srvs/SetBoolArm/disarm vehicle
/uuv/set_modeuuv_msgs/SetModeChange control mode
/uuv/emergency_stopstd_srvs/TriggerEmergency stop