RoboidControl-cpp/Propulsion.cpp
2024-03-05 09:13:46 +01:00

40 lines
1001 B
C++

#include "Propulsion.h"
#include "Roboid.h"
#include "LinearAlgebra/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) {}
Polar Propulsion::GetVelocity() { return Polar(0, 0); }
float Propulsion::GetAngularVelocity() { return 0; }