How would one program an H-Drive or Holonomic drive (like in this article https://kb.vex.com/hc/en-us/articles/360035591572-Selecting-a-VEX-IQ-Drivetrain )? My students understand the engineering, but not how to code the joystick to drive it.
Hi @Alexandra_Kelly Welcome to the PLC! Are you trying to code the drivetrain autonomously or use code with the controller? Thanks,
Just to use with controller
Here is a snippet of code for an H drive
You can see, I can set the velocity of two of my motors, and then the control of my H motor with the conditional. Give it a try and let me know what you think. Thanks!
Thank you so much! I’m starting to understand.
So you would program “left motor” and “right motor” instead of drivetrain? And could you still configure the controller in devices?
Also, how would this change for a build like the kiwi bot or an x drive?
Yes, you would code the individual motors and not the drivetrain. The drivetrain has to be preset. For example, with the drivetrain commands, you tell the robot exactly how far to move forward:
Yes - the code I am showing uses the controller. Notice how the left and right motor’s velocity are determined by buttons A and D of the controller? Check out this article on how to do that: https://kb.vex.com/hc/en-us/articles/4407063155732-Configuring-a-Controller-in-VEXcode-IQ
The only way that VEXcode can do that if it knows the size of the wheels and where the wheels are in the drivetrain. We set the config to the basic robot drivetrains (e.g. basebot and clawbot).
This is why we have these templates in VEXcode. These are the preconfigured drivetrains:
If you are not using one of these drivetrains, then you need to use the individual motors.
What if you want to use one of these drivetrains but change the wheels? That is why we have this setting in the robot config:
Ok, that is a lot. I would check and make sure you understand these concepts and then we can talk about other custom drivetrains. Also, you can check out our IQ course that is upcoming.
This is another super simple way too. You can reverse the motors and set velocity and stopping under your when start accordingly. Reach out if you have any super specific questions! I’ll gladly do my best to answer any questions.
I made a video showing how to program an xdrive
The only big difference is that the IQ controller uses letters (ie. ABCD) for the joystick axis where the EXP/V5 controllers use numbers.
Let me know if this works for you.
Thank you so much!