Replace AngleAxis with Spherical

This commit is contained in:
Pascal Serrarens 2024-09-27 09:46:20 +02:00
parent 8d5707ce57
commit 8443530819
6 changed files with 10 additions and 7 deletions

@ -1 +1 @@
Subproject commit 2e61e1b710cb0c0455d80970b7d072d70db7ac83 Subproject commit edbb4b1ffc928523ff973c0769abd45672c08e53

View File

@ -193,7 +193,7 @@ void NetworkSync::SendPose(Thing* thing, bool recurse) {
return; return;
if (thing->GetLinearVelocity().distance > 0 || if (thing->GetLinearVelocity().distance > 0 ||
thing->GetAngularVelocity().angle > 0) { thing->GetAngularVelocity().distance > 0) {
unsigned char ix = 0; unsigned char ix = 0;
buffer[ix++] = PoseMsg; buffer[ix++] = PoseMsg;
buffer[ix++] = thing->id; buffer[ix++] = thing->id;
@ -371,6 +371,9 @@ void NetworkSync::SendText(const char* s) {
#endif #endif
} }
#if ESP32
#include <Arduino.h>
#endif
void NetworkSync::SendInt(const int x) { void NetworkSync::SendInt(const int x) {
String s = String(x); String s = String(x);
char length = s.length(); char length = s.length();

View File

@ -52,7 +52,7 @@ void Roboid::Update(unsigned long currentTimeMs) {
SetOrientation(this->worldOrientation * SetOrientation(this->worldOrientation *
SwingTwist16::AngleAxis( SwingTwist16::AngleAxis(
this->propulsion->GetAngularVelocity() * deltaTime, this->propulsion->GetAngularVelocity() * deltaTime,
Spherical16::up)); Direction16::up));
} }
if (childCount > 0 && children != nullptr) { if (childCount > 0 && children != nullptr) {

View File

@ -10,7 +10,7 @@ class ServoMotor : public Thing {
public: public:
ServoMotor(); ServoMotor();
Vector3 rotationAxis = Vector3::up; Direction16 rotationAxis = Direction16::up;
Angle16 minAngle = Angle16::Degrees(-90); Angle16 minAngle = Angle16::Degrees(-90);
Angle16 maxAngle = Angle16::Degrees(90); Angle16 maxAngle = Angle16::Degrees(90);

View File

@ -81,6 +81,6 @@ Spherical16 Thing::GetLinearVelocity() {
return this->linearVelocity; return this->linearVelocity;
} }
AngleAxis16 Thing::GetAngularVelocity() { Spherical16 Thing::GetAngularVelocity() {
return this->angularVelocity; return this->angularVelocity;
} }

View File

@ -54,7 +54,7 @@ class Thing {
SwingTwist16 worldOrientation; SwingTwist16 worldOrientation;
virtual Spherical16 GetLinearVelocity(); virtual Spherical16 GetLinearVelocity();
virtual AngleAxis16 GetAngularVelocity(); virtual Spherical16 GetAngularVelocity();
/// @brief Sets the parent Thing /// @brief Sets the parent Thing
/// @param parent The Thing which should become the parnet /// @param parent The Thing which should become the parnet
@ -116,7 +116,7 @@ class Thing {
Thing** children = nullptr; Thing** children = nullptr;
public: public:
AngleAxis16 angularVelocity = AngleAxis16::zero; Spherical16 angularVelocity = Spherical16::zero;
Spherical16 linearVelocity = Spherical16::zero; Spherical16 linearVelocity = Spherical16::zero;
}; };