Closed StimDc closed 1 year ago
Since we want to create multiple OpModes for the autonomous phase, we will reuse some of the code for the robot (especially the movement with encoders code). For that we have created a class named StimDC ( our team's name) and put there every function for autonomous . In final the code for testing encoders is lighter and the sintax has not changed that much.
For initialising the robot class :
StimDC robot = new StimDC(DcMotor1,DcMotor2,DcMotor3,DcMotor4);
And for any movement from:
forward(30,0.3);
-> robot.forward(30,0.3);
lateral(30,0.3,"left");
-> robot.lateral(30,0.3,"left");
rotate(90,0.3,"left");
-> robot.rotate(90,0.3,"left");
Today after we saw that the robot got a rotatory base for the slider and realised we should start creating some scenarios for the Autonomous phase . By scenarios we mean if something happens with the robot (camera does not work, a motor disfunctions or our allay team made a strategy that is not compatible with our own). We have created for start 2 new files DreaptaCuCamera
meaning the robot will start on the right side of the field and has a working camera and DreaptaFaraCamera
meaning the robot will start on the right side of the field and does not having a working camera. Both programs will make the robot walk towards a tall pole and puts exactly 5 cones on that pole but the difference comes in parking because the opMode without camera will just park in th middle front. The one with camera will park in the front left , front or front right square , based on the position of the maskot it sees
This day marks an important date for our progress with the autonomous phase. We have deleted those 2 files from yesterder, DreaptaCuCamera and DreaptaFaraCamera and added 8 new ones with a naming scheme. The first word in our name means if the robot will be positioned on the right or left side of the game field. The second word means which pole will be chosen to put cones , if it will be the tallest or the medium because the tallest pole is on the same distance from our team position to the other one. The third word and the last one means if the opMode has a camera working or not.
The code in those files are similar except there is a difference between the OpModes with Camera and the ones without. The one with camera has a new function called parking()
and when executed, the robot parks on the left or on the right square based on the image it sees, autononomie()
is where our main code for movement is placed.
TO DO: