Our team has switched the drivetrain from a 4 motor, 4 wheel drive to a 6 motor, 4 wheel drive. And I don’t know how to make the separate motors (lf, lm, lb, rf, rm, rb) in to one name called “drivetrain”. I’ve seen other posts about coding 6 motor drivetrains but I don’t know how to implement them into what I need.
I just want to know how I can add all 6 motors in to the name drivetrain to then add to auton
so I’m able to use the driveFor function.
These are the posts I’ve seen that are relevent
So far I’ve not been able to find a post that completely helps
If you look at the VEX API documentation for the drivetrain (drivetrain constructor) it shows that the first two arguments are motor groups named l and r. These correspond to your left and right drivetrain motors respectively.
Now, the motor group (motor_group constructor) is constructed through 2 (or more) motor arguments (the ... means an unlimited number of arguments can go there.)
So, what you need to do is create 2 motor groups, one with your three left motors and one with your three right motors. Afterwards, you can pass those into the drivetrain constructor along with all other needed parameters.
So that solved it but it acts weird, when I type rev it gives an error. However when I type fwd, Forward, or reverse it doesn’t give me an error. Thanks anyways.
It thinks that rev is referring to the rotation units rev which is short for revolutions. You need to either type out reverse or set it to forward and just make the number negative for it to work.
When using the RotateTo functions, the default behavior is that the WaitForCompletion is set to true, which will cause the robot to go in circles or fight against itself (especially if you have brake mode set to hold).
You want to set the WaitForCompletion value to false for the first 5 motors, then you can set the sixth one to true.
Can you post the error? Our team uses spinFor as well. Here’s a snippet of what their spinFor code is. It’s a 4 motor drive, but the concept is the same.
OK. spinFor does not have an overloaded method that accepts distance such as inches or mm. I don’t think any of the Spin methods accepts distance as a parameter. If you want distance, then you’ll have to convert distance to degrees or rotations.
For the spinFor using time it doesn’t have a WaitForCompletion parameter. So you can just have
lm.spinFor(forward, 2.5, sec);