Quick Coding Tip: Monitor Sensor Data for Autonomous Navigation

Understanding the robot’s environment is the key to creating autonomous programming for the robot.

VEXcode VR allows us to monitor sensor values in the Monitor Console to learn the surrounding of the robot in real time. Based on the monitored data, we can code the robot to make decisions to achieve autonomous navigation.

Observe Sensor data in the Monitor Console

To view sensor values of the robot in a VEXcode VR blocks project, we only need to:

  1. Select the checkbox of the corresponding sensor from the Sensing category (image 1).
    image

  2. Select the Monitor icon to open the Monitor Console (image 2).
    image2

  3. Select the “Start” button to run the project and watch the sensor data selected for monitoring.

Here is a simple Example Maze Solver project that drives the robot from the Green Start Position to the Red End Position on the Wall Maze+ Playground.

Let’s follow the above steps to monitor the changes in the Distance Sensors’ values while the robot travels through the Maze in this project.

20230724_100651

In this Example Maze Solver project, we see that the VR Robot turns right for 90 degrees when it is 150 mm from a wall, and then starts driving in a new direction.

Code the robot to make decisions based on the monitored data

The observed Sensor data is crucial for us to create Autonomous programming. Here is an example.

By analyzing the monitored Distance Sensor data in the Example Maze Solver Project, we can figure out that 150 mm from the wall is the ideal position for the robot to make a 90-degree turn in the Maze and start driving in a new direction without bumping into walls. Thus, to solve the Tunnel Maze on the Wall Maze + Playground, we can set the threshold of the Front Distance Sensor to 150 mm for autonomous navigation.

image5

Our solution is:

  1. Drive the robot forward to the wall,
  2. Keep checking the value of the Distance Sensor to see if it is less than 150,
  3. Turn right for 90 degrees if the VR Robot is less than 150 mm from a wall,
  4. Repeat the above three steps nine times to direct the robot to drive from the Green Start Position to the Red End Position.

image6

monitor2

The above example is a showcase of watching Sensor data in the VEXcode VR Monitor Console, finding a key sensor value, and using it in robot programming.

Monitoring sensor values helps us understand the robot’s current environment, code the robot to make smart decisions, and even troubleshoot and debug programs! We’ll delve deeper into this topic in the future.

Please let us know if you have any questions, comments, or feedback. Thank you!

2 Likes

Thank you for the detailed post! The method regarding observing sensor data and translating that into autonomous navigation is a great share . This step-by-step guide to using the VEXcode VR Monitor Console is an excellent resource for those who are working on autonomous programming.

1 Like