Main Content

Select Different Robot Autonomous Modes Using the VEX V5 Robot Brain

This example shows how to use Simulink® Coder™ Support Package for VEX® V5 Robot Brain and create custom user interfaces on the LCD touch screen of VEX V5 Robot Brain using Display and Push Button Simulink Dashboard blocks.

Introduction

This example allows you to implement different autonomous routines and select between them using the touch screen display in a VEX V5 Brain.

Prerequisites

Required Hardware

To run this example, you need the following hardware:

  • VEX EDR V5 Robot Brain

  • V5 Robot battery

  • V5 Clawbot

  • V5 Controller

  • VEXnet Competition switch

  • USB A to Micro Cable

Step 1 - Hardware Connections

1. Connect the V5 Robot Battery to the VEX EDR V5 Robot Brain.

2. Connect the left smart motor to Port 1 and right smart motor to Port 10 using smart cables.

3. Connect arm smart motor to Port 8 and claw smart motor to Port 3 using smart cables.

4. Connect VEXnet Competition switch to V5 Controller using an ethernet cable.

5. Set the Competition switch in Preautonomous mode by selecting the Disable option in the left switch and Autonomous option in the right switch.

6. Pair the V5 Controller with the VEX V5 Robot Brain by performing the steps listed here.

Model

The Simulink Coder Support Package for VEX EDR V5 Robot Brain provides a preconfigured model that you can use to select autonomous Modes on the VEX V5 Robot Brain.

Open the vexv5_Clawbot_Display_Demo model.

If the Simulink panel is not rendered as shown in the image while using Windows® 10 system, then perform these steps in the Windows 10 system:

1. Select Start > Settings > System > Display.

2. In the Scale and layout option, set Change the size of text, apps, and other items to 100%.

3. Click Advanced scaling settings.

4. Set Let Windows try to fix apps so they're not blurry option to off.

Step 2: Deploy, Run, and Select Different Autonomous Modes on VEX V5 Robot Brain

1. On the HARDWARE tab, under the Deploy section, click the Build, Deploy & Start button. This action builds, downloads, and runs the model as a standalone application on the VEX V5 Robot Brain device. The application continues to run even if the device is disconnected from the computer. The user interface of the application contains Push Button and Display blocks that display on the VEX V5 Robot Brain. The Push Button blocks represent different autonomous modes that you can select.

2. Hold the device and observe the readings on the display. A sample screen is shown below.

You can press the arrow keys on LCD touch-screen to navigate to the required Simulink panel. A sample screen of the Display blocks showing the auton commands is shown below.

For information on adding Display and Push Button blocks to a panel, see Creating Touch Screen Controls and Displays for VEX V5 Robot Brain.

Using This Model in a Competition

This section helps you understand the different subsystems used in the model. This is helpful if you want to use this model in a competition.

The model has three enabled subsystems namely, Mode Selection, Driver, and Autonomous. The subsystems break the system into simple and small components. The enabled subsystems allows you to run specific subsystems based on some condition. In this example, the Competition Switch block allows you to select the subsystem to run. The Mode Selection subsystem runs during preautonomous mode; Driver and Autonomous subsystems execute during the driver and autonomous modes, respectively.

Preautonomous mode: Use the preautonomous mode to perform one-time tasks such as selecting one of the pre-programmed autonomous trajectories, setting motor speeds and so on. In this example, Push Button is displayed in the V5 Robot Brain to aid in selecting different autonomous trajectories (robot turning to left or right). Also, the chosen autonomous mode is displayed on the screen using the Display block from dashboard library. To learn more about creating user interface on V5 Robot Brain, see Creating Touch Screen Controls and Displays for VEX V5 Robot Brain.

Driver subsystem: Use the Driver subsystem to program your robot for the driver-controlled period.

Autonomous subsystem: Use Autonomous subsystem to program your robot with different autonomous trajectories. Additionally, you can also use the Display blocks from Dashboard library to display sensor values or other diagnostic information on the VEX V5 Robot Brain's touch screen display.

See Also

Autonomous Mode and Driver Mode with VEX EDR V5 Robot Brain