FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
RotatingCamera/teamcode/Camera.java at master · nullObjectReference/RotatingCamera · GitHub
nullObjectReference
/
RotatingCamera
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
RotatingCamera
/
teamcode
/
Camera.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
77 lines (53 loc) · 1.86 KB
Breadcrumbs
RotatingCamera
/
teamcode
/
Camera.java
Copy path
File metadata and controls
77 lines (53 loc) · 1.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package
org
.
firstinspires
.
ftc
.
teamcode
;
import
com
.
qualcomm
.
robotcore
.
eventloop
.
opmode
.
LinearOpMode
;
import
com
.
qualcomm
.
robotcore
.
eventloop
.
opmode
.
TeleOp
;
import
com
.
qualcomm
.
robotcore
.
hardware
.
Servo
;
import
com
.
qualcomm
.
robotcore
.
util
.
Range
;
@
TeleOp
(
name
=
"Rotating Camera"
,
group
=
"mm"
)
public
class
Camera
extends
LinearOpMode
{
public
AprilTags
aprilTags
;
private
Servo
cameraMount
=
null
;
double
target
=
.5
;
double
bearingMin
=
9999
;
@
Override
public
void
runOpMode
(){
telemetry
.
addLine
(
"Status: Initializing please wait...."
);
telemetry
.
update
();
aprilTags
=
new
AprilTags
(
this
);
initialize
();
aprilTags
.
init
();
telemetry
.
addLine
(
"Status: Initialized, go for it."
);
telemetry
.
update
();
waitForStart
();
while
(
opModeIsActive
() &&
target
==
.5
){
cameraMount
.
setPosition
(
Range
.
clip
(
getTargetPos
(),
0
,
1
));
}
while
(
opModeIsActive
()){}
}
public
double
getTargetPos
(){
double
currentBearing
=
aprilTags
.
getBearing
(
7
);
if
(
currentBearing
<
996
) {
target
-=
currentBearing
*
0.00625
;
}
if
(
currentBearing
<
bearingMin
){
bearingMin
=
currentBearing
;
}
telemetry
.
addData
(
"bearing"
,
currentBearing
);
telemetry
.
addData
(
"initTarget"
,
target
);
// //if (currentBearing != 999) {
// if (target > 1) { //adjust values to ensure they are usable
// target -= 1;
// } else if (target < 0) {
// target += 1;
// }
// }
telemetry
.
addData
(
"target"
,
target
);
telemetry
.
addData
(
"minBearing"
,
bearingMin
);
telemetry
.
update
();
return
target
;
}
private
void
initialize
(){
cameraMount
=
hardwareMap
.
get
(
Servo
.
class
,
"mount"
);
cameraMount
.
setPosition
(
.5
);
}
}
Back
|
FazBrowse Home
|
New Git URL