Trying to hook up individual motors to the joysticks on the vex controller

Hey there, first-time user here and hoping to get some help with programming my team’s bot to do some things.

So I have a Holonomic drivetrain with it specifically using mecanum wheels to move around. I’ve already done my research and understand that it can move omnidirectionally by rotating the wheels in specific ways to move in a direction but what I’m wondering is the possibility of automating the change of wheel movement and direction, and having it so that when the joystick is pushed to the left, the motors that are needed would turn on and do the actions to move the bot. And I am hoping to get this kind of function for different areas of the joystick, so going up would move it forward, the top right would move it diagonally to the right and forward, then pushing the joystick to the right would have the bot move only to the right, and so on and so on.

Currently what I have is the arrow buttons on the controller mapped to separate actions.
Ex: hitting the left will make the robot move left by spinning the wheels in the order needed

I am more than willing to try and elaborate on what I mean if it’s needed, and I apologize if my writing is a bit weird since I don’t exactly know how else to describe what i’m hoping to accomplish.

1 Like

What are you using to program, e.g. vexcode V5, robotmesh, pros?

The program is VEXcode V5

If you do a search there are about a dozen post across the last 8 years with the code and everything you need in it.

4 Likes

Could I possibly get a link to one of these posts that seems the most helpful?

I taught this guy how to do something like this. Math is included, and you will have to make a few changes to put it on buttons, but here it is.
(Also, the magnifying glass in the top right corner is for searching for things).

2 Likes

I noticed that you do not give a straight-up answer, I usually work better if I can look at how it is done and work in the opposite direction. But from what I can gather I need to find a way to get the axis’s integer and have it correlate to the motor’s spinning?

most people on the forums wont just give you code as we want you to learn how to do it, not just copy paste. with that being said, i will say that i am the same way as you, i find it easier if i can see an example and go from there,

here is an example of how you can link a motor to a joystick

Right.spin(fwd, Controller1.Axis1.value(), pct);

(fwd can be used for forward, pct can be used for percent, and Right is the motor name)

which you can combine with the math required for holonomic drive to make something like this

Right.spin(fwd, Controller1.Axis3.value() - Controller1.Axis1.value() - Controller1.Axis4.value();, pct);
6 Likes

Ah that helps, thanks a ton! I’ll try to get this working when I have time and if I have issues I’ll try to get back and say something and also do some more work on my own.

1 Like

@FunkyVoiceDude
Thanks 7996B, I hadn’t seen this post (Ping me if you need me, I don’t check otherwise). I usually don’t give the answer unless they say it first. I will help someone work through it, or else what is the point of robotics?

7996B said what I was pointing at, and you can find how to do pivoting there also.

1 Like