My team wanted to use the 4 motor drivetrain function with the new vexcode v5 Pro, but you can’t reverse the motors with the basic function, you have to enable expert motor config. This seams to introduce so many problems. Has anyone been successful doing this? My issue currently is I did all my usual usercontrol code in the robotconfig.cpp because a lot I used vexcode controller feature where you can assign motors to buttons. Now when trying to write an auton it’s all messed up beacuse the code in robotconfig.cpp is running at the same time. I tried moving all that over to usercontrol in main.cpp and simplfying it down to basic if statments, but now it doesn’t recongize any of the additional motors/sensors I added manually in robotconfig.cpp. If I try to #include robotconfig.cpp it says everything is a duplicate.
I will try and add the motors and sensors I added to the robotconfig.h file, but I dont know if it will work. Does anyone have experience with expert robot config mode competition template?
In general I don’t recommend using the built in 4 motor drivetrain object. It’s much more reliable, flexible, and educational to just program your own drivetrain, and it’s not very complicated to do.
Also, don’t put usercontrol code in the robot configuration file.
Like what @ashatoolsidas said, it is extremely beneficial to program your own drivetrain. I just created a function with the parameters I want, such as rotation and velocity.
void driveFunction(double rotation, double velocity){
///spin motors based on parameters
}
Okay i’ll make my own functions. For a turning function where it turns to a certain heading with the gyro. Would it look something like this? Do voids run forever, like once it is done turning how do I make it move on?
For the spin for function, you have to call a parameter which makes sure that the program doesn’t wait until one line is fully executed before executing the next step. So, it should be:
The motors will stop spinning after the while loop has been stopped. In this case, it would stop after the motor no longer is greater than anglez-3 or no longer less than anglez+3
No they won’t because the function is turning them on and then they will continue until there is a piece of code that turns them off. But I am struggling on where to put that.
this is what I have right now and its not moving. Also I have the gyro calibrate in the beginning of auton because I wasn’t sure if it ran pre auton when running a “timed run” on the controller.