A two-wheeled Propulsion method.
More...
#include <DifferentialDrive.h>
|
| | 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.
|
| |
| Motor * | GetMotor (unsigned int motorIx) |
| | Get a specific motor.
|
| |
|
| Roboid * | roboid = nullptr |
| | The roboid of this propulsion system.
|
| |
A two-wheeled Propulsion method.
The wheels are put at either side of the roboid with the following behaviour
- When both wheels spin forward, the Roboid moves forward
- When both wheels spin backward, the Roboid moves backward
- When both wheels are spinning in opposite directions, the Roboid rotates wihout moving forward or backward
- When just one wheel is spinning, the Roboid turnes while moving forward or backward.
◆ DifferentialDrive() [1/2]
| DifferentialDrive::DifferentialDrive |
( |
| ) |
|
◆ DifferentialDrive() [2/2]
| DifferentialDrive::DifferentialDrive |
( |
Motor * |
leftMotor, |
|
|
Motor * |
rightMotor |
|
) |
| |
Setup of the DifferentialDrive with the Placement of the motors.
- Parameters
-
| leftMotorPlacement | Placement of the left Motor |
| rightMotorPlacement | Placement 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.
◆ 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
-
| leftSpeed | The target speed of the left Motor |
| rightSpeed | The target speed of the right Motor |
◆ SetTwistSpeed() [1/3]
| void DifferentialDrive::SetTwistSpeed |
( |
float |
forward, |
|
|
float |
yaw |
|
) |
| |
|
overridevirtual |
◆ SetTwistSpeed() [2/3]
| void DifferentialDrive::SetTwistSpeed |
( |
Vector2 |
linear, |
|
|
float |
yaw = 0.0F |
|
) |
| |
|
virtual |
◆ 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
-
| linear | The target linear speed |
| yaw | The target rotation speed around the vertical axis |
| pitch | Pitch is not supported and is ignored |
| roll | Roll 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 |
◆ 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
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
Reimplemented from Passer::RoboidControl::Propulsion.
◆ Update()
| void Propulsion::Update |
( |
float |
currentTimeMs | ) |
|
|
inherited |
Update the propulsion state of the Roboid.
- Parameters
-
| currentTimeMs | The 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
-
| motorIx | The index of the motor |
- Returns
- Returns the motor or a nullptr when no motor with the given index could be found
◆ 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 |
◆ motors
| Motor** Passer::RoboidControl::Propulsion::motors = nullptr |
|
protectedinherited |
The documentation for this class was generated from the following files: