TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Vehicle< MotorT > Class Template Referenceabstract

Abstract base class for all vehicle types. More...

#include <Vehicle.h>

Inheritance diagram for Vehicle< MotorT >:
Inheritance graph
[legend]
Collaboration diagram for Vehicle< MotorT >:
Collaboration graph
[legend]

Public Member Functions

bool begin ()
 Initialize the vehicle.
 
virtual void end ()=0
 Reset the vehicle to a safe or neutral state (pure virtual).
 
virtual bool isPinsSet () const =0
 Check if the necessary pins for the vehicle's actuators have been set (pure virtual).
 
virtual std::vector< MessageContent > getControls () const =0
 
float getSpeedFactor () const
 Get the speed factor (scaling for speed commands).
 
void setSpeedFactor (float factor)
 Set the speed factor (scaling for speed commands).
 
virtual std::vector< IMotor< MotorT > * > getMotors ()=0
 
- 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)
 
- Public Member Functions inherited from MessageSource
void subscribe (MessageHandler &handler, MessageOrigin origin=MessageOrigin::Undefined, MessageContent content=MessageContent::Undefined)
 Subscribe a message handler to this source, with optional filtering.
 
void unsubscribeAll ()
 Remove all registered message handlers.
 
void sendMessage (Message< float > &msg)
 Publish a message to all registered handlers.
 
void sendMessage (const Message< Coordinate< float > > &msg)
 Publish a message to all registered handlers.
 
void sendMessage (const Message< GPSCoordinate > &msg)
 Publish a message to all registered handlers.
 
void sendMessage (const Message< MotionState3D > &msg)
 Overload for MotionState3D messages.
 

Protected Attributes

float speedFactor_ = 1.0f
 
- Protected Attributes inherited from MessageSource
std::vector< MessageHandlerEntrymessageHandlers_
 

Detailed Description

template<typename MotorT = float>
class tinyrobotics::Vehicle< MotorT >

Abstract base class for all vehicle types.

The Vehicle class defines a common interface for all robotic vehicles in the library. It enforces the implementation of a reset() method, which should reset the vehicle's actuators and internal state to a safe or neutral configuration.

All vehicle classes (e.g., Car4WD, Quadrotor, AirPlane, MotorBoat) should inherit from Vehicle.

Member Function Documentation

◆ begin()

bool begin ( )
inline

Initialize the vehicle.

Returns
true
false

◆ end()

virtual void end ( )
pure virtual

◆ isPinsSet()

virtual bool isPinsSet ( ) const
pure virtual

Check if the necessary pins for the vehicle's actuators have been set (pure virtual).

Implemented in AirPlane< T, MotorMT, ServoMT >, CarAckerman< T, MotorMT, ServoMT >, CarDifferential< N, T, MotorMT >, MotorBoat< T, MotorMT, ServoMT >, and Quadrotor< T, DriverT >.


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