本文整理汇总了Java中com.qualcomm.robotcore.hardware.ServoController类的典型用法代码示例。如果您正苦于以下问题:Java ServoController类的具体用法?Java ServoController怎么用?Java ServoController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServoController类属于com.qualcomm.robotcore.hardware包,在下文中一共展示了ServoController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapMatrixController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
private void mapMatrixController(HardwareMap map, DeviceManager deviceMgr, LegacyModule legacyModule, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) return;
MatrixMasterController master = new MatrixMasterController((ModernRoboticsUsbLegacyModule) legacyModule, devConf.getPort());
DcMotorController mc = new MatrixDcMotorController(master);
map.dcMotorController.put(devConf.getName() + "Motor", mc);
map.dcMotorController.put(devConf.getName(), mc);
for (DeviceConfiguration motorConf : ((MatrixControllerConfiguration) devConf).getMotors()) {
mapMotor(map, deviceMgr, motorConf, mc);
}
ServoController sc = new MatrixServoController(master);
map.servoController.put(devConf.getName() + "Servo", sc);
map.servoController.put(devConf.getName(), sc);
for (DeviceConfiguration servoConf : ((MatrixControllerConfiguration) devConf).getServos()) {
mapServo(map, deviceMgr, servoConf, sc);
}
}
示例2: getController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
/**
* This method returns the servo controller object that this servo is plugged into.
*
* @return servo controller object.
*/
public ServoController getController()
{
final String funcName = "getController";
if (debugEnabled)
{
dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);
dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API, controller.toString());
}
return controller;
}
示例3: init
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public void init(HardwareMap ahwMap) {
// Initialize base Motor and Servo objects
super.init(ahwMap);
/*
* Matrix controllers are special.
*
* A Matrix controller is one controller with both motors and servos
* but software wants to treat it as two distinct controllers, one
* DcMotorController, and one ServoController.
*
* We accomplish this by initializing Motor and Servo controller with the same name
* given in the configuration. In the example below the name of the controller is
* "MatrixController"
*
* Normally we don't need to access the controllers themselves, we deal directly with
* the Motor and Servo objects, but the Matrix interface is different.
*
* In order to activate the servos, they need to be enabled on the controller with
* a call to pwmEnable() and disabled with a call to pwmDisable()
*
* Also, the Matrix Motor controller interface provides a call that enables all motors to
* updated simultaneously (with the same value).
*/
// Initialize Matrix Motor and Servo objects
matrixMotorController = ahwMap.get(MatrixDcMotorController.class, "matrix controller");
matrixServoController = ahwMap.get(ServoController.class, "matrix controller");
// Enable Servos
matrixServoController.pwmEnable(); // Don't forget to enable Matrix Output
}
示例4: createDeviceMaps
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
/**
* Move the propriety {@link HardwareMap.DeviceMapping} to our {@link DeviceMap} for our
* internal use
*/
private void createDeviceMaps() {
fullMap.checkedPut(DcMotorController.class, new DeviceMap<>(basicMap.dcMotorController));
fullMap.checkedPut(DcMotor.class, new DeviceMap<>(basicMap.dcMotor));
fullMap.checkedPut(ServoController.class, new DeviceMap<>(basicMap.servoController));
fullMap.checkedPut(Servo.class, new DeviceMap<>(basicMap.servo));
fullMap.checkedPut(LegacyModule.class, new DeviceMap<>(basicMap.legacyModule));
fullMap.checkedPut(TouchSensorMultiplexer.class, new DeviceMap<>(basicMap.touchSensorMultiplexer));
fullMap.checkedPut(DeviceInterfaceModule.class, new DeviceMap<>(basicMap.deviceInterfaceModule));
fullMap.checkedPut(AnalogInput.class, new DeviceMap<>(basicMap.analogInput));
fullMap.checkedPut(DigitalChannel.class, new DeviceMap<>(basicMap.digitalChannel));
fullMap.checkedPut(OpticalDistanceSensor.class, new DeviceMap<>(basicMap.opticalDistanceSensor));
fullMap.checkedPut(TouchSensor.class, new DeviceMap<>(basicMap.touchSensor));
fullMap.checkedPut(PWMOutput.class, new DeviceMap<>(basicMap.pwmOutput));
fullMap.checkedPut(I2cDevice.class, new DeviceMap<>(basicMap.i2cDevice));
fullMap.checkedPut(AnalogOutput.class, new DeviceMap<>(basicMap.analogOutput));
fullMap.checkedPut(ColorSensor.class, new DeviceMap<>(basicMap.colorSensor));
fullMap.checkedPut(LED.class, new DeviceMap<>(basicMap.led));
fullMap.checkedPut(AccelerationSensor.class, new DeviceMap<>(basicMap.accelerationSensor));
fullMap.checkedPut(CompassSensor.class, new DeviceMap<>(basicMap.compassSensor));
fullMap.checkedPut(GyroSensor.class, new DeviceMap<>(basicMap.gyroSensor));
fullMap.checkedPut(IrSeekerSensor.class, new DeviceMap<>(basicMap.irSeekerSensor));
fullMap.checkedPut(LightSensor.class, new DeviceMap<>(basicMap.lightSensor));
fullMap.checkedPut(UltrasonicSensor.class, new DeviceMap<>(basicMap.ultrasonicSensor));
fullMap.checkedPut(VoltageSensor.class, new DeviceMap<>(basicMap.voltageSensor));
LinkedHashMultimap<DcMotorController, DcMotor> multimap = LinkedHashMultimap.create();
for (DcMotor motor : dcMotors()) {
multimap.put(motor.getController(), motor);
}
}
示例5: mapUsbServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
private void mapUsbServoController(HardwareMap map, DeviceManager deviceMgr, ControllerConfiguration ctrlConf) throws RobotCoreException, InterruptedException {
if (!ctrlConf.isEnabled()) return;
ServoController servoController = deviceMgr.createUsbServoController(ctrlConf.getSerialNumber());
map.servoController.put(ctrlConf.getName(), servoController);
for (DeviceConfiguration servoConf : ctrlConf.getDevices()) {
mapServo(map, deviceMgr, servoConf, servoController);
}
}
示例6: mapNxtServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
private void mapNxtServoController(HardwareMap map, DeviceManager deviceMgr, LegacyModule legacyModule, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) return;
ServoController sc = deviceMgr.createNxtServoController(legacyModule, devConf.getPort());
map.servoController.put(devConf.getName(), sc);
for (DeviceConfiguration servoConf : ((ServoControllerConfiguration) devConf).getServos()) {
mapServo(map, deviceMgr, servoConf, sc);
}
}
示例7: calculateUsbDevices
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
protected int calculateUsbDevices(HardwareMap map) {
byte var2 = 0;
int var7 = var2 + map.legacyModule.size();
var7 += map.deviceInterfaceModule.size();
Iterator var3 = map.servoController.iterator();
String var5;
Pattern pattern = Pattern.compile("(?i)usb");
while (var3.hasNext()) {
ServoController var4 = (ServoController) var3.next();
var5 = var4.getDeviceName();
if (pattern.matcher(var5).find()) {
++var7;
}
}
var3 = map.dcMotorController.iterator();
while (var3.hasNext()) {
DcMotorController var8 = (DcMotorController) var3.next();
var5 = var8.getDeviceName();
pattern = Pattern.compile("(?i)usb");
if (pattern.matcher(var5).find()) {
++var7;
}
}
return var7;
}
示例8: calculateUsbDevices
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
protected int calculateUsbDevices(HardwareMap map) {
byte var2 = 0;
int var7 = var2 + map.legacyModule.size();
var7 += map.deviceInterfaceModule.size();
Iterator var3 = map.servoController.iterator();
String var5;
Pattern var6;
while (var3.hasNext()) {
ServoController var4 = (ServoController) var3.next();
var5 = var4.getDeviceName();
var6 = Pattern.compile("(?i)usb");
if (var6.matcher(var5).matches()) {
++var7;
}
}
var3 = map.dcMotorController.iterator();
while (var3.hasNext()) {
DcMotorController var8 = (DcMotorController) var3.next();
var5 = var8.getDeviceName();
var6 = Pattern.compile("(?i)usb");
if (var6.matcher(var5).matches()) {
++var7;
}
}
return var7;
}
示例9: isLegacyServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public static boolean isLegacyServoController(ServoController controller) {
return controller instanceof HiTechnicNxtServoController;
}
示例10: isModernServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public static boolean isModernServoController(ServoController controller) {
return controller instanceof ModernRoboticsUsbServoController;
}
示例11: legacyModuleOfLegacyServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public static LegacyModule legacyModuleOfLegacyServoController(ServoController controller) {
return Util.getPrivateObjectField(controller, 0);
}
示例12: portOfLegacyServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public static int portOfLegacyServoController(ServoController controller) {
return Util.getPrivateIntField(controller, 3);
}
示例13: i2cAddrOfLegacyServoController
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public static int i2cAddrOfLegacyServoController(ServoController controller) {
return 0x02;
}
示例14: setControllerOfServo
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
public static void setControllerOfServo(Servo servo, ServoController controller) {
Util.setPrivateObjectField(servo, 0, controller);
}
示例15: servoControllers
import com.qualcomm.robotcore.hardware.ServoController; //导入依赖的package包/类
/**
* Returns a {@link DeviceMap<DcMotorController>} for use to access Servo Controller hardware
*
* @return a DeviceMap to use for access to representations of DC Motor Controllers
* @see DeviceMap
* @see DcMotorController
*/
public DeviceMap<ServoController> servoControllers() {
return fullMap.checkedGet(ServoController.class);
}