• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MatrixDcMotorController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.qualcomm.hardware.matrix.MatrixDcMotorController的典型用法代码示例。如果您正苦于以下问题:Java MatrixDcMotorController类的具体用法?Java MatrixDcMotorController怎么用?Java MatrixDcMotorController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MatrixDcMotorController类属于com.qualcomm.hardware.matrix包,在下文中一共展示了MatrixDcMotorController类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: mapMatrixController

import com.qualcomm.hardware.matrix.MatrixDcMotorController; //导入依赖的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);
    }
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:19,代码来源:XtensibleEventLoop.java


示例2: init

import com.qualcomm.hardware.matrix.MatrixDcMotorController; //导入依赖的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 = (MatrixDcMotorController)ahwMap.dcMotorController.get("matrix controller");
        matrixServoController = ahwMap.servoController.get("matrix controller");

        // Enable Servos
        matrixServoController.pwmEnable();       // Don't forget to enable Matrix Output
    }
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:34,代码来源:HardwarePushbotMatrix.java


示例3: init

import com.qualcomm.hardware.matrix.MatrixDcMotorController; //导入依赖的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
    }
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:34,代码来源:HardwarePushbotMatrix.java


示例4: init

import com.qualcomm.hardware.matrix.MatrixDcMotorController; //导入依赖的package包/类
@Override
public void init()
{
    motor1 = hardwareMap.dcMotor.get("motor_1");
    motor2 = hardwareMap.dcMotor.get("motor_2");
    motor3 = hardwareMap.dcMotor.get("motor_3");
    motor4 = hardwareMap.dcMotor.get("motor_4");

    /*
     * A set of motors to use with the Matrix motor controller's
     * pending feature.  See example below.  Note that this is
     * completely optional.
     */
    motorSet.add(motor1);
    motorSet.add(motor2);
    motorSet.add(motor3);
    motorSet.add(motor4);

    servo1 = hardwareMap.servo.get("servo_1");
    servo2 = hardwareMap.servo.get("servo_2");
    servo3 = hardwareMap.servo.get("servo_3");
    servo4 = hardwareMap.servo.get("servo_4");

    /*
     * 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 appending Motor and Servo to the name
     * given in the configuration.  In the example below the name
     * of the controller is "MatrixController" so the motor controller
     * instance is "MatrixControllerMotor" and the servo controller
     * instance is "MatrixControllerServo".
     */
    mc = (MatrixDcMotorController)hardwareMap.dcMotorController.get("MatrixController");
    motor1.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
    motor2.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
    motor3.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
    motor4.setMode(DcMotor.RunMode.RUN_USING_ENCODER);

    /*
     * Servos are not enabled by default.  Software must call pwmEnable()
     * for servos to function.
     */
    sc = hardwareMap.servoController.get("MatrixController");
    sc.pwmEnable();
}
 
开发者ID:forgod01,项目名称:5094-2016-2017,代码行数:50,代码来源:MatrixControllerDemo.java


示例5: init

import com.qualcomm.hardware.matrix.MatrixDcMotorController; //导入依赖的package包/类
@Override
public void init()
{
    motor1 = hardwareMap.dcMotor.get("motor_1");
    motor2 = hardwareMap.dcMotor.get("motor_2");
    motor3 = hardwareMap.dcMotor.get("motor_3");
    motor4 = hardwareMap.dcMotor.get("motor_4");

    /*
     * A set of motors to use with the Matrix motor controller's
     * pending feature.  See example below.  Note that this is
     * completely optional.
     */
    motorSet.add(motor1);
    motorSet.add(motor2);
    motorSet.add(motor3);
    motorSet.add(motor4);

    servo1 = hardwareMap.servo.get("servo_1");
    servo2 = hardwareMap.servo.get("servo_2");
    servo3 = hardwareMap.servo.get("servo_3");
    servo4 = hardwareMap.servo.get("servo_4");

    /*
     * 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 appending Motor and Servo to the name
     * given in the configuration.  In the example below the name
     * of the controller is "MatrixController" so the motor controller
     * instance is "MatrixControllerMotor" and the servo controller
     * instance is "MatrixControllerServo".
     */
    mc = (MatrixDcMotorController)hardwareMap.dcMotorController.get("MatrixController");
    motor1.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    motor2.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    motor3.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    motor4.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);

    /*
     * Servos are not enabled by default.  Software must call pwmEnable()
     * for servos to function.
     */
    sc = hardwareMap.servoController.get("MatrixController");
    sc.pwmEnable();
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:FTC-Simple,代码行数:50,代码来源:MatrixControllerDemo.java


示例6: init

import com.qualcomm.hardware.matrix.MatrixDcMotorController; //导入依赖的package包/类
@Override
public void init() {
    motor1 = hardwareMap.dcMotor.get("motor_1");
    motor2 = hardwareMap.dcMotor.get("motor_2");
    motor3 = hardwareMap.dcMotor.get("motor_3");
    motor4 = hardwareMap.dcMotor.get("motor_4");

    /*
     * A set of motors to use with the Matrix motor controller's
     * pending feature.  See example below.  Note that this is
     * completely optional.
     */
    motorSet.add(motor1);
    motorSet.add(motor2);
    motorSet.add(motor3);
    motorSet.add(motor4);

    servo1 = hardwareMap.servo.get("servo_1");
    servo2 = hardwareMap.servo.get("servo_2");
    servo3 = hardwareMap.servo.get("servo_3");
    servo4 = hardwareMap.servo.get("servo_4");

    /*
     * 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 appending Motor and Servo to the name
     * given in the configuration.  In the example below the name
     * of the controller is "MatrixController" so the motor controller
     * instance is "MatrixControllerMotor" and the servo controller
     * instance is "MatrixControllerServo".
     */
    mc = (MatrixDcMotorController) hardwareMap.dcMotorController.get("MatrixController");
    motor1.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    motor2.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    motor3.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    motor4.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);

    /*
     * Servos are not enabled by default.  Software must call pwmEnable()
     * for servos to function.
     */
    sc = hardwareMap.servoController.get("MatrixController");
    sc.pwmEnable();
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:TeamClutch2016,代码行数:49,代码来源:MatrixControllerDemo.java



注:本文中的com.qualcomm.hardware.matrix.MatrixDcMotorController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GraphicsUtilities类代码示例发布时间:2022-05-22
下一篇:
Java Properties类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap