-
Notifications
You must be signed in to change notification settings - Fork 5
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
Teo vector verifcation #177
base: main
Are you sure you want to change the base?
Conversation
This fixex #172 |
src/seahawk/seahawk_deck/thrust.py
Outdated
# Multiply twist with inverse of motor config to get motor effort values | ||
motor_efforts = np.matmul(self.inverse_config, twist_array) | ||
motor_msg.data[0] = motor_efforts[0] | ||
motor_msg.data[1] = motor_efforts[1] | ||
motor_msg.data[2] = motor_efforts[2] | ||
motor_msg.data[3] = motor_efforts[3] | ||
motor_msg.data[4] = motor_efforts[4] | ||
motor_msg.data[5] = motor_efforts[5] | ||
motor_msg.data[6] = motor_efforts[6] | ||
motor_msg.data[7] = motor_efforts[7] |
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.
Is it possible to refactor this to use a loop?
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.
Basically, this looks good, but I talked about some issues in my comments (mostly the matrix math readability)
# Linear Thrust Vector | ||
x = config[0][0]*motor_msg.data[4] + config[0][1]*motor_msg.data[5] + config[0][2]*motor_msg.data[6] + config[0][3]*motor_msg.data[7] | ||
y = config[1][0]*motor_msg.data[4] + config[1][1]*motor_msg.data[5] + config[1][2]*motor_msg.data[6] + config[1][3]*motor_msg.data[7] | ||
z = config[2][0]*motor_msg.data[0] + config[2][1]*motor_msg.data[1] + config[2][2]*motor_msg.data[2] + config[2][3]*motor_msg.data[3] | ||
|
||
# Angular Thrust Vector | ||
rx = config[3][0]*motor_msg.data[0] + config[3][1]*motor_msg.data[1] + config[3][2]*motor_msg.data[2] + config[3][3]*motor_msg.data[3] + config[3][4]*motor_msg.data[4] + config[3][5]*motor_msg.data[5] + config[3][6]*motor_msg.data[6] + config[3][7]*motor_msg.data[7] | ||
ry = config[4][0]*motor_msg.data[0] + config[4][1]*motor_msg.data[1] + config[4][2]*motor_msg.data[2] + config[4][3]*motor_msg.data[3] + config[4][4]*motor_msg.data[4] + config[4][5]*motor_msg.data[5] + config[4][6]*motor_msg.data[6] + config[4][7]*motor_msg.data[7] | ||
rz = config[5][0]*motor_msg.data[0] + config[5][1]*motor_msg.data[1] + config[5][2]*motor_msg.data[2] + config[5][3]*motor_msg.data[3] + config[5][4]*motor_msg.data[4] + config[5][5]*motor_msg.data[5] + config[5][6]*motor_msg.data[6] + config[5][7]*motor_msg.data[7] |
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 is basically unreadable, is it possible to do this in a clearer and more programmatic (rather than purely mathematical) fashion?
The line length is very long too, if you don't take my above advice can you at least format it so its broken out onto separate lines?
config = [ | ||
[0, 0, 0, 0, 0.7071, 0.7071, -0.7071, -0.7071], | ||
[0, 0, 0, 0, -0.7071, 0.7071, -0.7071, 0.7071], | ||
[1, 1, 1, 1, 0, 0, 0, 0], | ||
[-.19, -.19, .19, .19, -.105, -.105, .105, .105], | ||
[-.12, .12, -.12, .12, -.15, .15, -.15, .15], | ||
[-.047,-.047,-.047, -.047, 0.038, 0.038, 0.038, 0.038] | ||
] |
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.
Can you add a brief code comment describing what exactly this is, and how we got it? We can save specifics for markdown documentation (should probably write that too!)
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.
src/seahawk/seahawk_deck/thrust.py
Outdated
self.motor_config = [ | ||
[0, 0, 0, 0, 0.7071, 0.7071, -0.7071, -0.7071], | ||
[0, 0, 0, 0, -0.7071, 0.7071, -0.7071, 0.7071], | ||
[1, 1, 1, 1, 0, 0, 0, 0], | ||
[-.19, -.19, .19, .19, -.105, -.105, .105, .105], | ||
[-.12, .12, -.12, .12, -.15, .15, -.15, .15], | ||
[-.047,-.047,-.047, -.047, 0.038, 0.038, 0.038, 0.038] | ||
] |
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.
Can you add a brief code comment describing what exactly this is, and how we got it? We can save specifics for markdown documentation (should probably write that too!)
…ion relative to CoM
Adds new file to verify vectors (thrustverify.py), while modifying thrust.py. Trustverify.py takes in published thruster data from thrust.py, and predicts what input vector would have created those values. Such predicted vector is published to "drive/predict", in order to verify the robot is firing its thrusters in the predicted manner.