48 lines
1.2 KiB
C++
48 lines
1.2 KiB
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(unsigned long 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(Spherical16 velocity) {
|
|
this->linearVelocity = velocity;
|
|
}
|
|
|
|
void Propulsion::SetAngularVelocity(Spherical16 velocity) {
|
|
this->angularVelocity = velocity;
|
|
}
|
|
|
|
Spherical16 Propulsion::GetVelocity() { return this->linearVelocity; }
|
|
|
|
Spherical16 Propulsion::GetAngularVelocity() { return this->angularVelocity; } |