FTC-ORBIT / 14029-Powerplay

14029's robot code for the 2022-2023 season: powerplay!
BSD 3-Clause Clear License
1 stars 0 forks source link

Minimize sensor reads #14

Open Ido-Sobol opened 2 years ago

Ido-Sobol commented 2 years ago

In order to decrease our cycle time, we should only check each sensor value one time in each cycle, instead of multiple.

To do it we should save the sensor value in a variable and make sure we are updating it when we need. For example, create a variable for odometry pose, update it in the "operate()" function and then use this variable instead of reading from the sensors.

Ido-Sobol commented 2 years ago

Also reduce motor.setPower() to one place for each motor.