|
|
void | setPins (QuadrotorMotorNo motor, int in1, int in2) |
| | Set the pins for a specific motor (0=front left, 1=front right, 2=rear left, 3=rear right)
|
| |
| void | setThrottle (float percent) |
| |
| void | setRoll (float percent) |
| |
| void | setPitch (float percent) |
| |
| void | setYaw (float percent) |
| |
| void | end () override |
| |
| void | setMotorGain (QuadrotorMotorNo motor, float gain) |
| | Set a calibration gain for a specific motor (default 1.0).
|
| |
| bool | isPinsSet () const |
| | Check if the necessary pins for the vehicle's actuators have been set (pure virtual).
|
| |
| bool | onMessage (const Message< float > &msg) override |
| | Handle an incoming message (pure virtual).
|
| |
| std::vector< MessageContent > | getControls () const override |
| |
|
DriverT & | getMotor (QuadrotorMotorNo motor) |
| |
| std::vector< IMotor< T > * > | getMotors () override |
| |
| 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) |
| |
| 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.
|
| |
template<typename T = float, typename DriverT = BrushedMotor<T>>
class tinyrobotics::Quadrotor< T, DriverT >
Simple quadrotor (quadcopter) model with 4-motor control.
This class abstracts the control of a basic quadcopter:
- 4 motors (front left, front right, rear left, rear right) via HBridge
- Throttle, roll, pitch, and yaw control
Usage Example (with setPins):
quad.
setPins(FRONT_LEFT, m1_in1, m1_in2);
quad.
setPins(FRONT_RIGHT, m2_in1, m2_in2);
quad.
setPins(REAR_LEFT, m3_in1, m3_in2);
quad.
setPins(REAR_RIGHT, m4_in1, m4_in2);
Simple quadrotor (quadcopter) model with 4-motor control.
Definition: Quadrotor.h:41
void setPitch(float percent)
Definition: Quadrotor.h:67
void setRoll(float percent)
Definition: Quadrotor.h:61
void setThrottle(float percent)
Definition: Quadrotor.h:55
void setYaw(float percent)
Definition: Quadrotor.h:73
void setPins(QuadrotorMotorNo motor, int in1, int in2)
Set the pins for a specific motor (0=front left, 1=front right, 2=rear left, 3=rear right)
Definition: Quadrotor.h:49
Update all motors based on throttle, roll, pitch, and yaw.
This is a simple mixer for an X-configuration quadrotor:
- m1: front left
- m2: front right
- m3: rear left
- m4: rear right
Each control input is in percent (-100 to 100).