Virtual Robot Simulator | FIRST Tech Challenge - FTC Virtual Robots

Robot motor power Intro

Setting motor power

The following code blocks drive the robot forward for two seconds at a power of 0.2. After that we want it to strafe to the right. If we set the frontLeft power to 0.2, what would we set the other values to? Try this out in the app and then come back here to see the answer.

Motor power screenshot

 

What power should I use?

Often in programming you need to set a value. Sometimes you have the opportunity to define what that value means before setting it, but often you have to work within the constraints of the existing software. In this case, the “power” value we “set” for each wheel is determined by the VRS App. The only way you can figure out what the power should be is to experiment. Remember: in most cases you don’t have to use whole numbers only; numbers can be negative, decimals, or both!

What now?

Ok so we’ve successfully set the power of motors, now what? Well, if we simply wanted a robot that rams things at high speed, we are done. Most of the time, though, we want our robots to behave a bit more deliberately, so we need to introduce some more commands so our robot will move forward AND backward AND forward again (as many times for as far a distance as we want).

Now that you understand how to stack code blocks to make the virtual robot move, you can make it go forward and backwards. Try it yourself in the app, then return here to see the way we did it.

What causes a turn?

Turning is easy if you’re driving a car– you just turn the wheel and the wheels (connected by the steering axle and some gears) turn to point in the direction you want the car to go. Turning the virtual robot is… not so straightforward.

Try to imagine how you might turn the robot, then match the words in this quiz to complete the idea correctly.

You can control the strength of the turn, also known as the turn radius, by adjusting the strength of these values. Which of the following would execute the tightest (smallest radius) turn?

What is strafing

A “strafe” maneuver might be familiar to you if you’ve ever played a First Person Shooter-style video game. Your character typically moves forward and backward using the left thumbstick up and down directions (or W and S on a keyboard), and looks around using the right thumbstick (or the mouse if you’re using a mouse). Your character “strafes” when using left and right on a thumbstick (or A and D on a keyboard). It’s just another way of saying “move side to side without turning”.

The robot (both real and virtual) uses special wheels that allow it to strafe when all four turn in the correct direction in relation to each other. Those who want to try and figure it out on their own should use the app and experiment with different values.

How to learn Java using blocks

As we learned in the introductory lesson, code blocks are a method for writing code. Just as a programming language like Java provides programmers a way to write machine code in a more understandable way, code blocks provide a way to write Java in a more understandable way. It is not necessary to learn Java– coding blocks are a completely viable method for controlling the robot, but for those who are interested in learning Java for its power and versatility, code blocks are an excellent learning tool.

The VRS app allows you to switch back and forth between blocks and Java at the click of a button. This enables you to see the Java code you have created using the blocks, and understand its syntax.

VIRTUAL ROBOT SIMULATOR IS A SIMPLE, EASY-TO-USE PLATFORM THAT ALLOWS FTC TEAMS TO PROGRAM AND TEST THEIR ROBOTS WITHOUT ACCESS TO PHYSICAL HARDWARE.