-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Add new Kinematic system with skew correction #849
base: main
Are you sure you want to change the base?
Conversation
New system adds ability to tweak skew correction, for cases when physical geometry of CNC machine is not ideal. Signed-off-by: Vlad A <[email protected]>
New system adds ability to tweak skew correction, for cases when physical geometry of CNC machine is not ideal. Signed-off-by: Vlad A <[email protected]>
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 math looks correct but there are a number of stylistic issues that will make the code easier to understand.
Also we need some documentation with examples for how you would describe a machine with specific amounts of skew.
Does it do the right thing if items are left unspecified, i.e. can you write
skewed:
x:
axis_length_mm: 300
y_offset_mm: 2
Wow, that's a detailed review. Thank you. I'll go over all your points tomorrow. Meanwhile, I would like to point out couple of things in general.
And that's what i've got:
Your example will work as you expect, aside from syntax. Yes, I've seen your suggestion about naming and units. You, probably right, but I would like you to take couple of things into consideration.
|
Re axis_length - point taken. Re units - you could make the same argument for all FluidNC units that are expressed in mm. The units really should be "GCode units in G21 mode". Conventionally that is taken to be mm, but GCode fundamentally operates in arbitrary units and you just have to be consistent. But that is less understandable to most folks than just calling it mm. Another approach that would eliminate both problem would be to have "y_factor" which is the dimensionless offset/distance . That would mean that the user has to do a division. Regardless of how it is parameterized, it will be necessary to document the process quite clearly. |
I found this attractive matrix class implementation on stackexchange: class my_matrix {
std::vector<std::vector<bool> >m;
public:
my_matrix(unsigned int x, unsigned int y) {
m.resize(x, std::vector<bool>(y,false));
}
class matrix_row {
std::vector<bool>& row;
public:
matrix_row(std::vector<bool>& r) : row(r) {
}
bool& operator[](unsigned int y) {
return row.at(y);
}
};
matrix_row& operator[](unsigned int x) {
return matrix_row(m.at(x));
}
};
// Example usage
my_matrix mm(100,100);
mm[10][10] = true; Obviously, replace bool with float |
OMG, no. This code is a good example how to trash your cache for good. Imagine how far and inconsistent the pitch will be in this case. There's even no guaranties they will be stored in order. Every time you do matrix operation using data stored like this, you can jump all over the memory. |
as for _mm. Ok, I'm sold. |
bdring#849 Signed-off-by: Vlad A <[email protected]>
Signed-off-by: Vlad A <[email protected]>
Hey, Did I forgot anything? |
public: | ||
Mtx(const size_t row, const size_t col) : _pitch(col), _lines(row) { _buffer = new number[_pitch * _lines]; }; | ||
|
||
void allocate() {} |
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.
Empty functions, may be get rid of them, or move real allocation and deallocation to those funcs.
Another approach:
- get rid of those functions and dtor,
- make buffer in the RAII style
std::unique_ptr<number[]> _buffer;
...
ctor() {
_buffer.reset(new number[_pitch * _lines])
}
New system adds ability to tweak skew correction, for cases when physical
geometry of CNC machine is not ideal.
Also, there's implementation of generic abstraction for transformation to-from axis space, it may be used for future implementation of rotated or any other exotic coordinate systems.
Known issues: Machine will do homming in transformed coordinate system as well, which may or may not by desirable. Ideally, config should have an option where user explicitly define homming behavior.