Skip to content

Commit

Permalink
Updated Motor Configuration in Kinematics to encode torque, not posit…
Browse files Browse the repository at this point in the history
…ion relative to CoM
  • Loading branch information
liamgilligan committed Dec 24, 2023
1 parent 903bd0e commit 61c1f87
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/seahawk/seahawk_deck/thrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ def __init__(self):
super().__init__('thrust')

self.motor_config = [
[ 0, 0, 0, 0, 0.7071, 0.7071, -0.7071, -0.7071 ], # Fx
[ 0, 0, 0, 0, -0.7071, 0.7071, -0.7071, 0.7071 ], # Fy
[ 1, 1, 1, 1, 0, 0, 0, 0 ], # Fz
[ -0.19, -0.19, 0.19, 0.19, -0.105, -0.105, 0.105, 0.105 ], # Rx (mm)
[ -0.12, 0.12, -0.12, 0.12, -0.15, 0.15, -0.15, 0.15 ], # Ry (mm)
[ -0.047, -0.047, -0.047, -0.047, 0.038, 0.038, 0.038, 0.038 ], # Rz (mm)
[ 0, 0, 0, 0, 0.7071, 0.7071, -0.7071, -0.7071 ], # Fx (N)
[ 0, 0, 0, 0, -0.7071, 0.7071, -0.7071, 0.7071 ], # Fy (N)
[ 1, 1, 1, 1, 0, 0, 0, 0 ], # Fz (N)
[ 0.12, -0.12, 0.12, -0.12, -0.0268698, 0.0268698, -0.0268698, 0.0268698 ], # Rx (N*m)
[ -0.19, -0.19, 0.19, 0.19, -0.0268698, -0.0268698, 0.0268698, 0.0268698 ], # Ry (N*m)
[ 0, 0, 0, 0, -0.180311, 0.180311, 0.180311, -0.180311 ], # Rz (N*m)
]

self.inverse_config = np.linalg.pinv(self.motor_config, rcond=1e-15, hermitian=False)

self.subscription = self.create_subscription(Twist, 'drive/twist', self._callback, 10)
Expand Down

1 comment on commit 61c1f87

@liamgilligan
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prior to commit, the torque encoded in the motor_config matrix was just the position of the motor relative to the center of mass, in meters. You can see this reflected unknowingly in the comments as #Rx/y/z (mm). To remedy this, the cross product of the position (r) and the thrust/force the motors produce (F) is taken (r x F).

Comments were also updated to reflect proper units.

Please sign in to comment.