Added component
This commit is contained in:
parent
c2478ce057
commit
2ff984b5bc
@ -1,25 +1,21 @@
|
|||||||
#include "ControlledMotor.h"
|
|
||||||
#include "Propulsion.h"
|
#include "Propulsion.h"
|
||||||
|
#include "ControlledMotor.h"
|
||||||
|
|
||||||
#include "FloatSingle.h"
|
#include "FloatSingle.h"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "debug.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
Propulsion::Propulsion() {
|
Propulsion::Propulsion() {
|
||||||
this->placement = nullptr;
|
this->placement = nullptr;
|
||||||
this->motorCount = 0;
|
this->motorCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void Propulsion::AddMotors(MotorPlacement* motors, unsigned int motorCount) {
|
// void Propulsion::AddMotors(MotorPlacement* motors, unsigned int motorCount) {
|
||||||
// this->palce = motors;
|
// this->palce = motors;
|
||||||
// this->motorCount = motorCount;
|
// this->motorCount = motorCount;
|
||||||
//}
|
// }
|
||||||
|
|
||||||
void Propulsion::AddMotors(Placement* things, unsigned int thingCount) {
|
void Propulsion::AddMotors(Placement* things, unsigned int thingCount) {
|
||||||
//this->placement = motors;
|
// this->placement = motors;
|
||||||
//this->motorCount = motorCount;
|
// this->motorCount = motorCount;
|
||||||
this->motorCount = 0;
|
this->motorCount = 0;
|
||||||
for (unsigned int thingIx = 0; thingIx < thingCount; thingIx++) {
|
for (unsigned int thingIx = 0; thingIx < thingCount; thingIx++) {
|
||||||
Thing* thing = things[thingIx].thing;
|
Thing* thing = things[thingIx].thing;
|
||||||
@ -34,7 +30,6 @@ void Propulsion::AddMotors(Placement* things, unsigned int thingCount) {
|
|||||||
if (thing->isMotor)
|
if (thing->isMotor)
|
||||||
this->placement[motorIx++] = things[thingIx];
|
this->placement[motorIx++] = things[thingIx];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Propulsion::AddQuadcopter(Quadcopter* quadcopter) {
|
void Propulsion::AddQuadcopter(Quadcopter* quadcopter) {
|
||||||
@ -63,14 +58,14 @@ void Propulsion::Update() {
|
|||||||
// lastMillis = curMillis;
|
// lastMillis = curMillis;
|
||||||
|
|
||||||
for (unsigned int motorIx = 0; motorIx < this->motorCount; motorIx++) {
|
for (unsigned int motorIx = 0; motorIx < this->motorCount; motorIx++) {
|
||||||
//Placement placement = placement[motorIx];
|
// Placement placement = placement[motorIx];
|
||||||
// placement.controlledMotor->Update(timeStep);
|
// placement.controlledMotor->Update(timeStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Propulsion::SetDiffDriveSpeed(float leftSpeed, float rightSpeed) {
|
void Propulsion::SetDiffDriveSpeed(float leftSpeed, float rightSpeed) {
|
||||||
for (unsigned int motorIx = 0; motorIx < this->motorCount; motorIx++) {
|
for (unsigned int motorIx = 0; motorIx < this->motorCount; motorIx++) {
|
||||||
Motor* motor = (Motor*) placement[motorIx].thing;
|
Motor* motor = (Motor*)placement[motorIx].thing;
|
||||||
if (motor == nullptr)
|
if (motor == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -84,10 +79,10 @@ void Propulsion::SetDiffDriveSpeed(float leftSpeed, float rightSpeed) {
|
|||||||
|
|
||||||
void Propulsion::SetDiffDriveVelocities(float leftVelocity, float rightVelocity) {
|
void Propulsion::SetDiffDriveVelocities(float leftVelocity, float rightVelocity) {
|
||||||
for (unsigned int motorIx = 0; motorIx < this->motorCount; motorIx++) {
|
for (unsigned int motorIx = 0; motorIx < this->motorCount; motorIx++) {
|
||||||
//Placement placement = placement[motorIx];
|
// Placement placement = placement[motorIx];
|
||||||
//if (placement.position.x < 0)
|
// if (placement.position.x < 0)
|
||||||
// placement.controlledMotor->SetTargetVelocity(leftVelocity);
|
// placement.controlledMotor->SetTargetVelocity(leftVelocity);
|
||||||
//else if (placement.position.x > 0)
|
// else if (placement.position.x > 0)
|
||||||
// placement.controlledMotor->SetTargetVelocity(rightVelocity);
|
// placement.controlledMotor->SetTargetVelocity(rightVelocity);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
1
component.mk
Normal file
1
component.mk
Normal file
@ -0,0 +1 @@
|
|||||||
|
COMPONENT_ADD_INCLUDEDIRS = ./VectorAlgebra/include
|
Loading…
x
Reference in New Issue
Block a user