This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Smart Motor Write

Represent connected V5 Smart Motor and set its velocity and position

  • Library:
  • Simulink Coder Support Package for VEX EDR V5 Robot Brain / Actuators

Description

The Smart Motor Write block represents a V5 Smart Motor connected to a specified port on a VEX® EDR V5 Robot Brain, and sets the velocity and position of the motor.

Ports

Input

expand all

The input velocity for Smart Block Write block can range from –100 to 100. The sign determines the direction of rotation of the motor, and the amplitude determines the velocity in RPM. Positive value rotates the motor in clockwise direction and negative value rotates the motor in anticlockwise direction. A block input value of 0 stops the motor.

For an input velocity value beyond the range of -100 to 100, the block supplies the power for an amplitude of 100.

Data Types: double

The Position input sets the target position of motor in terms of the tick count. When this input value is equal to the tick count from the in-built encoder of V5 Smart Motor, the target position of the motor is achieved.

For example, to stop the motor after 2 rotations:

  • For a gear ratio of 36:1, set the Position input to 3600

  • For a gear ratio of 18:1, set the Position input to 1800

  • For a gear ratio of 6:1, set the Position input to 600

Dependencies

This input appears only when you set the Control mode parameter to Position Control.

Data Types: double

Parameters

expand all

Select the Smart Port on the VEX EDR V5 Robot Brain to which the V5 Smart Motor is connected. There are 21 Smart Ports on the VEX EDR V5 Robot Brain that you can connect to V5 Smart Motor.

Smart Port must be unique for each block in the model. If multiple Smart Motor Write blocks with the same port are used, the last executed Smart Motor Write block may only be active. For the Vex Robotics Competition, you can use the same Smart Motor Write block with the same Smart Port in the driver mode or the autonomous mode.

Select the internal gearing ratio that is used to drive the V5 Smart Motor.

Select the braking mode to match the braking mechanism used for the V5 Smart Motor:

  • lCoast – Set the motor to coast to a stop

  • lBrake – Set the motor to stop immediately by applying a brake

  • lHold – Set the motor to stop immediately by applying a brake and attempt to hold its position

Select the control mode to switch from velocity control to position control or vice versa.

When you select Position Control, an additional input – Position – is added, which sets the target position of the motor.

Introduced in R2018b