TinyRobotics
Loading...
Searching...
No Matches
MotionState3D.h
1#pragma once
2#include "TinyRobotics/coordinates/Coordinate.h"
3#include "TinyRobotics/coordinates/Orientation3D.h"
4#include "TinyRobotics/units/AngularVelocity.h"
5#include "TinyRobotics/units/Distance.h"
6#include "TinyRobotics/units/Speed.h"
7
8namespace tinyrobotics {
9
10/**
11 * @struct Delta3D
12 * @ingroup control
13 * @brief Represents a 3D incremental motion update (dx, dy, dz, dyaw, dpitch, droll).
14 *
15 * Used for odometry, IMU, and motion estimation to describe the change in position and orientation
16 * over a time step in 3D space.
17 */
18struct Delta3D {
19 float dx;
20 float dy;
21 float dz;
22 float dyaw;
23 float dpitch;
24 float droll;
25};
26
27/**
28 * @class IMotionState3D
29 * @ingroup control
30 * @brief Interface for representing the motion state of a robot in 3D space.
31 *
32 * Provides access to position, orientation, linear velocity, and angular velocity.
33 */
34class IMotionState3D {
35 public:
36 virtual Coordinate<DistanceM> getPosition() const = 0;
37 virtual Orientation3D getOrientation() const = 0;
38 virtual Speed3D getSpeed() const = 0;
39 virtual AngularVelocity3D getAngularVelocity() const = 0;
40};
41
42/**
43 * @class MotionState3D
44 * @ingroup control
45 * @brief Represents the full 3D motion state of a robot or vehicle.
46 *
47 * Encapsulates position, orientation, linear velocity, and angular velocity in 3D space.
48 * Provides a unified interface for state estimation, control, and sensor fusion modules.
49 *
50 * Used throughout the TinyRobotics framework for odometry, IMU, fusion, and control logic.
51 *
52 */
53class MotionState3D : public IMotionState3D {
54 public:
55 MotionState3D(const Coordinate<DistanceM>& position,
56 const Orientation3D& orientation, const Speed3D& speed,
57 const AngularVelocity3D& angularVelocity)
58 : position(position),
59 orientation(orientation),
60 speed(speed),
61 angularVelocity(angularVelocity) {}
62
63 Coordinate<DistanceM> getPosition() const override { return position; }
64 Orientation3D getOrientation() const override { return orientation; }
65 Speed3D getSpeed() const override { return speed; }
66 AngularVelocity3D getAngularVelocity() const override {
67 return angularVelocity;
68 }
69
70 protected:
71 Coordinate<DistanceM> position;
72 Orientation3D orientation;
73 Speed3D speed;
74 AngularVelocity3D angularVelocity;
75};
76
77} // namespace tinyrobotics
Represents a 3D angular velocity vector with unit support.
Definition: AngularVelocity.h:134
A generic 3D coordinate class for robotics, navigation, and spatial calculations.
Definition: Coordinate.h:57
Interface for representing the motion state of a robot in 3D space.
Definition: MotionState3D.h:34
Represents the full 3D motion state of a robot or vehicle.
Definition: MotionState3D.h:53
Simple 3D orientation class (yaw, pitch, roll in radians)
Definition: Orientation3D.h:13
Represents a 3D incremental motion update (dx, dy, dz, dyaw, dpitch, droll).
Definition: MotionState3D.h:18