Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skidJoy does not work in my Java-Code #424

Open
MohmadFadiAldrobi opened this issue Nov 2, 2023 · 1 comment
Open

skidJoy does not work in my Java-Code #424

MohmadFadiAldrobi opened this issue Nov 2, 2023 · 1 comment

Comments

@MohmadFadiAldrobi
Copy link

Hi, I'm working on an Java-App in Androidstudio for Temi. The app should be able to remotely control Temi with the method "skidJoy(x,y,false)" (i.e. forward, backward, right, left). The problem is that Temi does not move when calling the corresponding method (see code) unless I set the method in a While(true) loop. can someone help me with this ?

public class MainActivity extends AppCompatActivity implements OnRobotReadyListener {

    private static Robot sRobot;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onStart() {
        super.onStart();
        this.sRobot = Robot.getInstance();
        this.sRobot.addOnRobotReadyListener(this);
    }

    @Override
    protected void onStop() {
        super.onStop();
        this.sRobot.removeOnRobotReadyListener(this);
    }

    @Override
    public void onRobotReady(boolean isReady) {
        if (isReady) {
            TemiGoForward(); 
        }
    }

    public void TemiGoleft(){
        sRobot.skidJoy(0,1,false);
    }

    public void TemiGoReight(){
        sRobot.skidJoy(0,-1,false);
    }

    public void TemiGoForward(){
        sRobot.skidJoy(1,0,false);
    }

    public void TemiGoBack(){
        sRobot.skidJoy(-1,0,false);
    }

}

@zjn0505
Copy link
Contributor

zjn0505 commented Nov 3, 2023

skidJoy request needs to be constantly sent to robot.

Your can add some arrow buttons in your app, and keep sending the skidJoy request when the button is pressed.

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

No branches or pull requests

2 participants