Announcement

Collapse
No announcement yet.

Problem Imediatly Stopping Robot in Linear Op Mode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem Imediatly Stopping Robot in Linear Op Mode

    Our linear op mode will not stop when the stop button is pressed on the drivers station. Our op modes do not have this problem only the linear op modes. When we press the stop button our driver station and robot controller phones flashes an error message claiming that it is ,"stuck in stop". The motors that are currently moving will continue to move for a good 5 seconds and slow to a halt. After the robots active systems shut down the robot controller app reboots. This problem only happens when the linear op mode is stopped in the middle of running.

    Is there any code that can be used to fix this issue? if so will you please share.

  • #2
    You're going to need to post your LinearOpMode code to get complete advice. In general with a LinearOpMode any time you have a loop you'll need to add opModeIsActive() to the loop

    Borrowing from some of the sample code:

    Code:
    // run until the white line is seen
    while (lightSensor.getLightDetected() < WHITE_THRESHOLD) {
    
      // Display the light level while we are looking for the line
      telemetry.addData("Light Level",  lightSensor.getLightDetected());
      telemetry.update();
    }
    would need to be changed to this:

    Code:
    // run until the white line is seen OR the driver presses STOP;
    while (opModeIsActive() && (lightSensor.getLightDetected() < WHITE_THRESHOLD)) {
    
      // Display the light level while we are looking for the line
      telemetry.addData("Light Level",  lightSensor.getLightDetected());
      telemetry.update();
    }

    Comment


    • #3
      mlwilliams, it would be very helpful if you could post a sample program in App Inventor because we do not use Java thank you- 10485

      Comment


      • #4
        10485, I'm terribly sorry for not noticing this was an AppInventor question. While I've never used actually used AppInventor I did just download it and tried to come up with an equivalent explanation. I believe that the key for both Java and AppInventor is to use the OpModeIsActive conditional test anytime the robot is doing anything time consuming like waiting a certain time or waiting for a sensor to reach a particular value.

        Here's an example that would wait for a bit but while it's waiting it also makes sure that the stop button hasn't been pressed. If I'm totally wrong about this hopefully someone with AppInventor experience can clear things up.

        Comment


        • #5
          I agree with mlwilliams. You have to make sure that all of your loops include a test for FtcLinearOpMode.OpModeIsActive.

          Screen Shot 2016-11-15 at 2.12.03 PM.png

          Comment


          • #6
            we have tried your examples and it does not seem to work. Our robot just sits there and when we stop it it says stuck in loop.

            file:///C:/Users/Spencer/Downloads/image1.JPG

            Comment


            • #7
              Could you share a photo of the blocks in your op mode so we can have a better understanding of what is happening?

              Comment


              • #8
                Tom,
                As an aside, it appears that "OpModeIsActive" is not true during the init phase. This may be relevant because, as I recall, at least some approaches to configuring Autonomous (Red/Blue, etc) count on using the joystick in Init mode to configure settings. Is there some analogous state ("Initializing"?) that is true during the init phase? (Now, I'm off to read the manual.)
                Thanks,
                Martin Haeberli
                (de-)Mentor, FTC 7593, TigerBots

                Comment


                • #9
                  Originally posted by mhaeberli View Post
                  Tom,
                  As an aside, it appears that "OpModeIsActive" is not true during the init phase. This may be relevant because, as I recall, at least some approaches to configuring Autonomous (Red/Blue, etc) count on using the joystick in Init mode to configure settings. Is there some analogous state ("Initializing"?) that is true during the init phase? (Now, I'm off to read the manual.)
                  Thanks,
                  Martin Haeberli
                  (de-)Mentor, FTC 7593, TigerBots
                  Try !isStopRequested()

                  Comment


                  • #10
                    Thx - I will!
                    Martin Haeberli
                    (de-)Mentor, FTC 7593, TigerBots

                    Comment

                    Working...
                    X