How does voltage in vex::motor::spin(directionType dir, double voltage, voltageUnits units) be translated into speed and acceleration? It there formula for those?
Not to derail your questions, but I’m interested in why you want this? I try to use the rule of thumb from the beginnings that things (data values from sensors, commands to motors) got updated every 20ms, or 50 times a second. I’ve always considered this to be plenty of time. Even at a super fast 10’ per second you would get a number of readings / settings per foot. Thanks!
I would like to have smooth acceleration and deceleration when moving forward. I try 10 msec and work quit well. Just want to learn what the limit is. Thank you for your input and discussion.
Commands to the motor are sent at 5ms intervals. This means that motor voltage can be updated at 200Hz. However, the motor’s internal PID loop runs in 10ms cycles, so there’s no point setting rpm more often than that. Also note that data from the motor (encoder position, etc.) is only received every 10ms.
So you have a test bed to try things out? You did 10ms, can you do 20…1000 by 20ms and report back the results? Its not often people can see science like this in action.
Thank you for all the information. that is really helpful. If you have reference to those information that is greatly appreciate. Sometime it is just hard to find out there the information is located.
Certainly. I will report this later. I current try 1-D motion profile instead of PID, which requires a lot of tunning. drivetrain.driveFor did not work well when I try. It has overshot issue at high speed.
The numbers @sazrocks quoted are correct, however, remember we are dealing with asynchronous processes here so none of this is absolute. That is, commands are sent to the motor as a reply to data it sends, the motor is nominally sending messages to the V5 every 5mS, so that is the maximum rate we can send reply command data back. Your user code has background processing happening, so when you delay for 5mS that happens most of the time but not always if the system needs to do other processing. When you change motor voltage that also has to be piped through from the processor the user code is running on to the processor handling communications, all of these things will add small delays, this is not designed as a hard real time system.
No difference observed. Smooth acceleration and deceleration. Stop at almost the same place with 3-4 replication of each time-interval.
two issues;
measured speed is different from expected speed. (see table below)
expect travel distance is significantly different from actual distance (calculated from measured speed). actual distance (calculated from measured speed) is close to the travel distance measured with measuring tape ( about 37 inches).
Motors aren’t limited to their rated speed in voltage control mode. I managed to hit 2000 rpm on my TP flywheel with a 600 rpm motor and a 3:1 gear ratio (meaning the motor hit close to 670 rpm).
How dose voltage related to speed and torque? Are they linear or more complicated function? If I use voltage control drivetrain, I want to find out the speed thus the distance it travels. Thank you
Thank you for the interesting figure. I did the same to the table above. It seems that I did not get the motion profile I want. I may need to investigate why this happen.
Thanks for the graph. You are not seeing the results you want because of inertia (at rest and in motion), friction , the way DC motors work and the way controllers work.
When you start off applying power, the motor controller is at the far end of it’s control band. So the initial increments will be slightly non-linear. There is initial friction to overcome in the motor and the drive train. DC motors need to have a level of voltage before there is enough magnetic attraction to move the rotor. You are up against inertia at rest. Once you get past that you see the robot move (and your graph shows that)
Once you get to where you want to go, you start to decrease and you now are fighting inertia of an object in motion. Without setting any brake action, the weight of the motor will continue to drive it. And again as power decreases the electromagnets get weaker and weaker.
Try your test again, but start out with an initial higher power level. Set the brake value on the motor to get the help from the motor to slow things down.