H-Holonomic Drive Code Help


#pragma config(Motor,  port1,           HP393LeftFront, tmotorVex393, openLoop)
#pragma config(Motor,  port2,           HP393LeftBack, tmotorVex393, openLoop)
#pragma config(Motor,  port5,           StrafingWheelLeft, tmotorVex393, openLoop)
#pragma config(Motor,  port6,           StrafingWheelRight, tmotorVex393, openLoop)
#pragma config(Motor,  port9,           HP393RightFront, tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port10,          HP393RightBack, tmotorVex393, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main ()
{

  while(1 == 1)
  {
    motor[HP393LeftFront] = vexRT[Ch3];
    motor[HP393LeftBack] = vexRT[Ch3];
    motor[HP393RightFront] = vexRT[Ch2];
    motor[HP393RightBack] = vexRT[Ch2];
    motor[StrafingWheelLeft] = vexRT[Ch4];
    motor[StrafingWheelRight] = vexRT[Ch1];
  }

}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I would like to put the strafing wheels on “Btn6U” to strafe right, and “Btn5U” to go left. How would I do that?


motor[drStrafe] = (vexRT[btn5U] - vexRT[btn6U])*127

Which one of 5U and 6U is positive depends on which direction is positive for your motors.

I’m confused. Do I replace the code you posted with my strafing wheels code?

This:

motor[HP393LeftFront] = vexRT[Ch3];
    motor[HP393LeftBack] = vexRT[Ch3];
    motor[HP393RightFront] = vexRT[Ch2];
    motor[HP393RightBack] = vexRT[Ch2];
    motor[StrafingWheelLeft] = (vexRT[btn5U] - vexRT[btn6U])*127;

Edit: I downloaded the above code and when I drive the left side, the strafing wheel also moves. The buttons don’t work.

If your strafe wheels are locked together, or otherwise don’t need to move independently of one another, the code code for each wheel is the same.

They are both not chained together. They are directly driven. So paste the code for each motor?

This is my code

#pragma config(Motor,  port1,           HP393LeftFront, tmotorVex393, openLoop)
#pragma config(Motor,  port2,           HP393LeftBack, tmotorVex393, openLoop)
#pragma config(Motor,  port5,           StrafingWheelLeft, tmotorVex393, openLoop)
#pragma config(Motor,  port6,           StrafingWheelRight, tmotorVex393, openLoop)
#pragma config(Motor,  port9,           HP393RightFront, tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port10,          HP393RightBack, tmotorVex393, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main ()
{

  while(1 == 1)
  {
    motor[HP393LeftFront] = vexRT[Ch3];
    motor[HP393LeftBack] = vexRT[Ch3];
    motor[HP393RightFront] = vexRT[Ch2];
    motor[HP393RightBack] = vexRT[Ch2];
    motor[StrafingWheelLeft] = (vexRT[btn5U] - vexRT[btn6U])*127;
    motor[StrafingWheelRight] = (vexRT[btn5U] - vexRT[btn6U])*127;
  }

}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

\

When I drive the left side of the drive (Ch3) both the strafing wheels move with it.

Your code appears to be correct. Have you checked that the motors are in the right ports?

I got it figured out. The code had a lower case b for the function btn6U, so I changed all of the lowercase b’s to uppercase B’s. It works fine now!

Thank you all!

Now that you have a good start for the basic drive, you may want to now think about current management.

Are you using a power expander?

That’s going to be a fair amount of current going to 6 of the 393 high strength motors. You may want some variable on the strafe (and the others) to limit current versus the full 127 going to all the motors all the time.

Tripping breakers is no fun.

I agree. And the best way to have variable on a drive is by using the joysticks. Why did you decide not to use Ch1 or Ch4 for the strafe wheels?

I actually had the strafing wheels on Ch1 and Ch4, but I hated it. It would get really annoying if I wanted to go straight, and I held the stick a little to the left/right it would then go off to the side a little.
I works SO much better on Btn6U, and Btn5U.

If you ever did want to go back to the joysticks, you could try making a deadzone where the motor won’t move unless it recieves a value above a certain number say 20 or so (you would have to decide what works best)