We want to try out using a Holonomic drive this year for one of our robots. For this one though, they aren’t at 45 Degree angles on each corner of the bot. The wheels are on each side of the bot. I tried programming it to go in all 8 directions with the RC remote but when you try to go to the left it wants to engage the motor in both directions so it just twitches. The way we have it set up is the front left corner would be going forwards. Any help on the programming for this? If you need any more information, just ask.
im guessing you made your own mecanum wheels then? if so, please put up some pictures. ill try to find some code for omni-bots.
#include "Main.h"
void main ( void )
{
int LF; // Left Front
int RF; // Right Front
int LR; // Left Rear
int RR; // Right Rear
int leftx;
int lefty;
int rightx;
int spin;
while ( 1 )
{
// Get Data
leftx = GetRxInput ( 1 , 4 ) ; // Left Joystick, X Axis
lefty = GetRxInput ( 1 , 3 ) ; // Left Joystick, Y Axis
rightx = GetRxInput ( 1 , 1 ) ; // Right Joystick, X Axis
// Half the input signal (so code does not overflow past 255)
leftx = leftx / 2 ;
lefty = lefty / 2 ;
spin = rightx / 2 ;
// Drive Code Algorithim
LF = RR = lefty - leftx + 127 ;
RF = LR = 255 - lefty - leftx ;
RR = 255 - RR ; // Reverse Direction of RR motor
LR = 255 - LR ; // Reverse Direction of LR motor
// Spin Code Algorithim
RF = RF - spin + 63 ;
RR = RR - spin + 63 ;
LF = LF - spin + 63 ;
LR = LR - spin + 63 ;
// Code overflow prevention
if ( LF < 0 )
{
LF = 0 ;
}
else if ( LF > 255 )
{
LF = 255 ;
}
if ( RF < 0 )
{
RF = 0 ;
}
else if ( RF > 255 )
{
RF = 255 ;
}
if ( RR < 0 )
{
RR = 0 ;
}
else if ( RR > 255 )
{
RR = 255 ;
}
if ( LR < 0 )
{
LR = 0 ;
}
else if ( LR > 255 )
{
LR = 255 ;
}
// Set Motors
SetMotor ( 1 , RF ) ;
SetMotor ( 2 , LF ) ;
SetMotor ( 3 , LR ) ;
SetMotor ( 4 , RR ) ;
}
}
thanks to ArtDutra for this code.
I can’t get any pics right now, but I drew a really quick picture in paint to show you how it is. The circles on each side are the omni directional wheels. The problem is when you try to go Forwards and Left at the same time, the wheels on the side are trying to go both forwards and backwards at the same time.
The easiest possible way to control a 4-wheel holonomic drive is to put the forward motion along the axis of two of the wheels. That way, straight forward would be the two side wheels moving forward and the front and back wheels idling. Left and right would be the front and back motors moving and the side wheels idling. Then you just do a little subtraction for spin. That way, you can hook the two side wheels directly to the forward channel, the two side wheels directly to the sideways channel, and then adjust all of the values per the spinning channel.
If it is important to use the corner as the front of the robot, then think about each individual wheel on its own to figure out how to control it. e.g. the front right wheel needs to be moving forward when you drive forward, but it also needs to drive forward when going to the left. Right an equation for mixing the forward and sideways channels so that it will move forward both when the stick is at the top or at the left or both. Rotating is easy, you just add or subtract a value from the rotation stick to all of the wheels simultaneously.
I tried to redo the code in easy c ( replicate it ) the motion will work, except the wheels are on a constant motion wont stop unless i start playing with the joysticks.
It sounds like you need to increase the threshold from center-stick.
Old pseudo code:
var1 = get RC input from stick
var2 = func( var1 )
set_motor1(var2)
New pseudo code inserted between var1 line and var2 line
if abs(var1-centerstick) < 10, then var1 = centerstick
Now the wheels will stay put for very small movements of the stick.
Increase the threshold (10 in above code) if your drivers always use full stick movements anyway. Decrease the threshold (down to the limit of your RC stick centering) as drivers learn better fine motor control of their thumbs and robot.
The code posted above is from easyC. I would recheck your code, the code on the right hand pane should match the code above.
From my experience
(https://vexforum.com/gallery/showimage.php?i=2756&catid=favorites)
An omni bot is an overly complicated bot to build, especially if its for a competition such as elevation. The lack of any front makes mounting an arm troublesome. And, fitting any type of gear ratio in their is near impossible. Just thought Id warn you of your future headaches.
Good Luck
josh x)
actually, in my opinion, omni bots are very simple and effective. maybe in your design it required an over-complicated build and tranny, but i think they are simple if you set that as one of your goals.
Yes, they can be simply built with direct drive. The problem is in the premise of the bot’s design, but they cant climb hills. So yes a simple omni can be built, and its fun to drive. I just meant that its not suited for elevation.
I agree that they arent suited for competition. Not that it cant be done, i just have never seen a competitive edge to one.
Simple base with an extending claw. Now position the robot between the cube feed and the scoring tower. Grab a cube, spin, lift, drop, spin back. Repeat for the remaining cubes. The short turning radius of the base makes this work. Then move to the next feeder. Repeat scoring. At the 10 second mark dash for the center ramp and climb.
As an aside, a team with a “winning” design will be beaten every time by a team with an average design that can drive it well.
Actually, I made a 4-wheel holonomic bot (as a 4th robot for our 3 teams to practice with), and it was able to climb the platform with only a little problem as to the platform moving around (we should have taped it down, I know, simple fix). It all depends on your design, and driving skills. You also need some kind of suspension. I have a split-frame design, so that the right and left side are really only connected together strongly by one piece of angle in the back, so the two sides can twist up and down, allowing the wheels to stay in better contact with the floor. I also have the battery mounted over the front two wheels to help with that also. Man, I wish I had a digital camera.
Anyway, I now have code posted for this kind of drive train here if you need/want to use it.
I built a holonomic drive bot (not for the competition). But though I had a good code it did not work very well. When it went forward the wheels spun. When I had all the motors going forward at the same speed (with the weight evenly distributed) the bot would drift first right then left and would rotate badly. The diagonal movements were all right but the had greatly reduced torque. I don’t know I could never get it to work that well. Any suggestions…
Titan 103
First of all, team 508, Elevation, Holonomic Omni base, took 3rd place IN THE WORLD. We very well may have won had a motor internal gear not broken.
https://vexforum.com/gallery/showimage.php?i=3231&catid=member&imageuser=4141
Second, in the “+” config an omni is extremely easy to program. Just set the “Y” input from the controller to the left and right wheels. Make sure to reverse one of them. Put the bot on the floor, push forward and see if the bot moves forward. If it moves backwards then just switch the two wires.
Now take the “X” input from the controller and set it to the front and back wheels also making sure to reverse one of them. Now move the bot left and right. If reversed switch those wires.
Now the fun part, once you have all four major directions down your omni will move in ANY direction. Thats it, nothing crazy or special.
Since pushing power wont be an issue this year I predict many more holonomic drives. See I love holonomics, I’ve built three, all of which did very well. So… I’m very thrilled that this years game will be perfect for a holonomic robot.
The problem with holonomics (though they are very agile and awesome) is that they tend to have a lot of friction on rough terrain. Big problem.
i like the 7 wheel omni design
But our field is flat, always has been and almost always will. Omni’s get a fair amount of traction due to the foam surface which translates to movement.
Yes the field is flat, but it is foam. So anyone with heavy robot = “stuck-in-the-foam”…I found that out first hand