FRC1076 / FRC1076/PyLights

Add realistic movement to the joystick.

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

If you give a velocity to the joystick, (small random vector) you can move it in a consistent direction by just applying the velocity to the position.

If you roll a dice and only change direction when it rolls a 1, then you'll keep the joystick moving in the same direction more often than you will change direction. In the case of the 1, you'll want to generate another random velocity.

Remember joystick values stay in the -1,1 range, so you'll need to reverse the velocity if it is going to put you out of that range.

User of the joystick creates a joystick, and then in the robot loop, it calls the move() method, and then the getX and getY methods. You'll need to store a velocity in an instance variable, but all of the heavy lifting can be done in the move() method.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.