42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.0 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(Polar velocity) {}
 | 
						|
 | 
						|
Polar Propulsion::GetVelocity() { return Polar::zero; }
 | 
						|
 | 
						|
float Propulsion::GetAngularVelocity() { return 0; } |