From cd5393362b83cc4edddfdd2ded747c61d03fa8fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Caruso?= <niccolo.caruso@skywarder.eu>
Date: Sat, 14 Dec 2024 13:20:34 +0100
Subject: [PATCH] [ARP-RP] Speed now takes into account stepper multipliers
Also printing log number. To rotate anti-clockwise the move should be - and speed kept as positive.
---
.../RotatingPlatform/Actuators/Actuators.cpp | 11 ++++++++---
.../RotatingPlatform/Actuators/Actuators.h | 4 ++--
.../RotatingPlatform/Actuators/ActuatorsConfig.h | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/Groundstation/RotatingPlatform/Actuators/Actuators.cpp b/src/Groundstation/RotatingPlatform/Actuators/Actuators.cpp
index 6210a7718..63a2ccc9f 100644
--- a/src/Groundstation/RotatingPlatform/Actuators/Actuators.cpp
+++ b/src/Groundstation/RotatingPlatform/Actuators/Actuators.cpp
@@ -70,17 +70,22 @@ Actuators::Actuators(StepperConfig config)
void Actuators::run()
{
+ int logNr = Logger::getInstance().getCurrentLogNumber();
while (true)
{
+ std::cout << "Log nr " << logNr << std::endl;
+ std::cout << "Speed limit is " << configX.MAX_SPEED << std::endl;
{
miosix::Lock<FastMutex> lock(rotationMutex);
- float stepSpeed = ACCELERATION * (TIME_WAIT_MS / 1000);
+ float stepSpeed = ACCELERATION * (TIME_WAIT_MS / 1000);
+ float multiplier = 2.2;
// Acceleration/stable phase
if (stepperX.isEnabled() && isRotating)
{
- if (speed < configX.MAX_SPEED && speed < MAX_MAX_SPEED)
+ if (speed < configX.MAX_SPEED / multiplier &&
+ speed < MAX_MAX_SPEED)
speed += stepSpeed;
if (speed > configX.MAX_SPEED)
speed = configX.MAX_SPEED;
@@ -104,7 +109,7 @@ void Actuators::run()
setSpeed(StepperList::STEPPER_X, 0.0);
}
}
- moveDeg(StepperList::STEPPER_X, 20);
+ moveDeg(StepperList::STEPPER_X, -20);
Thread::sleep(TIME_WAIT_MS);
}
}
diff --git a/src/Groundstation/RotatingPlatform/Actuators/Actuators.h b/src/Groundstation/RotatingPlatform/Actuators/Actuators.h
index 9102e8a50..1a5259c19 100644
--- a/src/Groundstation/RotatingPlatform/Actuators/Actuators.h
+++ b/src/Groundstation/RotatingPlatform/Actuators/Actuators.h
@@ -38,9 +38,9 @@
namespace RotatingPlatform
{
static constexpr float MAX_MAX_SPEED =
- 0.03; // Structurally not go more than this
+ 0.5 * 2.2; // Structurally not go more than this
static constexpr float ACCELERATION = 0.01; //[RPS^2]
-static constexpr float TIME_WAIT_MS = 100; //[MS]
+static constexpr float TIME_WAIT_MS = 100; //[MS]
/**
* @brief Error handling enum for the stepper movement
diff --git a/src/Groundstation/RotatingPlatform/Actuators/ActuatorsConfig.h b/src/Groundstation/RotatingPlatform/Actuators/ActuatorsConfig.h
index f076a8f01..eb0f958cb 100644
--- a/src/Groundstation/RotatingPlatform/Actuators/ActuatorsConfig.h
+++ b/src/Groundstation/RotatingPlatform/Actuators/ActuatorsConfig.h
@@ -37,7 +37,7 @@ static const RotatingPlatform::StepperConfig stepperXConfig{
.HAS_ANGLE_LIMITS = false,
.MIN_ANGLE = 0,
.MAX_ANGLE = 0,
- .MAX_SPEED = 0.1, //<[RPS]
+ .MAX_SPEED = 0.105 * 2.2, //<[RPS] * multiplier (transmission)
};
namespace StepperSettings
--
GitLab