Advanced Motor Controll

Hey Vex team, I would really appreciate some help exploring the advanced encoder enabled abilities of the vex IQ motors. I’ve been using the graphical interface for Robot C and wanted to explore the more advanced option for the motor.

Here are the questions:

  1. How can I edit the torque of the motors, (e.g. stop motors when they have too much stain on them, or block the motors so that they don’t rotate: basically the torque functions advertised in this video below)?
  2. Is there any way of using the encoder to know the rotational position of the motor (will I have to use the ResetMotorEncoder)?

I’ve looked around however I cant find any type of resource which answers my questions, so if you can answer them or give me the resources (video, text) that can help me out, I would be forever grateful. I would be even more grateful if you could help me achieve my desired objectives through the graphical interface.

p.s: Is there some type of documentation which explains all the sensor values, ranges and motor options (target, velocityzero… and so on)?

thanks :slight_smile:

So there is bad news and good news. The bad news is that you won’t be able to do some of the advanced motor controls (such as checking the current limit of the IQ motors) in the Graphical version of ROBOTC; the good news, however is that these advanced commands and functionality can be found and used in the latest version of ROBOTC for VEX Robotics 4.30 (while in text-mode).

You can find a full listing of the commands in the ROBOTC for VEX Robotics help documentation, under the ‘Command Library - VEX IQ -> Text-Based ROBOTC -> ROBOTC - Motors and Servos’ subsection (direct link below). There are explanations for each command, how it works, the different values that it will return/accept, and a short snippet of code that can be used to check the functionality in the documentation. Some of the more relevant commands that you may want to look at:

//Returns a boolean flag indicating if the motor plugged into nMotorIndex has exceeded the internal temperature limit.
getMotorOverTemp(nMotorIndex);

//Returns the amount of current being used by the specified motor in mA (milliamps).
getMotorCurrentLimit(nMotorIndex);

//Returns a boolean flag indicating if the motor plugged into nMotorIndex has exceeded the internal current limit.
getMotorCurrentLimitFlag(nMotorIndex);

//Sets a motor (in servo mode) plugged into nMotorIndex to travel a set distance from its absolute position specified by nPosition.
//A motor in 'servo' mode will move to and attempt to hold the target position given to it. It will actively counteract any force applied to the motor that would move it from its set position.
setServoTarget(nMotorIndex, nPosition);

There are several other useful commands in the API documentation that you may be interested. Unfortunately, there is currently no curriculum set up for this type of advanced movement; however, it is something that we are monitoring feedback on and may considering developing in the future if the desire is strong enough.

ROBOTC for VEX Robotics 4.X Help Documentation: http://help.robotc.net/WebHelpVEX/index.htm#Topics/Function_Library_-_VEX_IQ/Motor_and_Servo_Commands.htm

Please let us know if you run into any other questions as we are always happy to help!