No announcement yet.

OpMode deployed using OnBotJava behaves differently compared to Android Studio

  • Filter
  • Time
  • Show
Clear All
new posts

  • OpMode deployed using OnBotJava behaves differently compared to Android Studio

    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

    Could someone help me how to get this fixed in OnBotJava side?

    package org.firstinspires.ftc.teamcode;

    import android.util.Log;

    import com.qualcomm.robotcore.eventloop.opmode.Disabled;
    import com.qualcomm.robotcore.eventloop.opmode.LinearOpMo de;
    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")
    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);

    public void runOpMode() {

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

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