Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Opmode deployed with OnBotJava behaves differently compared to Android Studio #682

Open
ftc-team-astro-bruins opened this issue Jan 15, 2019 · 1 comment

Comments

@ftc-team-astro-bruins
Copy link

Below is a simple opmode and this works fine when deployed using Android Studio but prints all zero's when deployed using OnBotJava.

Below is the output with Android Studio
01-14 19:40:36.157 23589-24299/com.qualcomm.ftcrobotcontroller V/AstroBot: SettingPwRangeTo: pulseLower = 1000.00 us, pulseUpper = 1520.00 us, framesize 20000.00 us

Below is the output with OnBotJava
01-14 20:13:06.090 23589-25582/com.qualcomm.ftcrobotcontroller V/AstroBot: SettingPwRangeTo: pulseLower = 0.00 us, pulseUpper = 0.00 us, framesize 0.00 us


package org.firstinspires.ftc.teamcode;

import android.util.Log;

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.PwmControl;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.hardware.ServoControllerEx;
import com.qualcomm.robotcore.util.RobotLog;

@TELEOP(name = "OnBot-Test: Servo Ex", group = "AstroBot-Test")
//@disabled
public class Test_ServoEx extends LinearOpMode {

// Define class members
final double US_PULSE_LOWER = 1000.0;
final double US_PULSE_UPPER = 1520.0;
PwmControl.PwmRange servoRange;


void LogPwmRange(PwmControl.PwmRange range, String suffix) {
    RobotLog.vv("AstroBot", "%s: pulseLower = %.2f us, pulseUpper = %.2f us, framesize %.2f us",
            suffix, range.usPulseLower, range.usPulseUpper, range.usFrame);
}

@Override
public void runOpMode() {

    servoRange = new PwmControl.PwmRange(US_PULSE_LOWER, US_PULSE_UPPER);
    LogPwmRange(servoRange, "SettingPwRangeTo");

    // Signal done;
    telemetry.addData(">", "Done");
    telemetry.update();

    sleep(10000);
}

}

@dmssargent
Copy link

I hate to say this, but this issue will probably get resolved if you completely reset OnBotJava. Because it is returning everything as 0 in your example, some artifacts of the libraries being ultra-compressed seem to be leaking through.

Per @gearsincorg nice instructions:

One effective way to correct this problem is to let the new App completely reset the OnBotJava subsystem on the phone. There is an "Advanced" setting to permit this on the OnBotJava web interface.

Before making any changes though, I'd download any OnBotJava Opmodes you have on your RC to your computer as a backup. Simply right click on them (in the tree) and select download...

To reset the OBJ system, follow these directions:

Start up the RC app and use your browser to connect to your phone just like you would if you were doing OnBotJava programming.

Select OnBotJava, and click on the Settings (GEAR) icon.

Scroll down to, and expand the "Advanced Settings" option

Click on the RED "RESET" button.

!!!!! MAKE sure you have downloaded any OpModes you want to keep BEFORE doing this...!!!!!

You will be prompted if you really want to do this: Click OK
And you will be prompted AGAIN... and actually have to type "Yes I want to". Do it!

Now, if you return to the OnBotJava page, all the opmodes will be gone and you should be able to either re-create them, or restore your saved opmodes by using the Upload Files icon.

Also remember that if you are using Vuforia, you need to replace the dummy Vuforia key with your own key. See the code comments.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants