Does anyone know how do code for a holonomic drive? I’m currently stuck with a robot with no code since my team doesn’t know how to code for a holonomic. Does anyone have a code they can share with me? I have a meet tomorrow but no code yet.
I’m not a programmer but I understand holonomic drives pretty well, what kind of holonomic is it? An X-holonomic, mecanums, etc?
It’s an X-drive.
Check out Cody’s tutorial on holonomic drives: http://polynomic3d.com/user/smith/holonomic.php
Oh this is for pic, so I don’t know if that makes a difference. I’m only a builder, I know nothing about code.
Yeah but that’s 45 minutes long. I’m actually at robotics now, waiting to test my new design to see if it can work.
Okay, so the general idea is that even though the wheels are placed at 45 degree angles to the norm, vector addition will cancel out horizontal force of the wheels and leave the resultant vector as straight ahead.
/ \
\ /
So with wheels like that, if you wanted to go straight (up on the page), then you just have to run the 4 wheels in the direction that provides a force upwards. The horizontal forces will cancel each other out and the robot will go straight.
The same idea should be used for strafing.
You should have forward backward movement on the same joystick as strafing (ex. Channel 3 for forward backward, Channel 4 for strafing)
Then when you move diagonally to the NW, since you basically want the robot to go forwards and also move left, the motor powers will cancel out and the NW and SE wheels in the X-holonomic drive will not move, while the NE and SW wheels will move at full power in the direction you want.
For turning, you just put that on a different channel (we like Channel 1) and that should be pretty intuitive as you just have all the wheels spin in a circular direction.
Once again, I’m not a programmer so I usually just end up switching negatives randomly until they work, but that would be the general idea.
So, basically, if you have arcade drive, the code to control the front right wheel would look like this (assuming the all the wheels move forward when given a power of 127):
motor[frontRightWheel] = vexRT[Ch3] - vexRT[Ch4] - vexRT[Ch1];
That’s the very basic start. Then, to get a better drive, you can start making modifications to it.
Saying this makes it sound like you want others to do your work for you. It comes across as “I’m to busy to do my own research, so can you please give me the answer”
Well the first part was the basic part that i needed. And I can’t watch that video at school, the interweb is too slow.
I disagree. Cody’s tutorial is VERY long. This is a problem with a very simple answer, not one that requires 45 minutes to explain.
Since people above have been describing how to make arcade work, here is what to do for tank (in pseudocode):
NW / \ NE
SW \ / SE
NE = right_forward - average(right_sideways, left_sideways)
NE = limit(NE)
SE = right_forward + average(right_sideways, left_sideways)
SE = limit(SE)
SW = left_forward - average(right_sideways, left_sideways)
SW = limit(SW)
NW = left_forward + average(right_sideways, left_sideways)
NW = limit(NW)
function limit(a)
if a > 127
a = 127
elseif a < -128
a = -128
endif
return a
Where positive rotation for each wheel is the direction in which it rotates if the robot is travelling forwards, and the positive sideways direction is right.
This will:
- Prioritise running motors at full power above travelling in the expected direction and rotation, because motors are capped at full power. The alternative is to scale down the power of all the motors so that the fastest one goes at max power but the proportions remain the same. This would result in more intuitive motion but a slower robot.
- Use up one more channel than it needs to because you are using the average of the horizontal channels on both joysticks to control the strafe. Most people don’t use the second horizontal channel anyway, but you could free it up for something else if you wanted.
What programming software do you have - you didn’t let us know and that will help.
Did you check out the “Code” link here in the forum? I know people have posted holonomic drive code over the years - maybe there might be one that is written for the programming language that you are using.
I posted code for a holonomic drive written in EasyC Pro after watching Cody’s video - which is great by the way and well worth the time to watch if you get a chance. It is very well done and makes it easy to understand. I believe he used RobotC and I had to convert it over to EasyC for the pic.
I hope this helps. I would send you a screen shot of the program so you could see what is going on in case you are using a different programming language, but EasyC Pro and that program are on my laptop which doesn’t work at the moment. Maybe someone else who has EasyC Pro could send you a screen shot.
Let us know how you are doing.
If you have EasyCv4, the holonomic code is built into the program options. Under the “Joystick” options, the “Holonomic” icon can be dragged into an infinite while loop in your program. When you open it up, it shows which motor to connect to each port. It automatically assigns the right stick to shifting (up/down/left/right and diagonal configurations between). The left stick is for spin CW and CCW, just like Halo.
Hope this isn’t too late. I was AFK yesterday.
Using Firefox, Hovering over the Play button of Flowplayer reveals the Link to the Holonomic.flv file…
Click on the above link, and save the file to your local computer… Have Lunch and a few Competition Practice Rounds in the meantime…
That is quite Cool…
That is what a Smart Phone is for…
My “old phone” was getting unreliably on the Charging and like to switch to Headphone Mode, with no Headphone… So I bought an HTC Wildefire S. Now, I can follow Vexforum, from just about anywhere… Now if I can just figure out why the Calendar, has all my appointments from my Work Calendar on it… Spooky…
When I go AFK, it’s deliberate (I was on a college tour with my daughter, plus nearly 5 hours of driving).
I finally broke down and got my first cell phone 9 months ago: a “dumb” phone with $100 pre-paid minutes. The minutes are good for a year, for a monthly cost of $8.33. But the dumb phone does its job – on the way home, I took a wrong turn on the freeway, called husband who googlemapped from home, and I was back on the road in 3 minutes. Let’s hear it for human GPS!
So guys thank you for all the feed back!! My robot with its holonomic worked amazing! From this, I think a starter holonomic drive code should be included in the sample robotC programs, I don’t know if its the same with easyC. Godzilla has seen how my robot worked with holonomic
easy c has a holonomic block which you just drag in and tell which motors are front left, front rear, etc. btw i really like your wallbot, it worked really well
Oh… maybe that’s why easyC is called “easyC”… Oh well. And thanks, we didn’t expect the wallbot to be that good, when we tested it the night before it could barely do anything. The trick was that the wheels fell down.