So my team recently switched to 6 motor drive and it’s great (besides the fact that that only leaves 2 motors for everything else and we don’t have phematics). The only problem I’m having is that the turn volocity is way too high. Since it’s 6 motor drive and it doesn’t use a drivetrain and each motor is separately coded, is it possible to make the turn velocity lower?
What control system are you using?
Arcade or tank?
One is much easier than the other to do.
using arcade system:
multiply your horizontal axis turn value by a coefficient which would lower it
using tank system:
not entirely sure, but you could check to see if both axes were outside of a certain range (say check to see if the left axis was within 15 percent of the right axis), and add the coefficient after this check.
(I believe) I’m using tank currently (Left stick controls left side and right stick controls right side)
You could do left minus right then use the absolute of this value to determine if the turning is a noticeable amount.
If so then you minus the non-absolute value form the right and plus the non-absolute value to the left. This will cancel out any turning so you should divide the value by a coefficient first.
Hope this helps.
It’s a little bit over my head (Our coach makes us use block coding, so it’s difficult to get to the next level of coding) But thank you for the help!
Could you maybe explain this a little more? I showed this to my team and they had no idea what you are talking about and to be honest I don’t really either. An example might be nice. Thanks
Here is some Sudo code.
You can play around with the constant and the threshold at which the turn velocity is adjusted.
The larger the constant the less it reduces the turning.
If you have the threshold to lower the code will slow the robot when it’s going almost strait. Which will slow down the overall forward speed.
If the robot is turning so little, slowing down the turning is unneeded.
here’s some test code to try ¯\ _ (ツ) _ /¯
const float turn_speed_slow = 0.8;
const float turn_deadband_width = 15;
void usercontrol() {
float left_stick_percent = controller(primary).Axis3.position(percent);
float right_stick_percent = controller(primary).Axis2.position(percent); //readability
float left_velocity = left_stick_percent;
float right_velocity = right_stick_percent;
if (fabs(left_stick_percent - right_stick_percent) > turn_deadband_width) {
left_velocity *= turn_speed_slow;
right_velocity *= turn_speed_slow;
}
left_motors.spin(fwd, left_velocity, pct);
right_motors.spin(fwd, right_velocity, pct);
}
Wouldn’t this slow down the drivetrain as a whole?
I think my method is better as it doesn’t reduce the overall speed of the robot. Just the turn speed.
L - R.
If you turn left the left joystick will be less than the right. This means the difference will be negative.
If you minus a negative you get a positive so you minus the difference from the left side and add the difference to the right side. You – the left side to increase the speed and - the right side to decrease the speed. This reduces the difference between the 2 speeds and therefore decreases the turn.
If you turn right the right side will be less than the left. This means the difference will be positive. If we do the same as above. Minus the difference from the left and add it to the right. It decreases the left and increases the right. This also decreases the difference between the 2 which decreases the turning speed.
Both times the turning speed is decreased but the total speed of the combined motors stays the same.
Here is the math in action with some arbitrary speeds and turn reduction constants.
oh, ig you could absolute the values before subtraction then.