The following article will provide guidance on how to troubleshoot VEX V5 Smart Motors if you are experiencing one or more of the following issues:
- Motor is not spinning to the intended position
- The VEXcode V5 project is stopping unexpectedly in the middle of the project
- Motors are moving unexpectedly
Problem: Motor Not Spinning to Intended Position
If your motor is not spinning to the intended position, try the following steps to troubleshoot.
Before editing your VEXcode V5 project, check that you have the correct gear cartridge selected in the device configuration. The default choice is the green 18:1 gear cartridge.
For more information about configuring individual motors in VEXcode V5, view this article.
Check the commands used in your project. [Spin to position] is used to spin a motor to a specific position. In contrast, the [Set position to] block sets the motor encoder’s position to the given value and will not move the motor.
Ensure that you are using [Spin to position] rather than [Set position to] in your projects.
Make sure that you know the correct degree position that you want the motor to move to. Any gear trains could impact the number of degrees needed to fully raise an arm or open a claw.
See this article to learn more about gear ratios with VEX V5 Smart Motors.
If you are unsure of how far to move a motor, use the device information available on the V5 Brain screen. To open the device information for a motor, first select 'Devices' from the V5 Brain screen.
Then select the motor that you want to see more information for.
NOTE: The motor must be plugged into the V5 Brain in order to be seen on the devices screen.
Once opened, you will be able to see the degree and rotational position of the V5 Smart Motor selected. This will update in real time if you want to see how the values change as the motor spins.
The device information reports the position of the motor in degrees and revolutions, so as you move a motor (like opening and closing a claw) the numbers will change. Use this testing to determine how many degrees or rotations are needed to close a claw, raise an arm, spin an intake, etc.
Problem: VEXcode Project Getting Stuck
Your project may seem to get stuck because the motor cannot reach its intended target position. You can adjust the position the motor is moving towards or can set a “timeout” for the motor.
Motor timeouts allow you to set a time limit for the motor to reach its target position. If it has not met that position when time expires, the motor will stop trying to spin and the project will move to the next command.
In this example, the motor timeout is set to 3 seconds. If the claw does not close to 360 degrees within 3 seconds, the motor will stop spinning at the 3 second mark then move to the next command and drive forward.
Problem: Motors Not Holding a Position
You may have an arm motor that moved down unexpectedly because it is being pulled by gravity or other forces. Using [Set motor stopping] allows you to control that movement of the arm after another command is completed.
The [Set stopping to] command allows you to determine the behavior of the motor after it stops spinning.
Using the ‘hold’ parameter will instruct the motor to fight gravity. ‘Hold’ causes the motor to come to an immediate stop and will return it to the stopped position if moved.
Set the motors to ‘hold’ before other commands using the motors as shown in this custom Controller code example here.