RoboidControl for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Passer::RoboidControl::DifferentialDrive Class Reference

A two-wheeled Propulsion method. More...

#include <DifferentialDrive.h>

Inheritance diagram for Passer::RoboidControl::DifferentialDrive:
Passer::RoboidControl::Propulsion

Public Member Functions

 DifferentialDrive ()
 Default constructor.
 
 DifferentialDrive (Placement leftMotorPlacement, Placement rightMotorPlacement)
 Setup of the DifferentialDrive with the Placement of the motors.
 
void SetTargetSpeeds (float leftSpeed, float rightSpeed)
 Set the target speeds of the motors directly.
 
virtual void SetTwistSpeed (float forward, float yaw) override
 Controls the motors through forward and rotation speeds.
 
virtual void SetTwistSpeed (Vector2 linear, float yaw=0.0F)
 Controls the motors through forward and rotation speeds.
 
virtual void SetTwistSpeed (Vector3 linear, float yaw=0.0F, float pitch=0.0F, float roll=0.0F)
 Controls the motors through forward and rotation speeds.
 
void Update (float currentTimeMs)
 Update the propulsion state of the Roboid.
 
unsigned int GetMotorCount ()
 Get the number of motors in this roboid.
 
MotorGetMotor (unsigned int motorIx)
 Get a specific motor.
 
PlacementGetMotorPlacement (unsigned int motorIx)
 Get the Placement of a specific Motor.
 

Protected Attributes

unsigned int motorCount = 0
 The number of motors used for Propulsion.
 
Placementplacement = nullptr
 The Placement of the motors used for Propulsion.
 

Detailed Description

A two-wheeled Propulsion method.

The wheels are put at either side of the roboid with the following behaviour

Constructor & Destructor Documentation

◆ DifferentialDrive() [1/2]

DifferentialDrive::DifferentialDrive ( )

Default constructor.

◆ DifferentialDrive() [2/2]

DifferentialDrive::DifferentialDrive ( Placement  leftMotorPlacement,
Placement  rightMotorPlacement 
)

Setup of the DifferentialDrive with the Placement of the motors.

Parameters
leftMotorPlacementPlacement of the left Motor
rightMotorPlacementPlacement of the right Motor In this setup, the left motor Direction will be CounterClockWise when driving forward, while the right motor will turn Clockwise.
Note
When not using controlled motors, the placement of the motors is irrelevant.

Member Function Documentation

◆ SetTargetSpeeds()

void DifferentialDrive::SetTargetSpeeds ( float  leftSpeed,
float  rightSpeed 
)

Set the target speeds of the motors directly.

Parameters
leftSpeedThe target speed of the left Motor
rightSpeedThe target speed of the right Motor

◆ SetTwistSpeed() [1/3]

void DifferentialDrive::SetTwistSpeed ( float  forward,
float  yaw 
)
overridevirtual

Controls the motors through forward and rotation speeds.

Parameters
forwardThe target forward speed of the Roboid
yawThe target rotation speed of the Roboid

Reimplemented from Passer::RoboidControl::Propulsion.

◆ SetTwistSpeed() [2/3]

void DifferentialDrive::SetTwistSpeed ( Vector2  linear,
float  yaw = 0.0F 
)
virtual

Controls the motors through forward and rotation speeds.

Parameters
linearThe target linear speed of the Roboid
yawThe target rotation speed of the Roboid
Note
As a DifferentialDrive cannot move sideward, this function has the same effect as using the void SetTwistSpeed(float forward, float yaw) function.

Reimplemented from Passer::RoboidControl::Propulsion.

◆ SetTwistSpeed() [3/3]

void DifferentialDrive::SetTwistSpeed ( Vector3  linear,
float  yaw = 0.0F,
float  pitch = 0.0F,
float  roll = 0.0F 
)
virtual

Controls the motors through forward and rotation speeds.

Parameters
linearThe target linear speed
yawThe target rotation speed around the vertical axis
pitchPitch is not supported and is ignored
rollRoll is not supported and is ignores
Note
As a DifferentialDrive cannot move sideward or vertical, this function has the same effect as using the void SetTwistSpeed(float forward, float yaw) function.

Reimplemented from Passer::RoboidControl::Propulsion.

◆ Update()

void Propulsion::Update ( float  currentTimeMs)
inherited

Update the propulsion state of the Roboid.

Parameters
currentTimeMsThe time in milliseconds when calling this

◆ GetMotorCount()

unsigned int Propulsion::GetMotorCount ( )
inherited

Get the number of motors in this roboid.

Returns
The number of motors. Zero when no motors are present

◆ GetMotor()

Motor * Propulsion::GetMotor ( unsigned int  motorIx)
inherited

Get a specific motor.

Parameters
motorIxThe index of the motor
Returns
Returns the motor or a nullptr when no motor with the given index could be found

◆ GetMotorPlacement()

Placement * Propulsion::GetMotorPlacement ( unsigned int  motorIx)
inherited

Get the Placement of a specific Motor.

Parameters
motorIxThe index of the Motor
Returns
Returns the Placement or a nullptr when no Placement with the give index could be found

Member Data Documentation

◆ motorCount

unsigned int Passer::RoboidControl::Propulsion::motorCount = 0
protectedinherited

The number of motors used for Propulsion.

◆ placement

Placement* Passer::RoboidControl::Propulsion::placement = nullptr
protectedinherited

The Placement of the motors used for Propulsion.


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