StimDc / FTC_2022-2023

de ce merge?
BSD 3-Clause Clear License
3 stars 0 forks source link

redoing the control part #5

Open runiixx opened 1 year ago

runiixx commented 1 year ago

TO DO:

StimDc commented 1 year ago

Update 02.02.23

We had a TeleOp for the control phase but it was very janky and a lot of redundant code + there were a few issues that would impact the hardware so we started recreating the code for the control phase.

Changes:

runiixx commented 1 year ago

Update 06.02.23

Robot movements are smooth now and the drivers love that but now its time to finish recoding the control part by implementing the slider . At first we used the joystick to move the slider but there were issues with it because whenever the drivers would lower the slider , it would come down crashing and using the setZeroPowerBehaviour(DcMotor.ZeroPowerBehaviour.BRAKE); there were moments when the slider would still move upward and cause troubles. We solved that by removing the code and bringing some part of autonomous code in the control part by using encoders. To do that we used for testing the buttons a and b on the gamepad and whenever the driver would press one of the buttons the slider would rise to a certain distance (optimised for the poles). The height of the slider would be stored in a variable called heightSlider and whenever we want to raise the slider to the height of the small/medium/big pole we just set the motor to rotate for the diference of the height of the pole and the current height of the slider. After implementing that in a rudimentary way, the slider would infinitely raise on its own and after stopping the robot, it would just crash saying it was stuck in an infinite loop in the sleep() function.We debugged the code and found out that:

  1. whenever the button is pressed the code would get executed hundreds of times because the loop repeats so fast and screws with the encoders
  2. using while(slider.isBusy() causes the robot to crash After that the only issue left was that the slider would rise 4 times exactly the number of viperslides the slider has so we divided the distance by 4. Now that all the errors are solved the slider would raise on its own to the corect height and tomorrow we would debug and optimise the code so that we can get rid of every bug.