Add quadcopter support
This commit is contained in:
parent
5c8d7df31b
commit
d3015be69c
@ -102,3 +102,7 @@ void Propulsion::SetTwistVelocity(float forwardVelocity, float turningVelocity)
|
|||||||
float rightVelocity = Float::Clamp(forwardVelocity + turningVelocity, -1, 1);
|
float rightVelocity = Float::Clamp(forwardVelocity + turningVelocity, -1, 1);
|
||||||
SetDiffDriveVelocities(leftVelocity, rightVelocity);
|
SetDiffDriveVelocities(leftVelocity, rightVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Quadcopter* Propulsion::GetQuadcopter() {
|
||||||
|
return quadcopter;
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Quadcopter.h"
|
||||||
#include "ControlledMotor.h"
|
#include "ControlledMotor.h"
|
||||||
#include "Placement.h"
|
#include "Placement.h"
|
||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
@ -33,6 +34,7 @@ class Propulsion {
|
|||||||
void SetTwistVelocity(float forward, float yaw);
|
void SetTwistVelocity(float forward, float yaw);
|
||||||
|
|
||||||
// Think: drones
|
// Think: drones
|
||||||
|
Quadcopter* GetQuadcopter();
|
||||||
void SetLinearSpeed(Vector3 direction);
|
void SetLinearSpeed(Vector3 direction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -40,4 +42,6 @@ class Propulsion {
|
|||||||
//MotorPlacement* motors = nullptr;
|
//MotorPlacement* motors = nullptr;
|
||||||
Placement* placement = nullptr;
|
Placement* placement = nullptr;
|
||||||
unsigned int motorCount = 0;
|
unsigned int motorCount = 0;
|
||||||
|
|
||||||
|
Quadcopter* quadcopter = nullptr;
|
||||||
};
|
};
|
||||||
|
9
Quadcopter.cpp
Normal file
9
Quadcopter.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "Quadcopter.h"
|
||||||
|
|
||||||
|
Quadcopter::Quadcopter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Quadcopter::LinearMotion(Vector3 velocity, float yawRate) {
|
||||||
|
this->velocity = velocity;
|
||||||
|
this->yawRate = yawRate;
|
||||||
|
}
|
14
Quadcopter.h
Normal file
14
Quadcopter.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Thing.h"
|
||||||
|
#include "Vector3.h"
|
||||||
|
|
||||||
|
class Quadcopter : public Thing {
|
||||||
|
public:
|
||||||
|
Quadcopter();
|
||||||
|
|
||||||
|
void LinearMotion(Vector3 velocity, float yawRate = 0.0F);
|
||||||
|
protected:
|
||||||
|
Vector3 velocity = Vector3::zero;
|
||||||
|
float yawRate = 0.0F;
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user