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.
Assemble a VEX V5 Clawbot and connect the motors and sensors as stated below.
|Left motor||2||18:1 gear|
|Right motor||1||18:1 gear|
|Arm motor||3||36:1 gear|
|Claw motor||4||36:1 gear|
|Inertial Sensor (optional)||5||Y axis facing forward, X axis facing leftward|
|Gamepad and radio||Any port|
connect additional sensors as shown in the screen below.
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.
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.
Build and Download Simulink Model
Connect VEX V5 Robot Brain to your computer and switch it on.
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.
Once deployed, keep the robot steady on a level surface for 2 seconds. This calibrates the V5 inertial sensor (if connected).
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 Modeling page. Copy 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.