Skip to content

底座系統

KennHuang edited this page Jan 22, 2019 · 3 revisions

這一頁將會說明如何使用 OverRobotLib 建立底座系統

Drive base

目前只有提供 DifferentialDrive 可供使用。

DifferentialDrive

Package org.team6083.lib.drive

先建立左、右側的 SpeedController 物件,然後放入 DifferentalDrive 建立底座物件。

SpeedController l_motor1 = new VictorSP(0);
SpeedController l_motor2 = new VictorSP(1);
SpeedController r_motor1 = new VictorSP(2);
SpeedController r_motor2 = new VictorSP(3);
DifferentialDrive drive = new DifferentialDrive(l_motor1, l_motor2, r_motor1, r_motor2);

使用搖桿控制

TankDrive tankDrive​(TankInput input)

TankInput input = new XBoxController(0);
drive.tankDrive(input);

直接輸入控制

directControl​(double leftSpeed, double rightSpeed)

drive.directControl​(0.5,0.5);
Clone this wiki locally