OK, so to recap … the original idea was to test a 257rpm drivetrain using 4x 600rpm motors as pictured below connecting the motors to the 2 inline blue 36T gears:
Testing this I was curious why one motor on each side was rapidly overheating.
Long story short, I isolated this to a simple test rig containing only the middle three gears (36T/84T/36T), picture here:
For programming I’m using either a motor_group and then the spin() function using percent speed as an input, or setting the voltage on each motor directly (to approximate the same speed), ie:
motor m1 = motor(PORT11, ratio6_1, true);
motor m2 = motor(PORT12, ratio6_1, true);
motor_group mg1 = motor_group(m1, m2);
mg1.setStopping(coast);
mg1.spin(forward, 25, percent);
or
m1.spin(fwd, 3.0, volt);
m2.spin(fwd, 3.0, volt);
What I’m finding is that when using the speed based input the torque on the motors diverges over the space of a few seconds with one motor ramping to 100% torque and the other falling to zero:
If I use the voltage control the motors stay more or less at the same torque (although of course the speed is now more variable):
Full sample below - I seem to be unable to upload a v5cpp project:
#pragma region VEXcode Generated Robot Configuration
// Make sure all required headers are included.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>
#include “vex.h”
using namespace vex;
// Brain should be defined by default
brain Brain;
// START V5 MACROS
#define waitUntil(condition)
do {
wait(5, msec);
} while (!(condition))
#define repeat(iterations)
for (int iterator = 0; iterator < iterations; iterator++)
// END V5 MACROS
// Robot configuration code.
// generating and setting random seed
void initializeRandomSeed(){
int systemTime = Brain.Timer.systemHighResolution();
double batteryCurrent = Brain.Battery.current();
double batteryVoltage = Brain.Battery.voltage(voltageUnits::mV);
// Combine these values into a single integer
int seed = int(batteryVoltage + batteryCurrent * 100) + systemTime;
// Set the seed
srand(seed);
}
void vexcodeInit() {
//Initializing random seed.
initializeRandomSeed();
}
// Helper to make playing sounds from the V5 in VEXcode easier and
// keeps the code cleaner by making it clear what is happening.
void playVexcodeSound(const char *soundName) {
printf(“VEXPlaySound:%s\n”, soundName);
wait(5, msec);
}
#pragma endregion VEXcode Generated Robot Configuration
/----------------------------------------------------------------------------/
/* /
/ Module: main.cpp /
/ Author: {author} /
/ Created: {date} /
/ Description: V5 project /
/ /
/----------------------------------------------------------------------------*/
// Include the V5 Library
#include “vex.h”
// Allows for easier use of the VEX Library
using namespace vex;
bool bFirstPrint = true;
int printID = 0;
double m1trq_avg = 0.0, m2trq_avg = 0.0;
double m1spd_avg = 0.0, m2spd_avg = 0.0;
double m1tmp_avg = 0.0, m2tmp_avg = 0.0;
void printThread()
{
if (bFirstPrint) {
printf(“time, m1 trq, m2 trq, m1 spd, m2 spd, m1 tmp, m2 tmp\n”);
bFirstPrint = false;
}
printf(“%4d, %6.2lf, %6.2lf, %6.2lf, %6.2lf, %6.2lf, %6.2lf\n”,
printID, m1trq_avg, m2trq_avg, m1spd_avg, m2spd_avg, m1tmp_avg, m2tmp_avg);
printID++;
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// Begin project code
wait(100, msec);
motor m1 = motor(PORT11, ratio6_1, true);
motor m2 = motor(PORT12, ratio6_1, true);
motor_group mg1 = motor_group(m1, m2);
mg1.setStopping(coast);
mg1.spin(forward, 25, percent);
// m1.spin(fwd, 3.0, volt);
// m2.spin(fwd, 3.0, volt);
int loopcount = 0;
int loopmax = 250;
double m1trq_accum = 0.0, m2trq_accum = 0.0;
double m1spd_accum = 0.0, m2spd_accum = 0.0;
while (true)
{
double m1trq = m1.torque(Nm);
double m2trq = m2.torque(Nm);
double m1spd = m1.velocity(percent);
double m2spd = m2.velocity(percent);
double m1tmp = m1.temperature(percent);
double m2tmp = m2.temperature(percent);
m1trq_accum += m1trq;
m2trq_accum += m2trq;
m1spd_accum += m1spd;
m2spd_accum += m2spd;
if (loopcount == loopmax - 1) {
m1trq_avg = 100.0 * (m1trq_accum / (double) loopmax) / (1.05 / 3.0);
m2trq_avg = 100.0 * (m2trq_accum / (double) loopmax) / (1.05 / 3.0);
m1spd_avg = m1spd_accum / (double) loopmax;
m2spd_avg = m2spd_accum / (double) loopmax;
m1tmp_avg = m1tmp;
m2tmp_avg = m2tmp;
thread t1 = thread(printThread);
loopcount = 0;
m1trq_accum = 0.0, m2trq_accum = 0.0;
m1spd_accum = 0.0, m2spd_accum = 0.0;
} else {
loopcount++;
}
wait(1, msec);
}
}