[Quick Coding Tips] Debugging Tools In VEXcode VR (Part 2)

  1. Camera Views
    The VEXcode VR playground simulates the real world. When the robot’s actual performance doesn’t match expectations, we can use a different Camera View to observe the specific behaviors of the robot, compare its actions to the expected results, and identify the reasons that cause the bugs.

To choose a Camera View, we can: 1. Select the “Top Camera” button to see an overhead view of the entire Field. OR 2. Select the “Chase Camera” button to see a behind-the-robot view. Or 3. Select the “Orbit Camera” button to see an overview of the robot and the full Field.

Let’s look at an example in the VRC Over Under Virtual Skills playground (Image 16).

timage10

The Triball is in front of the robot’s Intake Mechanism. When the Intake Motor spins forward, it cannot collect the Triball. Using the Chase Camera feature, we can see that because the robot’s wheels are on the barrier, the Intake is too high to collect the Triball on the Field

debut3-1

Thus, by adjusting the code to keep all of the robot wheels contacting with the gray tiles on the Field all the time, we can navigate the robot to intake the Triball successfully.

timage11

debut3-2

  1. Error Message in the Print Console (For Python project only)
    In VEXcode VR, if the Python project fails to run, we will see an error message in the Print Console that explains why the code is failing.

Take this code for example:
timage12

When the project run, we see the following error message in the Print Console:

timage13

The error message points to the problem and helps us easily identify and rectify the typo in the object name.

timage14

Note: Sometimes, error messages cannot indicate the problem position precisely. If the indicated code seems fine, check the instructions before this code.

The following code is an example: actually, the code failed because there was an indentation error in the line preceding the drivetrain.set_turn_velocity instruction.

timage15

The error message shows in the Print Console:

timage16

Debugging is a crucial part of coding. Practice makes perfect. After exploring the debugging tools in VEXcode VR, we will delve into some debugging techniques in the future.
Hope this helped and please let us know if you have any questions, comments, or feedback. Thank you!

2 Likes

Debugging is definitely an essential skill in programming and robotics. The tools available in VEXcode VR not only help in identifying and fixing errors but also in understanding the logic and flow of the code. Thanks for sharing. This is very informative.

1 Like