-
Notifications
You must be signed in to change notification settings - Fork 80
Stepper Motor Simulation Module #1092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
If the return type is void, you can't include `@return void` in the method definition.
… this information.
The auto-generated module header is the main section. All module RST should use sub-section titles and lower The titles are adjusted to be consistent with the rest of the BSK documentation. I'm linking now to the unit test page. However, I feel the discussion of the testing is redundant. The unit test files already have this documented and this module information is readily available one level higher going into module _UnitTest folder. If these sections have info not in the python test method doc-strings, then add this info there and remove this testing info from the module.
…ith other modules
Doxygen Method information was defined both in the *.h and *.cpp files. This caused the RST to have repeated documentation statements.
3004b47
to
e885eef
Compare
/* | ||
ISC License | ||
|
||
Copyright (c) 2023, Autonomous Vehicle Systems Lab, University of Colorado at Boulder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update copyright year to 2025 as it is being contributed in 2025.
/* | ||
ISC License | ||
|
||
Copyright (c) 2023, Autonomous Vehicle Systems Lab, University of Colorado at Boulder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update year it was contributed
|
||
*/ | ||
%module stepperMotor | ||
%{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
%include "architecture/utilities/bskException.swg"
%default_bsk_exception();
after the %module
line. This adds support for Mark's new way of having BSK errors float to python.
double t); //!< Method used to compute the motor states during the second half of each step | ||
void computeStepComplete(double t); //!< Method used to compute the motor states when a step is complete | ||
|
||
/* Step parameters */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add zero default values to all class variables. Unless the class instance is global or static, C++ will not zero-initialize the class variables.
assert(this->motorStepCommandInMsg.isLinked()); | ||
|
||
// Reset required module parameters | ||
this->theta = this->thetaInit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, you create default values for some class variables in Reset(). I would still prefer all class variables have predictable default variables. Makes tracking down random behavior much easier in the future.
ISC License | ||
|
||
Copyright (c) 2025, Laboratory for Atmospheric and Space Physics, University of Colorado at Boulder | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add AVS copyright statement. I pushed a [squash] labeled commit that does this.
ISC License | ||
|
||
Copyright (c) 2025, Laboratory for Atmospheric and Space Physics, University of Colorado at Boulder | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add AVS copyright statement. I pushed a [squash] labeled commit that does this.
double StepperMotor::getThetaDDotMax() const { return this->thetaDDotMax; } | ||
|
||
/*! Setter method for the initial motor angle. | ||
@return void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These @return void
statements raise warnings in sphinx and should be removed. I pushed a [squash] labeled commit that does this. CI Documentation now completes where before it failed.
StepperMotor() = default; //!< Constructor | ||
~StepperMotor() = default; //!< Destructor | ||
|
||
void Reset(uint64_t currentSimNanos) override; //!< Reset member function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The methods have doxygen documentation strings in both the *.h and *.cpp files. This caused the *.rst file to have repeated documentation text. Plus, it creates two places to update documentation in the future. A [squash] labeled commit was pushed which corrects this.
Description
This PR adds a stepper motor simulation module to the repository. This kinematic profiler module is useful to simulate the actuation of prescribed spacecraft components. This PR is ported from the LASP-BSK repository, it has already had a series of reviews there.
The stepper motor module simulates the actuation of a stepper motor. Given the initial motor angle, a fixed motor step angle, a fixed motor step time, and an input message containing an integer number of steps commanded, the motor states are computed at each time step and output from the module. The motor states include the scalar motor angle, scalar angle rate, scalar angular acceleration, the current motor step count, and the number of steps commanded to the
motor. The motor actuation through each step of the command sequence is profiled using a bang-bang
acceleration profile. This module also includes logic for handling incoming reference commands that interrupt an
unfinished motor actuation sequence. Because the stepper motor is unable to stop actuating during a step, it must
finish actuating through the current step before it can begin following a new reference command.
Verification
The unit test is written to check nominal motor actuation and message interruptions to current motor actuation.
Documentation
RST documentation is added for the module.
Future work
N/A