# Holonomic drive train code

Thanks,
would it make sense for you to copy and past me your full code and then i can adjust it to suit me?

It would be supper awsume if you could!

I also saw you might have use robotC but robotC can only be used with cortex right?

2 Likes

This code was used in VexCode V5 Text, and I no longer have the code since we rebuilt our code, but that code should get your motors to move after they are declared.

RobotC works with V5 and IQ, too, I believe.

It doesn’t move any of the motors and I don’t know what you mean by “after you declare them”

Just Cortex and IQ, not V5.

I tested this before I posted the code and it works fine with a controller so you must have a different issue somewhere.

To explain the code a bit further:
There are two commands in this code relating to the motors - the ones that contain spin e.g. LeftFront.spin(FORWARD) and the ones that contain set_velocity.

The set_velocity commands do not make the motor move at all. They just tell the motor what speed is should turn when it is told to move. It is the spin commands in this case that tell the motors to move.

So at the start of the program we tell all 4 motors to spin. The speed that they spin at is governed by the code in the loop. The fact that we tell them to spin forward is somewhat irrelevant.

The code then enters the infinite loop (while True:) and each time it goes round that loop, it sets the velocities for all 4 motors based on your controller axis positions. When you are not touching the controller axis at all, all values are zero so whilst we have told the motors to spin at the start of the program, we are telling them to spin at zero velocity so therefore they don’t move.
As you move the axis, the various values for velocity are updated and the motors will start to turn. These could be negative velocity values which would make the motor spin backwards, or positive values which make it spin forward.

When I said earlier that the code may not work, what I meant was that it may not do what you want it to do in terms of holonomic movement. But it will work in terms of making your motors move relative to inputs on the controller.

If the motors aren’t moving at all and you are sure you have working motors plugged in to the ports as per the program and you are sure your controller is paired then your issue lies somewhere else.

It may be better for you to start off writing a very simple tank drive program initially before moving onto holonomic code. This way you can learn the basics of motor control via the controller before adding the maths complexity created by using holonomic code.

7 Likes

Wow Thank you so much!!!
It works!!!
I just can’t belevie my eyes, oh the delight when the wheel just moved!!!

When I went to retry the code again I had my controller plugged into my pc instead of the brain.
I was also making lots of other small mistakes along the process but after you explained how the code worked it just made sense

Thank you so much!!!
I have been dying over the last week on how to get it going.
I really I really owe you!!

Like I just cant describe how happy I am!!!

Sorry if this was any burden two you. But now i know better how to use vex code v5

Thank you so much!!

4 Likes

This is the solution but because I tag this topic under “Discussion” there is no solution button.

Thank you all so much for everybody that helped out!!!