View Single Post
  #1   Spotlight this post!  
Unread 28-11-2015, 15:40
FTC 7037 FTC 7037 is offline
FTC Team
FTC #7037 (Duck and Cover)
 
Join Date: Nov 2015
Rookie Year: 2012
Location: Virginia
Posts: 3
FTC 7037 is an unknown quantity at this point
Question FTC Legacy Module

Our team is having problems with getting the legacy module to power the motors. We have checked all of the ports on the legacy module for problems and we have switched out the motors and the and the motor controllers. Using experimentation we have determined that we can read and write to the motor controller and we can read encoder values from the motor but we cannot set the motor power. Below is a copy of our test code:

Code:
package com.qualcomm.ftcrobotcontroller.opmodes;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.TouchSensor;

public class testTeleop extends OpMode {
    DcMotor Test;
    DcMotorController.DeviceMode devMode;
    DcMotorController Testcontroller;
    TouchSensor touch;
    @Override
    public void init() {
        Test = hardwareMap.dcMotor.get("test");
        Test.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
        Testcontroller = hardwareMap.dcMotorController.get("testcon");
        Testcontroller.setMotorControllerDeviceMode(devMode.WRITE_ONLY);
        touch = hardwareMap.touchSensor.get("touchey");
    }
    @Override
    public void loop() {
        //Test.setPower(1.0);
        //Testcontroller.setMotorPower(2, 1.0);
        /*
        if(gamepad2.dpad_down){
            telemetry.addData("Controller mode", Testcontroller.getMotorChannelMode(2));
        }
        if(gamepad2.dpad_up){
            Testcontroller.setMotorChannelMode(2, DcMotorController.RunMode.RUN_TO_POSITION);
        }
        if(gamepad2.dpad_right){
            Testcontroller.setMotorControllerDeviceMode(devMode.READ_ONLY);
        }
        */
        //telemetry.addData("From motor", Test.getCurrentPosition());
        //telemetry.addData("From Controller", Testcontroller.getMotorCurrentPosition(2));

        if(gamepad2.dpad_up){
            Test.setPower(1.0);
            Testcontroller.setMotorPower(1, 1.0);
            Testcontroller.setMotorPower(2, 1.0);
            telemetry.addData("Going up?", "nope");
        }
        else if(gamepad2.dpad_down) {
            Test.setPower(-1.0);
            Testcontroller.setMotorPower(1, -1.0);
            Testcontroller.setMotorPower(2, -1.0);
            telemetry.addData("Going down?", "nope");
        }
        else{
            Test.setPower(0.0);
            Testcontroller.setMotorPower(1, 0.0);
            Testcontroller.setMotorPower(2, 0.0);
            telemetry.addData("Not moving?", "no problem");
        }

        if(touch.isPressed()){//For checking the ports on the legacy control module
            telemetry.addData("Touch sensor is ", "pressed");
        }
        else if(!touch.isPressed()){
            telemetry.addData("Touch sensor is ", "not pressed");
        }
        else{
            telemetry.addData("How the hell did a touch sensor pass a third value?", "I know right?");
        }
    }
}
Thanks in advance from Team 7037.
Reply With Quote