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

IOdometryModel3D implementation for fixed-wing airplanes using control surface and throttle inputs. More...

#include <AirplaneOdometryModel3D.h>

Inheritance diagram for AirplaneOdometryModel3D:
Inheritance graph
[legend]
Collaboration diagram for AirplaneOdometryModel3D:
Collaboration graph
[legend]

Public Member Functions

void registerCallback (void(*callback)(void *), void *userData) override
 Register a callback to be invoked on relevant events (e.g., input change).
 
 AirplaneOdometryModel3D (float maxSpeed=30.0f, float maxRollRate=57.0f, float maxPitchRate=40.0f, float maxYawRate=29.0f)
 Construct an AirplaneOdometryModel3D with configurable max rates.
 
bool onMessage (const Message< float > &msg)
 Handle incoming control messages to set airplane control surfaces and throttle. Supports MessageContent::Throttle, Roll, Pitch, Yaw (float values).
 
void setThrottle (float percent)
 
void setAileron (float deg)
 
void setElevator (float deg)
 
void setRudder (float deg)
 
void getLinearVelocity (float &vx, float &vy, float &vz) const override
 Get the current linear velocity (vx, vy, vz) in m/s (robot frame).
 
void getAngularVelocity (float &wx, float &wy, float &wz) const override
 Get the current angular velocity (wx, wy, wz) in rad/s (robot frame).
 
virtual void registerCallback (void(*callback)(void *), void *userData)
 Register a callback to be invoked on relevant events (e.g., input change, update).
 
virtual void getLinearVelocity (float &vx, float &vy, float &vz) const =0
 Get the current linear velocity (vx, vy, vz) in m/s (robot frame).
 
virtual void getAngularVelocity (float &wx, float &wy, float &wz) const =0
 Get the current angular velocity (wx, wy, wz) in rad/s (robot frame).
 
- Public Member Functions inherited from MessageHandler
virtual bool onMessage (const Message< float > &msg)=0
 Handle an incoming message (pure virtual).
 
virtual bool onMessage (const Message< Coordinate< float > > &msg)
 
virtual bool onMessage (const Message< GPSCoordinate > &msg)
 
virtual bool onMessage (const Message< MotionState3D > &msg)
 

Static Protected Member Functions

static float clamp (float v, float min, float max)
 

Protected Attributes

void(* callback )(void *) = nullptr
 
void * userData = nullptr
 
float throttlePercent
 
float aileronDeg
 
float elevatorDeg
 
float rudderDeg
 
float maxSpeed
 
float maxRollRate
 
float maxPitchRate
 
float maxYawRate
 

Detailed Description

IOdometryModel3D implementation for fixed-wing airplanes using control surface and throttle inputs.

This model computes linear and angular velocities for a fixed-wing airplane based on control inputs:

Features

Usage Example

model.setThrottle(80); // 80% throttle
model.setAileron(10); // 10 degrees right aileron
model.setElevator(-5); // 5 degrees down elevator
model.setRudder(0); // Centered rudder
float vx, vy, vz, wx, wy, wz;
model.getLinearVelocity(vx, vy, vz);
model.getAngularVelocity(wx, wy, wz);
// vx will be 0.8 * maxSpeed, wx will be 10/45 * maxRollRate, etc.
IOdometryModel3D implementation for fixed-wing airplanes using control surface and throttle inputs.
Definition: AirplaneOdometryModel3D.h:57
void getAngularVelocity(float &wx, float &wy, float &wz) const override
Get the current angular velocity (wx, wy, wz) in rad/s (robot frame).
Definition: AirplaneOdometryModel3D.h:150
void getLinearVelocity(float &vx, float &vy, float &vz) const override
Get the current linear velocity (vx, vy, vz) in m/s (robot frame).
Definition: AirplaneOdometryModel3D.h:143

Message Integration

The model can be updated from messages (e.g., from an RC receiver or autopilot):

msg.content = MessageContent::Throttle;
msg.value = 75;
model.onMessage(msg); // Sets throttle to 75%
bool onMessage(const Message< float > &msg)
Handle incoming control messages to set airplane control surfaces and throttle. Supports MessageConte...
Definition: AirplaneOdometryModel3D.h:104
Generic message structure for communication, parameterized by value type.
Definition: Message.h:72
T value
Value of the message.
Definition: Message.h:82
MessageContent content
Optional identifier for the source (e.g., sensor ID, motor ID)
Definition: Message.h:80

Constructor & Destructor Documentation

◆ AirplaneOdometryModel3D()

AirplaneOdometryModel3D ( float  maxSpeed = 30.0f,
float  maxRollRate = 57.0f,
float  maxPitchRate = 40.0f,
float  maxYawRate = 29.0f 
)
inline

Construct an AirplaneOdometryModel3D with configurable max rates.

Parameters
maxSpeedMaximum forward speed (m/s). Typical: 20–40 m/s for small UAVs.
maxRollRateMaximum roll rate (deg/s). Typical: 40–85 deg/s (converted to rad/s internally).
maxPitchRateMaximum pitch rate (deg/s). Typical: 30–60 deg/s (converted to rad/s internally).
maxYawRateMaximum yaw rate (deg/s). Typical: 17–40 deg/s (converted to rad/s internally).

These values should be set to match the physical or simulated aircraft's limits. For most fixed-wing RC airplanes:

  • maxSpeed: 25–35 m/s (90–125 km/h)
  • maxRollRate: 57 deg/s
  • maxPitchRate: 40 deg/s
  • maxYawRate: 29 deg/s

Note: The constructor will convert the rates from deg/s to rad/s for internal use. Example: AirplaneOdometryModel3D(30.0f, 57.0f, 40.0f, 29.0f); // 30 m/s, 57°/s, 40°/s, 29°/s

Member Function Documentation

◆ getAngularVelocity()

void getAngularVelocity ( float &  wx,
float &  wy,
float &  wz 
) const
inlineoverridevirtual

Get the current angular velocity (wx, wy, wz) in rad/s (robot frame).

Implements IOdometryModel3D.

◆ getLinearVelocity()

void getLinearVelocity ( float &  vx,
float &  vy,
float &  vz 
) const
inlineoverridevirtual

Get the current linear velocity (vx, vy, vz) in m/s (robot frame).

Implements IOdometryModel3D.

◆ onMessage()

bool onMessage ( const Message< float > &  msg)
inlinevirtual

Handle incoming control messages to set airplane control surfaces and throttle. Supports MessageContent::Throttle, Roll, Pitch, Yaw (float values).

Returns
true if message was handled

Implements MessageHandler.

◆ registerCallback()

void registerCallback ( void(*)(void *)  callback,
void *  userData 
)
inlineoverridevirtual

Register a callback to be invoked on relevant events (e.g., input change).

Reimplemented from IOdometryModel3D.


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