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 |
|
Understanding Robot Features in VEXcode VR |
VR MazeBot |
|
Understanding Features of the VR MazeBot |
VR Rover |
|
Features of the VR Rover |
Disco |
|
Understanding Robot Features in VRC Virtual Skills |
Moby |
|
Understanding Robot Features in VRC Tipping Point for VEXcode VR |
Slapshot |
|
Understanding Robot Features in VIQC Virtual Skills |
Fling |
|
Understanding Robot Features in VIQC Pitching in for VEXcode VR |
VR Competition Advanced Hero Robot |
|
Understanding Robot Features in GO Competition - Mars Math Expedition Playground in VEXcode VR |
VR 123 Robot |
|
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
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.
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.
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.
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.
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.
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.