Skip to content

Commit f04b081

Browse files
committed
updated driveDistance for lens auto
- coordinated strafe with milliseconds - deleted driveDistance test in Blue_close_w_huskey
1 parent 1642ae1 commit f04b081

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

TeamCode/src/main/java/org/mrpsvt/capital_robotics/auto/Blue_close_w_huskey.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,13 @@ private void autonomousSequence() throws InterruptedException
104104
telemetry.update();
105105
driveDistance(.5, 0, 0, 1700);
106106

107-
// drive distance test
108-
driveDistance(0, 1, 0, 400);
109-
sleep(3000);
110-
driveDistance(0, -1, 0, 400);
111-
sleep(3000);
112-
driveDistance(0, .3, 0, 200);
113-
sleep(3000);
114-
driveDistance(0, -.3, 0, 200);
115-
sleep(3000);
116107

117108
// step 2.5: activate camera homing for x coordinate
118-
/*
109+
119110
telemetry.addData("step", "huskey x homing");
120111
telemetry.update();
121112
ourHuskeymethod.homingLens();
122-
*/
113+
123114

124115
/*
125116
//+ to the rigth - to the lefft

TeamCode/src/main/java/org/mrpsvt/capital_robotics/auto/husky_method.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,46 +82,62 @@ public void homingLens()
8282
int h = 41;
8383
int w = 41;
8484
int change = 0;
85+
int lor = 0;
8586

8687
// driveDistance(), - = foreward, - = right, unknown
8788
while (tagX > (x - 3) || tagX < (x + 3))
8889
{
8990
telemetry.addData("action", "triangulating x");
9091
if (tagX > x && change == 0)
9192
{
92-
driveDistance(0, .3, 0, 400);
93+
driveDistance(0, .5, 0, 400);
9394
tagX = block.x;
9495
if (tagX < x)
9596
{
9697
change++;
9798
}
99+
lor = 0;
98100
}
99101
else if (tagX > x && change > 1)
100102
{
101-
driveDistance(0, .3, 0, (long) (400 * Math.pow(.75, change)));
103+
driveDistance(0, .5 * Math.pow(.75, change), 0, (long) (400 * Math.pow(.75, change)));
102104
tagX = block.x;
103105
if (tagX < x)
104106
{
105107
change++;
106108
}
109+
lor = 0;
107110
}
108111
else if (tagX < x && change == 0)
109112
{
110-
driveDistance(0, -.3, 0, 400);
113+
driveDistance(0, -.5, 0, 400);
111114
tagX = block.x;
112115
if (tagX > x)
113116
{
114117
change++;
115118
}
119+
lor = 1;
116120
}
117121
else if (tagX < x && change > 1)
118122
{
119-
driveDistance(0, -.3, 0, (long) (400 * Math.pow(.75, change)));
123+
driveDistance(0, -.5 * Math.pow(.75, change), 0, (long) (400 * Math.pow(.75, change)));
120124
tagX = block.x;
121125
if (tagX > x)
122126
{
123127
change++;
124128
}
129+
lor = 1;
130+
}
131+
else
132+
{
133+
if (lor == 0)
134+
{
135+
driveDistance(0, -.3, 0, 400);
136+
}
137+
else
138+
{
139+
driveDistance(0, .3, 0, 400);
140+
}
125141
}
126142
}
127143

0 commit comments

Comments
 (0)