StimDc / FTC_2022-2023

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

Testing robot movements #1

Closed RunaAM closed 1 year ago

RunaAM commented 1 year ago

The code for moving to the left or right and rotating is 90% complete but testing is required for the autonomous phase.

StimDc commented 1 year ago
RunaAM commented 1 year ago

Update 12.01.23

Lateral movement for the robot is completed and fully calibrated. At first the robot only ran forward even though the left_right() function was called. After some inspecting we found out that the distance was always a positive number and setting the power to a negative value did not work as expected. To fix this, we deleted the function run_to_position() since it was redundant to be there because we would need to set for each motor a positive or negative value and added a new function set_power() to set power to all motors . After debugging this and made the robot move left and right we discovered that it didnt moved enough . We set the distance for 100 cm and after running the robot moved to the left 88 cm. We took those numbers and calculating what number we should put in the robot's code for it to move 100 cm and the result was 113.63 cm. In the end we divide this number by 100 and made a variable that will store this value and whenever we want to move left or right the distance will be multiplied by 1.1363. In final we have done some final tests and the accuracy for distance was significantly improve to around 99.2% (100% if we ignore that the center of gravity of the robot is not centered due to the battery not being fixed properly)

StimDc commented 1 year ago

Update 13.01.23

Added rotations for robot. The function rotate() takes as parameters degrees, power and direction . Since the robot does not understand what an angle is and how much to rotate, we converted degrees into distance. At first we defined a constant that defines how much to move for the robot to rotate 90 angle. The answer was 55 cm and we just divide degrees by 90 and then multiply with that constant. Now the robot, will turn exactly how much we want.