RoboidControl
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | 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 (Motor *leftMotor, Motor *rightMotor)
 Setup of the DifferentialDrive with the Placement of the motors.
 
void SetDimensions (float wheelDiameter, float wheelSeparation)
 
void SetMotorTargetSpeeds (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.
 
virtual void SetVelocity (Polar velocity)
 
virtual Polar GetVelocity () override
 Calculate the linear velocity of the roboid based on the wheel velocities.
 
virtual float GetAngularVelocity () override
 Calculate the angular velocity of the roboid based on the wheel velocities.
 
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.
 

Public Attributes

Roboidroboid = nullptr
 The roboid of this propulsion system.
 

Protected Attributes

float wheelDiameter = 1.0F
 
float wheelSeparation = 1.0F
 
float rpsToMs = 1.0F
 
unsigned int motorCount = 0
 The number of motors used for Propulsion.
 
Motor ** motors = 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 ( Motor leftMotor,
Motor rightMotor 
)

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

◆ SetDimensions()

void DifferentialDrive::SetDimensions ( float  wheelDiameter,
float  wheelSeparation 
)

◆ SetMotorTargetSpeeds()

void DifferentialDrive::SetMotorTargetSpeeds ( 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.

◆ SetVelocity()

void DifferentialDrive::SetVelocity ( Polar  velocity)
virtual

Reimplemented from Passer::RoboidControl::Propulsion.

◆ GetVelocity()

Polar DifferentialDrive::GetVelocity ( )
overridevirtual

Calculate the linear velocity of the roboid based on the wheel velocities.

Returns
The velocity of the roboid in local space

The actual values may not be accurate, depending on the available information

Remarks
This will be more expanded/detailed in a future version of Roboid Control

Reimplemented from Passer::RoboidControl::Propulsion.

◆ GetAngularVelocity()

float DifferentialDrive::GetAngularVelocity ( )
overridevirtual

Calculate the angular velocity of the roboid based on the wheel velocities.

Returns
The angular speed of the roboid in local space

The actual value may not be accurate, depending on the available information

Remarks
This will be more expanded/detailed in a future version of Roboid Control

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

Member Data Documentation

◆ wheelDiameter

float Passer::RoboidControl::DifferentialDrive::wheelDiameter = 1.0F
protected

◆ wheelSeparation

float Passer::RoboidControl::DifferentialDrive::wheelSeparation = 1.0F
protected

◆ rpsToMs

float Passer::RoboidControl::DifferentialDrive::rpsToMs = 1.0F
protected

◆ roboid

Roboid* Passer::RoboidControl::Propulsion::roboid = nullptr
inherited

The roboid of this propulsion system.

◆ motorCount

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

The number of motors used for Propulsion.

◆ motors

Motor** Passer::RoboidControl::Propulsion::motors = nullptr
protectedinherited

The Placement of the motors used for Propulsion.


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