Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Teo vector verifcation #177

wants to merge 14 commits into from

Conversation

taschnell
Copy link
Member

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.

@taschnell taschnell assigned taschnell and unassigned taschnell Nov 17, 2023
@mike-matera
Copy link
Member

This fixex #172

@OrionOth OrionOth linked an issue Nov 17, 2023 that may be closed by this pull request
Comment on lines 98 to 107
# 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]
Copy link
Member

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?

Copy link
Member

@OrionOth OrionOth left a 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)

Comment on lines 58 to 66
# 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]
Copy link
Member

@OrionOth OrionOth Nov 17, 2023

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?

Comment on lines 49 to 56
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]
]
Copy link
Member

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!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These latest changes (757736b, 8bce7db), while they do help, don't particularly resolve describing what config is exactly. It's good you are describing the components of it, however.

Comment on lines 45 to 52
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]
]
Copy link
Member

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kinematics Verification
4 participants