Announcement

Collapse
No announcement yet.

Phones Disconnecting Every 30 to 50 Seconds

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

  • Phones Disconnecting Every 30 to 50 Seconds

    We sadly had an issue popping up at our competition yesterday where the phones would disconnect every 30-50 seconds, but only when waiting between pressing "init" in autonomous and running the program. We assume we never came across this problem in all our hours of testing simply due to pressing init and running the program right away. We are using vision and setting the position of a servo during init. Code follows. Thank you for your help.

    @Override public void runOpMode() { /* * Initialize the drive system variables. * The init() method of the hardware class does all the work here */ robot.init(hardwareMap); // Send telemetry message to signify robot waiting; telemetry.addData("Status", "DogeCV 2018.0 - Gold Align Example"); detector = new GoldAlignDetector(); detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance()); detector.useDefaults(); // Optional Tuning detector.alignSize = 100; // was 100 How wide (in pixels) is the range in which the gold object will be aligned. (Represented by green bars in the preview) detector.alignPosOffset = 0; // How far from center frame to offset this alignment zone. detector.downscale = 0.4; // How much to downscale the input frames detector.areaScoringMethod = DogeCV.AreaScoringMethod.MAX_AREA; // Can also be PERFECT_AREA //detector.perfectAreaScorer.perfectArea = 10000; // if using PERFECT_AREA scoring detector.maxAreaScorer.weight = 0.005; detector.ratioScorer.weight = 5; detector.ratioScorer.perfectRatio = 1.0; detector.enable(); BNO055IMU.Parameters parameters = new BNO055IMU.Parameters(); parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES; parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC; parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode parameters.loggingEnabled = true; parameters.loggingTag = "IMU"; parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator(); // Retrieve and initialize the IMU. We expect the IMU to be attached to an I2C port // on a Core Device Interface Module, configured to be a sensor of type "AdaFruit IMU", // and named "imu". imu = hardwareMap.get(BNO055IMU.class, "imu"); imu.initialize(parameters); // Set up our telemetry dashboard composeTelemetry(); robot.marker.setPosition(1); // Wait for the game to start (driver presses PLAY) waitForStart();

  • #2
    @Override
    public void runOpMode() {

    /*
    * Initialize the drive system variables.
    * The init() method of the hardware class does all the work here
    */
    robot.init(hardwareMap);

    // Send telemetry message to signify robot waiting;
    telemetry.addData("Status", "DogeCV 2018.0 - Gold Align Example");

    detector = new GoldAlignDetector();
    detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance());
    detector.useDefaults();

    // Optional Tuning
    detector.alignSize = 100; // was 100 How wide (in pixels) is the range in which the gold object will be aligned. (Represented by green bars in the preview)
    detector.alignPosOffset = 0; // How far from center frame to offset this alignment zone.
    detector.downscale = 0.4; // How much to downscale the input frames

    detector.areaScoringMethod = DogeCV.AreaScoringMethod.MAX_AREA; // Can also be PERFECT_AREA
    //detector.perfectAreaScorer.perfectArea = 10000; // if using PERFECT_AREA scoring
    detector.maxAreaScorer.weight = 0.005;

    detector.ratioScorer.weight = 5;
    detector.ratioScorer.perfectRatio = 1.0;

    detector.enable();

    BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
    parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;
    parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
    parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode
    parameters.loggingEnabled = true;
    parameters.loggingTag = "IMU";
    parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();

    // Retrieve and initialize the IMU. We expect the IMU to be attached to an I2C port
    // on a Core Device Interface Module, configured to be a sensor of type "AdaFruit IMU",
    // and named "imu".
    imu = hardwareMap.get(BNO055IMU.class, "imu");
    imu.initialize(parameters);


    // Set up our telemetry dashboard
    composeTelemetry();

    robot.marker.setPosition(1);
    // Wait for the game to start (driver presses PLAY)
    waitForStart();

    Comment


    • #3
      Have you looked at the log files. I am wondering if it isn't a memory allocation issue with you image processing routines.
      We do not use DogeCV, but have seen problems like you describe when using OpenCV if we create a lot of Mat objects within while or for loops. It causes a lot of allocation and garbage collection. If you are using a Mat for a particular processing step, you can do a new only on the first pass - when the Mat object is null. Then on subsequent passes, use clone. This uses the same memory location and reduces allocation and GC. This problem can be exposed if longer than tested time is spent with the code running.
      You might also want to make sure the image processing doesn't start running until the opMode is running.
      Of course - all of this is stabs in the dark without seeing your image processing code.

      Comment


      • #4
        Originally posted by FTC7253 View Post
        Have you looked at the log files. I am wondering if it isn't a memory allocation issue with you image processing routines.
        We do not use DogeCV, but have seen problems like you describe when using OpenCV if we create a lot of Mat objects within while or for loops. It causes a lot of allocation and garbage collection. If you are using a Mat for a particular processing step, you can do a new only on the first pass - when the Mat object is null. Then on subsequent passes, use clone. This uses the same memory location and reduces allocation and GC. This problem can be exposed if longer than tested time is spent with the code running.
        You might also want to make sure the image processing doesn't start running until the opMode is running.
        Of course - all of this is stabs in the dark without seeing your image processing code.
        Thank you for the idea. The interesting thing we have found through further testing is that it definitely only disconnects while autonomous is sitting in init. We even started with a fresh app and did not add the vision and it still disconnects. We did notice one thing, but cant test it until tomorrow...We have moto e4's from verizon and from boost. They look almost identical, and one from each manufacturer was inadvertently paired. This doesn't necessarily explain why it kicks out in autonomous only, but work a shot.

        We are relative noobs at coding, we are using the basic gold sample, and we just added the following line. Not sure how to use clone, but would the following code cause memory problems? Thank you

        while(opModeIsActive() && !detector.getAligned())
        {
        //turn until gold mineral is in front of robot
        }

        Comment

        Working...
        X