Main Content

Transitioning from Gazebo Simulation to Deployment

Some of the VEX® example models illustrate how to program and simulate autonomous algorithms for mobile robots. These models serve as a starting point for learning how to program autonomous robot logic via Stateflow® charts. However, you may want to transition programming to the actual robot.

This page helps you with transition, using an example model configured for both simulation and deployment.

Prerequisites

Go through Simulate Stability Assistance Algorithm Using Gazebo Simulator for VEX V5 Robot.

Hardware Connections

Assemble a VEX V5 Clawbot and connect the motors and sensors as stated below.

PartSmart PortMisc
Left motor218:1 gear
Right motor118:1 gear
Arm motor336:1 gear
Claw motor436:1 gear
Inertial Sensor (optional) 5Y axis facing forward, X axis facing leftward
Gamepad and radio Any port 

connect additional sensors as shown in the screen below.

Additional sensor

Model

You can use one of the example simulation models which is equipped with hardware blocks.

For example, consider Simulate Stability Assistance Algorithm Using Gazebo Simulator for VEX V5 Robot. Run this command at the MATLAB® command prompt to open it.

open_system(‘vexv5_clawbot_gazebo’)

Example model

The model has two subsystems under VEX V5 Robot Interface. They are Simulink Variant subsystems.

Gazebo Simulation Interface subsystem contains Simulink® blocks that interface with Gazebo simulator. This subsystem is active only during normal simulation.

Deployment Interface subsystem contains hardware blocks that can access sensor data or command the actual motors. This subsystem is active only during deployment or during signal monitoring and parameter tuning.

Robot interface

Motors and Encoders

Build and Download Simulink Model

  1. Connect VEX V5 Robot Brain to your computer and switch it on.

  2. In the Simulink model, click Hardware and then Build, Deploy & Start. The model is deployed to the V5 Robot Brain. This action builds, downloads, and runs the model as a standalone application on the VEX V5 Robot Brain device.

  3. Once deployed, keep the robot steady on a level surface for 2 seconds. This calibrates the V5 inertial sensor (if connected).

  4. Drive the robot around using VEX Gamepad.

Other Things to Try

In this example model, Variants are used to demonstrate both simulation and deployment workflows in the same model. However, they are not necessary.

Try using other simulation models available in the page. Copy and paste the Stateflow logic to a new model, interface with blocks such as Smart Motor Read, Smart Motor Write, Distance Sensor, Rotation Sensor, and so on as needed and try deployment.

For a simple deployment only example, see Heading Control Using VEX V5 Inertial Sensor.

See Also