public class LineFollower
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
int |
calibrate()
Run calibration for line sensor
|
int |
calibrate(boolean reset)
Reset the data of calibration to default RGB values
|
int |
demo()
Start line following with default configuration patterns
Default pattern config as bellow: G-R-G: stop, B-R-B: turn left, B-G-B: turn right, G-B-G: turn around, R-G-R: go straight, R-B-R: speed up, G-R-B: slow down, B-R-G: normal speed, |
int |
followLine()
Start line following by using default configuration
Continue reterning onResult Callback of "color_Result" and "Pattern_Result" if during line following
with the bundle key of "Color_Result" and "Pattern_Result".
|
int |
followLine(MotionControl.SpeedLevel.LineFollower speedLevel)
Start line following by using default configuration with different speed levels
Continue reterning onResult Callback of "color_Result" and "Pattern_Result" if during line following
with the bundle key "Color_Result" and "Pattern_Result".
|
int |
followLine(java.lang.String jsonString)
Start line following with customized configuration.
|
int |
getColor()
Return RGB values in order to get which color it is (Black?
|
int |
setBehavior(int serial,
LineFollowerConfig.Behavior behavior,
java.lang.Object... args)
Set behavior immediately during line following
|
int |
updateConfig(int serial,
java.lang.String jsonString)
Update configuration during line following
|
public int calibrate()
public int calibrate(boolean reset)
reset - true reset to default RGB valuepublic int demo()
public int followLine()
public int followLine(MotionControl.SpeedLevel.LineFollower speedLevel)
speedLevel - from L1 to L3 (L1 is the slowest whereas L3 is the fastest)MotionControl.SpeedLevel.LineFollowerpublic int followLine(java.lang.String jsonString)
jsonString - can be generated with LineFollowerConfig to render JSON strings.LineFollowerConfigpublic int getColor()
public int setBehavior(int serial,
LineFollowerConfig.Behavior behavior,
java.lang.Object... args)
serial - The serial number during line followingbehavior - The default settings of the configuration is
Behavior.NOTHING.
Can't change the setting of Behavior.UNKNOWN.args - The settings of Behavior.SPEED_LEVEL and
Behavior.ROTATION require third parameter
SpeedLevel.LineFollower.
The settings of Behavior.ROTATION requires
inputting rotational angle (in degree).LineFollowerConfig.Behaviorpublic int updateConfig(int serial,
java.lang.String jsonString)
serial - The serial number during line followingjsonString - can be generated with LineFollowerConfig to render JSON strings.LineFollowerConfig