Fixes to support LinearAlgebra repo
This commit is contained in:
parent
09b0fa84f3
commit
552d6cab96
@ -4,10 +4,10 @@ from LinearAlgebra.Angle import Angle
|
||||
|
||||
def SendAngle8(buffer, ix_ref, angle):
|
||||
"""! Send an 8-bit angle value """
|
||||
angle = Angle.Normalize(angle)
|
||||
# angle = Angle.Normalize(angle)
|
||||
|
||||
ix = ix_ref[0]
|
||||
buffer[ix] = int((angle / 360) * 256).to_bytes(1, 'big', signed=True)[0]
|
||||
buffer[ix] = int((angle.InDegrees() / 360) * 256).to_bytes(1, 'big', signed=True)[0]
|
||||
ix_ref[0] += 1
|
||||
|
||||
def SendFloat16(buffer, ix_ref, value):
|
||||
|
@ -65,13 +65,14 @@ class DifferentialDrive(Thing):
|
||||
# This assumes no sideward velocity because diff drive does not support it
|
||||
linear_speed = self.linear_velocity.distance
|
||||
# When the direction is backwards...
|
||||
if self.linear_velocity.direction.horizontal < -90 or self.linear_velocity.direction.horizontal > 90:
|
||||
horizontalAngle = self.linear_velocity.direction.horizontal.InDegrees()
|
||||
if horizontalAngle < -90 or horizontalAngle > 90:
|
||||
linear_speed = -linear_speed
|
||||
|
||||
angular_velocity: Spherical = self.angular_velocity
|
||||
angular_speed: float = angular_velocity.distance * Angle.Deg2Rad # in radians/sec
|
||||
# Determine the rotation direction
|
||||
if angular_velocity.direction.horizontal < 0:
|
||||
if angular_velocity.direction.horizontal.InDegrees() < 0:
|
||||
angular_speed = -angular_speed
|
||||
|
||||
if self.wheel_left is not None and self.wheel_right is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user