How to code x drive autonomous

We are having trouble with our autonomous. So we need help coding it in blocks

Would you mind sharing the code you already have and also saying the exact problem that you have? We can’t help if we don’t know what’s wrong.

I have an example in text that you can translate.
image
We’re doing an X-Drive right now so I’d be happy to help.

1 Like

Were honestly just so confused that we really don’t have any code so we just need to know the basic of what to do

At least start by searching the forum and watching some of the old tutorials.

5 Likes

You could also use myblocks (if using block) to make it easier

1 Like

After you learn how holonomic drives work after watching the videos from the other post jpearman recommended, I would first make functions to make the code more compact instead of coding each motor all the time. You would do this by going to “my blocks” and then clicking “Make a Block”. You should probably rename “block name” to whatever the code does. Then you add a parameter for the block by clicking “Add an input”. You should also say what it does in the name.

For example:

image

Note: This is code for mecanum wheels, but it is the same principle.

Now, you can use that parameter as an input, whenever you use it as a variable. Everything using this parameter will change if you use this function again.

image

For example: If I use this “Forward” function, and put 100 as a value, it would run everything under the “define (Foward (Distance))” block in the first picture and replace every “Distance” parameter with 100.

Hope this helps.

1 Like

I don’t have much experience with x-drive, but I have learned that it is much easier to code more complicated things like this in C++, also it’s a good thing to learn early.

Well, you know how X-Drive moves, right? Well, you can tell each motor to move a specific direction to move a certain distance.

For example,
-Move towards roller
-Spin Roller
-Move forward pick up one disc
(END)

Just make each task get performed with each motor.

Okay after looking at this I think i understand so we will try it and see if it works

1 Like

Honestly thank you so much bro I had no idea how to go about programming my X drive auton and you just helped so much I will create a code for my bot tonight and test it tomorrow you just made my life so much easier