Hi everyone, can someone please help me with my drivetrain code as it is not working. I have tried the basic drivetrain code (where you go into the controller section of devices, and click on the joysticks for various methods to control the drivetrain) as well as an alternative code one of my team members gave me, and both are not working. Please help!!!
What do you mean by “not working”?
Ex: motors not spinning at all, direction reversed, gear teeth chattering, etc.
How many motors do you have on your drivetrain?
What was the alternative code (post it pls)?
We need some more info to be able to help you
In the meanwhile, here are some things to check:
- Are your motor directions reversed?
- Test the controller with other mechanisms. Does it still work? (Since you said “joysticks”)
- Are your motors in the right ports?
- Test each motor individually (just use the code to rotate the motor 360 degrees). If it doesn’t spin, you got a messed up motor and you need to swap it
Thanks for your help, Gigahertz.t regarding the motion of my drivetrain. However, I have encountered another issue in the process.
Whilst trying to configure* (or map, as my team calls it) the drivetrain to the joysticks on the controller, the robot will move in a direction exactly opposite to what was coded. Please help me on that side.
Try reversing the direction of all the motors. (Like forward to reverse and reverse to forward)
I don’t think you understand. I am trying to configure the controller to various motors in a method involving you going to the controller section of devices. Let me show you in a picture:
My current incarnation of my drivetrain code, where the left joystick controls the forward and backward motion of the robot, while the right joystick controls the turning of the bot.
As you can see, the system pre-formats for code regarding a drivetrain and is only applicable to the joysticks, hence why I was referring to “joysticks” in my first post. I have tried reversing the code (the right joystick is controlling the forward and backward motion of the robot, while the left joystick is controlling the turning of the bot.), but to no avail. If you (or someone else viewing this post) can help me with this or even suggest a working drivetrain code (as me and my experienced coder on my team is stuck, and with the rest of my team being inexperienced in VEXcode IQ) it would be greatly appreciated.
are the motors in the correct ports?
Hello. To help troubleshooting:
- Can we see your configured devices?
- Are your motors in the right ports?
- Is the direction of the drivetrain configured correctly?
Sardorbek_Omonkulov,
- I have only configured my drivetrain on to my controller.
- I am pretty sure I have connected it to the right ports, but I will check again.
- Yes, it is configured correctly.
Oh sorry, you want to switch the joysticks?
I have not tried this, but I found this Vex article on custom joystick configuration:
You can do something like this:
(To go forward, each line a seperate event)
LeftMotor velocity (controller c position, percent); LeftMotor spin forward
RightMotor velocity (controller c position, percent): RightMotor spin forward
(To turn, each line is a seperate event)
LeftMotor velocity (controller b position, percent); LeftMotor spin forward
RightMotor velocity (controller b positionn percent); RighMotor spin reverse
maybe the code thinks that the drivetrain’s front is actually it’s back. I believe someone else mentioned this, but try reversing the directions of all your motors.
Thank you so much, Gigahertz.t for your code! So far, it works for turning right, but could you help me make it turn it left without a press of a button, as the idea I have in mind is to make it turn left on the press of a button.
Never mind my above post. The drivetrain is working now; thanks to Gigahertz.t and everyone that posted in this string of posts for helping me overcome this significant challenge!
I am assuming you want to make it turn left on a button press. Does this mean you hold down a button and the robot turns or press a button and the robot turns let’s say 90 degrees?
Gigahertz.t, you can ignore that post. My brain’s battery was extremely low, therefore it wasn’t turning how I intended it to. But now it is. Thanks for your help, though!