Skip to content

Commit 92cbbae

Browse files
author
年迈的老秋风Windy
committed
Add Servo Standardization
1 parent ec8886b commit 92cbbae

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.darbots.corebotlib.hardware;
2+
3+
import org.darbots.corebotlib.hardware.typedef.instances.ServoTypeInstance;
4+
5+
public interface Servo {
6+
/**
7+
* Get last set position
8+
* @return Last set position in range of [-1,1]
9+
*/
10+
double getTargetPosition();
11+
12+
/**
13+
* Set a target position for servo
14+
* @param targetPosition target position in range [-1, 1]
15+
*/
16+
void setTargetPosition(double targetPosition);
17+
ServoTypeInstance getServoType();
18+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.darbots.corebotlib.hardware;
2+
3+
import org.darbots.corebotlib.hardware.typedef.instances.ServoTypeInstance;
4+
5+
public class ServoUsingMotor implements Servo, AsyncDevice {
6+
7+
@Override
8+
public double getTargetPosition() {
9+
return 0;
10+
}
11+
12+
@Override
13+
public void setTargetPosition(double targetPosition) {
14+
15+
}
16+
17+
@Override
18+
public ServoTypeInstance getServoType() {
19+
return null;
20+
}
21+
22+
@Override
23+
public boolean isBusy() {
24+
return false;
25+
}
26+
27+
@Override
28+
public void update() {
29+
30+
}
31+
}

0 commit comments

Comments
 (0)