TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Velocity3D Class Reference

Represents a 3D speed or velocity vector with unit support. More...

#include <Velocity3D.h>

Public Member Functions

 Velocity3D (float x, float y, float z, VelocityUnit unit)
 
float getX (VelocityUnit desiredUnit) const
 
float getY (VelocityUnit desiredUnit) const
 
float getZ (VelocityUnit desiredUnit) const
 

Public Attributes

float x = 0.0f
 
float y = 0.0f
 
float z = 0.0f
 
VelocityUnit unit = VelocityUnit::MPS
 

Detailed Description

Represents a 3D speed or velocity vector with unit support.

This class encapsulates a 3D speed (or velocity) measurement, storing x, y, and z components along with a unit (meters per second, kilometers per hour, feet per second, or miles per hour). It provides methods to retrieve each component in any supported unit, handling conversion as needed.

Speed3D is useful for robotics, navigation, and simulation applications where 3D motion must be represented and manipulated in a type-safe and unit-aware manner. It is compatible with the Speed class for 1D speed and can be used interchangeably with Velocity3D.

Example usage:

Velocity3D v(1.0, 0.0, 0.0, SpeedUnit::MPS); // 1 m/s along x
float vx_kph = v.getX(SpeedUnit::KPH); // Convert x component to km/h
Represents a 3D speed or velocity vector with unit support.
Definition: Velocity3D.h:32

The documentation for this class was generated from the following file: