Troubleshooting Sensors in VEXcode VR

When your VR robot is not behaving as intended while using sensor feedback, you can follow a step-by-step troubleshooting procedure to find and fix your issues. This article will explain the troubleshooting process and provide tips for how to make your VR robot with sensors behave as intended. 

The steps of this process are:

  • Identify the problem
  • Check the VEXcode VR project
  • Analyze and apply data

Identify the Problem

The first step to troubleshooting your sensor is to identify which sensor is causing the problem. Compare the observed robot behavior with the intended robot behavior. Is the problematic behavior caused by a sensor? If so, which sensor? 

Understand Sensor Placement

In order to identify a problem with a sensor in VEXcode VR, it is important to understand what sensors are present on each model of VR robot, and where the sensors are located on the particular robot you are coding. Sensor placement differs depending on the model of VR Robot, which varies by Playground. Sensor location will affect how the sensor interacts with its environment. Use the table below to determine which robot you are coding, what sensors are included, and where the sensors on that robot are located. Select the article for more information on sensor placement.

Robot Playground(s) Article 

VEX VR Robot

vex-vr-bot3.webp

  • Art Canvas +
  • Castle Crasher +
  • Art Canvas
  • Castle Crasher
  • Disk Maze
  • Disk Mover
  • Disk Transport
  • Dynamic Castle Crasher
  • Dynamic Wall Maze
  • Encoded Message
  • Grid Map
  • Hidden Pixel Art
  • Line Detector
  • Number Grid Map
  • Shape Tracer
  • Wall Maze
  • Coral Reef Cleanup (The underwater robot in this playground has the same sensors as the VEX VR Robot).
Understanding Robot Features in VEXcode VR

VR MazeBot

VEX_VR_Maze_Robot__1_.png

  • Wall Maze +
Understanding Features of the VR MazeBot

VR Rover

Rover-Right.png

  • Rover Rescue

Features of the VR Rover

Disco

Screen_Shot_2023-04-17_at_4.19.56_PM.png

  • VRC Virtual Skills - Spin Up
Understanding Robot Features in VRC Virtual Skills

Moby

Screen_Shot_2023-04-17_at_4.23.28_PM.png

  • VRC Virtual Skills - Tipping Point
Understanding Robot Features in VRC Tipping Point for VEXcode VR

Slapshot

Screen_Shot_2023-04-17_at_4.26.29_PM.png

  • VIQC Virtual Skills - Slapshot
Understanding Robot Features in VIQC Virtual Skills

Fling

Screen_Shot_2023-04-17_at_4.31.07_PM.png

  • VIQC Virtual Skills - Pitching In
Understanding Robot Features in VIQC Pitching in for VEXcode VR

VR Competition Advanced Hero Robot

Screen_Shot_2023-04-17_at_4.35.14_PM.png

  • GO Competition - Mars Math Expedition
Understanding Robot Features in GO Competition - Mars Math Expedition Playground in VEXcode VR

VR 123 Robot

Screen_Shot_2023-04-17_at_4.43.44_PM.png

  • 123 Playspace
Coding the VEX 123 Eye Sensor with VEXcode 123 (the VR 123 Robot has the same sensors).

Check the VEXcode VR Project

Once you have identified which sensor is causing the issue, and where it is located on the VR Robot,  you can move on to checking your VEXcode VR project. Iterating on a project can help you to ensure that the data from the sensor is being used effectively in your project. The following strategies can help you with coding your sensor.

Run an Example Project

Screenshot_2023-04-20_at_12.09.19_PM.png

Open an example project that uses the sensor you are troubleshooting. You can select the ‘Sensing’ category to filter example projects.

For more information about using example Blocks projects in VEXcode VR, see this article.

For more information about using example Python projects in VEXcode VR, see this article.

Screenshot_2023-04-20_at_12.15.14_PM.png

Once open, read the Note to determine if the functionality in the example project aligns with what you are trying to do with the sensor.

In the example project shown here, the note indicates that this example project provides an example of how all the available Distance Sensor commands can be used with the robot.

Run the example project and observe the robot behavior. Then look at the project to see how the sensor data is being used in order to cause the observed behaviors. You may want to run the example project multiple times to help with this.

You may also want to try to create your own simplified project to apply what you have learned from the example project to your task.

Use the Help

Use the Help feature in VEXcode VR for the blocks or commands in the example project, or in your project, to learn about the data that is used, what values the command will report, and examples of how to use the command in a project.

Screenshot_2023-04-20_at_1.07.14_PM.png

For more information about Accessing Help in a VEXcode VR Blocks project, see this article.

Fore more information about Accessing Help in a VEXcode VR Python project, see this article.

Read Data on the Monitor Console

Monitoring sensor values in the Monitor Console in VEXcode VR allows the user to view real-time reports of a specific sensor value (or multiple values) in a project.

Open monitor console.png

To open the Monitor Window and view the Monitor Console, select the Monitor icon next to the Help.

Blocks from the Sensing category in the Toolbox can be added to the Monitor Console.

First, select the parameter to be monitored in the block within the Toolbox.

Nest, select and drag the block to the Monitor Console icon in the Workspace.

Monitor sensors.png

Selected sensor values will be displayed in the Monitor Console, and can be used to adjust your VEXcode project as needed in order to get the desired behavior from the VR robot.

For additional information about monitoring sensor values in VEXcode VR, see this article.

To monitor sensor values in VEXcode VR Python, the monitor_sensors command needs to be added to the project. For more information about monitoring sensors in VEXcode VR with Python, see this article.

Step Through Your Project

The Step button in VEXcode VR Blocks allows you to see the Blocks in your project being executed on at a time. This can be helpful in trying to determine which sensing block is causing the issue in your project.

VR Step.png

The step button is located in the upper right corner of the screen, beside the Start button. 

For more information about Stepping Through a VEXcode VR Project, see this article.

Analyze and Apply Data

Next, use what you have learned in the previous steps to adjust your original project. You can continue to use tools like the Help and printing data to enable you to use the sensor effectively to accomplish your goal.

You can also ask questions about your project to help you move forward. Think about things like:

  • Are you using greater than < or less than > in your project? Is the symbol facing the right direction? If you are using equal to = try replacing it with a greater than or less than, to use a range of values.
  • Are your parameters correct? Are you using the data from the sensor to set your parameters? Did you choose the dropdown option that you need?
  • Are you checking the conditions more than once? Try adding a Forever loop to your project, so that the condition is checked repeatedly when the project is run.
  • Is your project getting stuck? Are your conditions set correctly? If you are using nested loops, try simplifying your project to isolate individual behaviors.
  • Are you detecting the correct color? Is the sensor reporting a different color than the one you have in your project? Try changing the color parameter in the block or command.
  • Are you detecting an object within the sensor’s field of view? Remember that the field of view moves in conjunction with the movement of the robot.
  • Are you using a waiting block while checking a condition? Be sure to use non-waiting blocks in a project when checking for a condition.
  • If you are coding in blocks, is your whole stack attached to the {When started} hat block? Blocks will only run when they are connected. You can listen for a click sound when you drag blocks and connect them together.
  • Are you running your project in the correct Playground? The correct playground must be selected in order for your project to work as intended. 

As you answer these questions, be sure to change one thing in your project at a time, test it, then evaluate whether that change was effective. Testing your project frequently can help you to more easily see how your code is connected to the robot’s behaviors.  You may need to repeat steps in the troubleshooting process multiple times to solve your problem, and that is ok. Each iteration will help you learn more about the sensor you are using and how to code it in VEXcode VR.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: