Files
J1B4-Fitbot/docs/documentation/android/robotmovement.md
2024-05-23 15:31:30 +02:00

1.4 KiB

How to make the robot move

Getting started

First make a animation file in the /res folder.

alt text

Then right click it and click edit animation

Making keyframes

Once you click edit animation you can click a bodypart and rotate it.

alt text

Once you have positioned the robot into your preffered position you can click the keyframe button.

alt text

You can grab and shift the keyframes around the timelines until you get something like this.

alt text

Make sure to save it under the File tab once it is done.

You can test it by clicking the play button in the top right.

Making the robot move

Once you have made the animation file you can go to the robot movement script.

// create the animation
Animation animation = AnimationBuilder.with(qiContext)
        //change bicepcurl to the name of your animation file
        .withResources(R.raw.bicepcurl)
        .build()

// create the animate object
Animate animate = AnimateBuilder.with(qiContext)
        .withAnimation(animation)
        .build()

// play the animation        
animate.async().run();

If you run this on the robot the animation should play.

Additional stuff

every 25 is 1 second so 100 is 4 seconds. alt text