-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flex-stacker): add motor interrupt handlers (#458)
* PLAT-469 add linear motion system for stacker axes * pass motor policy to interrupt controller * add movement profile to interrupt controller
- Loading branch information
1 parent
50420fe
commit eb20ccb
Showing
12 changed files
with
305 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
stm32-modules/include/common/core/linear_motion_system.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#pragma once | ||
|
||
#include <concepts> | ||
#include <numbers> | ||
|
||
namespace lms { | ||
|
||
struct BeltConfig { | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float pulley_diameter; // mm | ||
[[nodiscard]] constexpr auto get_mm_per_rev() const -> float { | ||
return static_cast<float>(pulley_diameter * std::numbers::pi); | ||
} | ||
}; | ||
|
||
struct LeadScrewConfig { | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float lead_screw_pitch; // mm/rev | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float gear_reduction_ratio; // large teeth / small teeth | ||
[[nodiscard]] constexpr auto get_mm_per_rev() const -> float { | ||
return lead_screw_pitch / gear_reduction_ratio; | ||
} | ||
}; | ||
|
||
struct GearBoxConfig { | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float gear_diameter; // mm | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float gear_reduction_ratio; // large teeth / small teeth | ||
[[nodiscard]] constexpr auto get_mm_per_rev() const -> float { | ||
return static_cast<float>((gear_diameter * std::numbers::pi) / | ||
gear_reduction_ratio); | ||
} | ||
}; | ||
|
||
template <typename MC> | ||
concept MotorMechanicalConfig = requires { | ||
std::is_same_v<MC, BeltConfig> || std::is_same_v<MC, LeadScrewConfig> || | ||
std::is_same_v<MC, GearBoxConfig>; | ||
}; | ||
|
||
template <MotorMechanicalConfig MEConfig> | ||
struct LinearMotionSystemConfig { | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
MEConfig mech_config{}; | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float steps_per_rev{}; | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
float microstep{}; | ||
[[nodiscard]] constexpr auto get_usteps_per_mm() const -> float { | ||
return (steps_per_rev * microstep) / (mech_config.get_mm_per_rev()); | ||
} | ||
[[nodiscard]] constexpr auto get_usteps_per_um() const -> float { | ||
return (steps_per_rev * microstep) / | ||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) | ||
(mech_config.get_mm_per_rev() * 1000.0); | ||
} | ||
[[nodiscard]] constexpr auto get_um_per_step() const -> float { | ||
return (mech_config.get_mm_per_rev()) / (steps_per_rev * microstep) * | ||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) | ||
1000; | ||
} | ||
}; | ||
|
||
} // namespace lms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.