-
Notifications
You must be signed in to change notification settings - Fork 2
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
MTC - Scalar Control General Functionality #71
base: master
Are you sure you want to change the base?
Conversation
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.
Quick look
lib/motors/vector_controller.cpp
Outdated
Vq = Kp * IqError + integral_term_Iq; | ||
} | ||
|
||
void VectorController::parkTransform() { |
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.
This should be inverse park
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.
Sorry about that. Changes done in second commit.
Probably don't even need to review. We are apparently changing to scalar control now. |
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.
Good start, run clang-format over everything. Also, what is used as the actual PWM duty cycle? Or what values will that be calculated from?
core::Float Ia; | ||
core::Float Ib; | ||
core::Float Ic; | ||
core::Float rotorVelocity; | ||
core::Float Id; | ||
core::Float Iq; | ||
core::Float Vd; | ||
core::Float Vq; | ||
core::Float IdRef; | ||
core::Float IqRef; | ||
core::Float Kp; | ||
core::Float Ki; | ||
core::Float theta; |
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.
- Rename most of these to be clear on what they actually are
- Variables should be named in
lower_snake_case
and class data members should have a trailing_
, socurrent_phase_a_
etc. - Move the private block after public.
} | ||
|
||
|
||
int main() { |
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.
get rid of the main function
} | ||
|
||
// Convert to 2-axis system | ||
void VectorController::convertTo2Axis() { |
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 functions should take parameters and return values instead of doing random stuff to internal variables, cos until the end of this function there will be a Id
and Iq
which are outdated
void measureCurrentsAndVelocity(core::Float ia, core::Float ib, core::Float ic, core::Float rotorVelocity); | ||
void convertTo2Axis(); | ||
void inverse2Axis(); | ||
void piControl(); | ||
void inverseParkTransform(); |
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.
most of these should be private, and used by public methods
Pass in the new currents and velocity and do the rest of it internally unless these methods definitely need to be called elsewhere
Class for Vector Control, header and main file. This is the initial overview of how vector control will work. We just need it now to merge with CAN messages. All steps are added until the space vector modulation