Skip to content

Commit

Permalink
Merge pull request #34 from RoboTeamTwente/fix/joystick
Browse files Browse the repository at this point in the history
Fix joystick.py crashing on connection with controller
  • Loading branch information
supertom01 authored May 11, 2023
2 parents 7c638fb + e9c6b53 commit 6150ec3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python_utils/joystick.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def loop(self):
self.event_handler.record_event(id, "New controller discovered")
except Exception as e:
print(e)
sleep(1)
time.sleep(1)
pass

time.sleep(0.1)
Expand Down Expand Up @@ -199,7 +199,7 @@ def get_payload(self):
velocity_y = ( abs(self.controller.axis_l.y) - deadzone) / (1 - deadzone)
velocity_y *= np.sign(self.controller.axis_l.y)

rho = math.sqrt(velocity_x * velocity_x + velocity_y * velocity_y) * 1
rho = math.sqrt(velocity_x * velocity_x + velocity_y * velocity_y) * 0.7
theta = math.atan2(velocity_x, -velocity_y);

self.command.toRobotId = self.robot_id
Expand Down

0 comments on commit 6150ec3

Please sign in to comment.