RoboidControl-cpp/Propulsion.cpp
2024-01-22 11:55:07 +01:00

57 lines
1.4 KiB
C++

#include "Propulsion.h"
#include "Roboid.h"
#include "VectorAlgebra/FloatSingle.h"
Propulsion::Propulsion() {
this->motors = nullptr;
this->motorCount = 0;
}
unsigned int Propulsion::GetMotorCount() {
return this->motorCount;
}
Motor* Propulsion::GetMotor(unsigned int motorId) {
if (motorId >= this->motorCount)
return nullptr;
Motor* motor = this->motors[motorId];
return motor;
}
void Propulsion::Update(float currentTimeMs) {
for (unsigned char motorIx = 0; motorIx < this->motorCount; motorIx++) {
Motor* motor = this->motors[motorIx];
if (motor == nullptr)
continue;
motor->Update(currentTimeMs);
}
}
/*
void Propulsion::SetTwistSpeed(float forward, float yaw) {}
void Propulsion::SetTwistSpeed(Vector2 linear, float yaw) {}
void Propulsion::SetTwistSpeed(Vector3 linear, float yaw, float pitch,
float roll) {}
*/
void Propulsion::SetVelocity(float velocity) {}
void Propulsion::SetVelocity(Vector2 velocity) {}
void Propulsion::SetVelocity(Vector3 verlocity) {}
void Propulsion::SetVelocity(Polar velocity) {}
void Propulsion::SetVelocity(Spherical velocity) {}
void Propulsion::SetAngularVelocity(float yaw) {}
void Propulsion::SetAngularVelocity(float yaw, float pitch, float roll) {}
Polar Propulsion::GetVelocity() {
return Polar(0, 0);
}
float Propulsion::GetAngularVelocity() {
return 0;
}