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

Odometry model for differential drive robots. More...

#include <OdometryDifferentialDriveModel.h>

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

Public Member Functions

 OdometryDifferentialDriveModel (Distance wheelBase)
 
virtual void updateSpeed (uint32_t deltaTimeMs)
 Update the speed estimate based on elapsed time.
 
float computeDeltaTheta (uint16_t deltaTimeMs) const override
 Compute heading change (deltaTheta) for differential drive.
 
void computeDeltaXY (float theta, uint32_t deltaTimeMs, float &deltaX, float &deltaY) const override
 Compute position change (deltaX, deltaY) for odometry kinematics.
 
bool onMessage (const Message< float > &msg)
 Handle an incoming message (pure virtual).
 
void setCallback (void(*callback)(void *), void *userData)
 
void setSpeedSource (ISpeedSource &speedSource)
 Set the speed source (e.g., encoder, estimator) for this model.
 
Speed getSpeed () const override
 Get the current speed of the vehicle.
 
Angle getSteeringAngle () const override
 Get the current steering angle of the vehicle.
 
- Public Member Functions inherited from IOdometryModel2D
virtual ~IOdometryModel2D ()=default
 Virtual destructor for interface.
 
virtual Speed getSpeed () const =0
 Get the current speed of the vehicle.
 
virtual Angle getSteeringAngle () const =0
 Get the current steering angle of the vehicle.
 
virtual void updateSpeed (uint32_t deltaTimeMs)=0
 Update the speed estimate based on elapsed time.
 
virtual void setSpeedSource (ISpeedSource &speedSource)=0
 Set the speed source (e.g., encoder, estimator) for this model.
 
virtual void registerCallback (void(*callback)(void *), void *userData)=0
 Register a callback to be invoked on relevant events (e.g., input change, update).
 
virtual float computeDeltaTheta (uint16_t deltaTimeMs) const =0
 Compute heading change (deltaTheta) for odometry kinematics.
 
virtual void computeDeltaXY (float theta, uint32_t deltaTimeMs, float &deltaX, float &deltaY) const =0
 Compute position change (deltaX, deltaY) for odometry kinematics.
 
- 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)
 

Detailed Description

Odometry model for differential drive robots.

Computes heading change (deltaTheta) using left and right wheel speeds.

Member Function Documentation

◆ computeDeltaTheta()

float computeDeltaTheta ( uint16_t  deltaTimeMs) const
inlineoverridevirtual

Compute heading change (deltaTheta) for differential drive.

Parameters
deltaTimeMsTime interval (milliseconds)
Returns
Change in heading (radians)

Implements IOdometryModel2D.

◆ computeDeltaXY()

void computeDeltaXY ( float  theta,
uint32_t  deltaTimeMs,
float &  deltaX,
float &  deltaY 
) const
inlineoverridevirtual

Compute position change (deltaX, deltaY) for odometry kinematics.

Parameters
speedSpeed of the vehicle (meters/second)
thetaHeading (radians)
deltaTimeMsTime interval (milliseconds)
[out]deltaXChange in X position (meters)
[out]deltaYChange in Y position (meters)

Implements IOdometryModel2D.

◆ getSpeed()

Speed getSpeed ( ) const
inlineoverridevirtual

Get the current speed of the vehicle.

Returns
Speed of the vehicle (meters/second)

Implements IOdometryModel2D.

◆ getSteeringAngle()

Angle getSteeringAngle ( ) const
inlineoverridevirtual

Get the current steering angle of the vehicle.

Returns
Steering angle (radians)

Implements IOdometryModel2D.

◆ onMessage()

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

Handle an incoming message (pure virtual).

This method should be implemented by derived classes to process messages.

Parameters
msgThe message to handle.
Returns
true if the message was handled successfully, false otherwise.

Implements MessageHandler.

◆ setSpeedSource()

void setSpeedSource ( ISpeedSource speedSource)
inlinevirtual

Set the speed source (e.g., encoder, estimator) for this model.

Parameters
speedSourceReference to an ISpeedSource implementation

Implements IOdometryModel2D.

◆ updateSpeed()

virtual void updateSpeed ( uint32_t  deltaTimeMs)
inlinevirtual

Update the speed estimate based on elapsed time.

Parameters
deltaTimeMsTime interval (milliseconds)

Implements IOdometryModel2D.


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