![]() |
mecanum programming
Hello...
Last year someone posted a link for information on programming for mecanum wheels usage. Does anyone remember what it was. Our team is concidering this this year. Any help will be greatly appreciated. Thank You |
Re: mecanum programming
We're considering it this year; I'd PM or email the main programmer. His forum name's cprogrammer.
|
Re: mecanum programming
well....
Start here... and then use the search tool to look for keywords like omni wheel and holonomic and kiwi There are numerous posts and good info out there ;) SPAM built an omni wheel 'bot for the 2004 game. It was successful, but you will trade off agility for traction and pushing power. Do you wish to run with the big dogs? Or dance around them! Eric |
Re: mecanum programming
This is what we use for a simple open-loop mecanum drivebase. Default_Routine() computes internal speed, turn rate, and slide (sideways travel) values from the joystick inputs, then computes motor speeds from the internal values.
The p1 joystick is on the left, and p2 is on the right. pwm01 is the right front motor, pwm02 is the left front, pwm03 is the right rear, and pwm04 is the left rear. rc_dig_in01 is a "deadman" switch which sets the motors to neutral unless it is closed. This was intended to be used by people "riding" the robot. Code:
/******************* |
Re: mecanum programming
Quote:
It's easy for things like variations in the carpet and motor differences to cause your drive mechanism to drive slightly off. You should consider adding a gyroscope and feedback loop so your bot can drive 100% straight (and there's good code examples out there for doing this). And, with the USB Chiklet available this year, it's really easy to use a three-axis joystick, so it's not hard to control an omni-robots three degrees of freedom direct from one joystick. |
Re: mecanum programming
It looks like we aren't the only team who is going to be trying out mecanums this year... just a couple of tips when searching for info, so far I have found results by searching for a couple of common spellings:
meccanum mechanum and mecanum All produce results. FIRST has info at http://www.usfirst.org/uploadedFiles...heels_Hine.ppt and the CD white papers have a great power point presentation called "strafing", I believe that runs you through the derivation of the formulas used for a variety of omni-drive systems. Good luck, and have fun going sideways. Jason |
Re: mecanum programming
Thanks guys...Hmmmm....will send this along to our programmers
|
Re: mecanum programming
Our team's programmer (<--Yes singular!!) worked out all the math to use the omniwheels, and the mechanum twice, with the wheels oriented differently. Turns out, since we have no money, that we won't be using any holonomic drive this year.
|
Re: mecanum programming
I am trying to use the code posted above but I am not able to make it strafe using the code. Is there as simple way of doing this. Help is appreciated.
|
Re: mecanum programming
If by "strafe" you mean travel sideways, the code I posted does that when the joysticks are pushed sideways.
|
Re: mecanum programming
I am using your code but when I move both joysticks to one side the wheels spin but the robot stays in place. All the wheels either spin inward or all wheels spin outward but never one side spins inward and the other spins outward.
|
Re: mecanum programming
You're using terms that I don't understand. How does a wheel spin "inward" or "outward"?
This code is for a mecanum drive base, with four mecanum wheels all mounted so they spin either forward or backward. The "handedness" of the wheels is important, and it's possible to set things up in one of two ways. One way has the angled rollers contacting the floor so that the robot can very nearly spin in place without any of the wheels turning. This code assumes the other way, where the angled rollers resist spinning in place when the wheels are stationary. The "meat" of the code is these four lines: Code:
front_r = speed-turn+slide;You might need to change the sign of some of these parts based on how your motors are wired. |
Re: mecanum programming
I got your code to work and it works great. One problem: speed controls orange light goes off or blinks about every 5 minutes and we have to recalibrate the speed controls. Is there any way to alleviate or completely fix this. Help is greatly appreciated.
|
Re: mecanum programming
Quote:
|
Re: mecanum programming
We'll try that. That's what I think the problem is but our drivers think it's all because of the code. We are using black joysticks from a while ago. They have a square base.
|
Re: mecanum programming
If you use tank drive the OMNI wheels will deffinately help, but they are a pain to build if you are... 1535 used them for the past 2 years when they were known as 1596, dont know if we're ghoing that way again.
|
Re: mecanum programming
We're going mecanum for our bot, we're rookies. I'm the programmer, I came up with this code, haven't tried it yet but it's simple and should work perfectly. (cause we don't have a bot yet - only 2 weeks into the six) I also have a program I made that simulates mecanum movement with my drive programming. Here's a section of the user_routines.c with the default drive commented out and my drive put in. It shows which pwm's are which motors, and has a spot for inverting motor outputs if needed.
Code:
/*---------- 1 Joystick Drive ----------------------------------------------And of course, since this is c and not c++, you have to move the variable declarations to the beginning of the subroutine. In other words, put Code:
double motor[4] = {127.0,127.0,127.0,127.0};Code:
void Default_Routine(void)Code:
for (int n=0; n<4; n++)Code:
for (n=0; n<4; n++)Use the following program, copy and paste to a compiler, to see what my mecanum drive does. It gives you the total diagonal vectors (as that's how the mecanum wheels push, and they roll freely in the other diagonal, each pair of wheels pushes in a different diagonal), then converts those into the horizontal/vertical force vectors, then converts that into the total movement vector and the angle of movement. It also gives the rotational vector force. Vector outputs are such that "where 100 = the result of one motor's full, direct power" as is commented in the program. It also gives each motor's output (keep in mind 127 is stopped, 254 is forward, 0 is backward) You give in input for each joystick axis where 100 = full forward or right and -100 = full backward or left. Y axis is joystick up/down, makes the bot move forward/backward. x axis is joystick left/right, makes bot strafe left/right. z axis is joystick twist or throttle wheel or a second joystick's left/right, and makes the bot spin to the left/right. It converts the -100 - 100 input to 0-255 input. It's all in double for accuracy, so feel free to input stuff like 75.678. Notice how when going full forward you have a certain forward force, but when you add to that a full spin right the forward speed halves. Then when you stop moving, the full spin to the right doubles in speed. That's cause some of the motors' force have to be redistributed from movement to turning, slowing the movement. That's how my nifty mecanum drive code works :) . Normal 4-wheel, 4-wheel-drive does the same thing. When you're going full forward and decide to turn at the same time, you will slow down a bit. Code:
#include <iostream> |
Re: mecanum programming
oh yeah and if u want a gyro for true holonomic movement (as im planning to do) just turn the xy joystick inputs to magnitude and direction, then offset the angle by the gyro's input, then convert back into the joystick xy input and run through the drive like nothing happened. simple trig. This makes it so that no matter what direction the bot is facing, forward always makes the bot move 'up' and backward always makes if move 'down' etc. even if 'down' is actually the bot's forward-left.
|
Re: mecanum programming
The valid range of pwm control outputs is 0-254, with 127 being neutral. You should change all your 127.5 values to 127, and all your 255 values to 254.
|
Re: mecanum programming
thanks very much, didn't know that - thought it was normal 4 bit. I haven't tried it yet, guess it wouldn't have worked. The joystick serial inputs are still 0-255 right?
|
Re: mecanum programming
Quote:
There aren't any joystick serial inputs. Did you mean "game port"? The joystick values are typically set up with 127 being neutral as well. I can't remember whether 255 is a possible value, but it works to assume the valid joystick range matches the valid pwm range. |
Re: mecanum programming
Just as an general guideline for programming with the RC: Avoid the use of floating-point numbers whenever possible. It seems as if you have calculated everything as doubles for the sake of rounding accuracy later on. It is not very helpful to use doubles in your actual robot code, because a difference in the PWM outputs by 1, will be extremely negligible.
As for the whole max joystick value issue, you can always just quickly check it by printing out the value of the joystick inputs in your code. Either way, you can simply just check to see if your variables have overflowed at the end of your code. Another suggestion: If you are going to use a temporary variable to hold your PWM outputs while they are being calculated, it may make more sense to store them as signed chars instead of unsigned chars, since they intuitively make more sense. Then at the end just add 127 to your values. |
Re: mecanum programming
they're serial ports. ill use the operator interface leds to test for 255 later, and use signed chars. Thanks. And yes, I meant 8 bit. I should've taken another second to think about it, I was off by a power.
|
Re: mecanum programming
Quote:
Quote:
|
Re: mecanum programming
Thanks again, you've been very helpful. Unsigned it is. Personally I do understand the 0-254 more than -128 - +127, so I guess I'll use unsigned, although it doesn't really matter. By serial I simply meant not parallel, by that definition a game port is a kind of serial port (I do believe...). The default code calls it serial too, that's where i got it from. But it's not the standard computer connector for serial. I can't update the code, I guess it's too long ago. If anyone really wants the working one say so.
|
Re: mecanum programming
Quote:
|
Re: mecanum programming
"printer ports are serial", lieafterlie
:):D |
Re: mecanum programming
Quote:
ours is set up with 255 being full power forward, 127 being neutral and 0 being full reverse the program also sets it up for the wheels on either side to be linked with each other, so it can be either side (one wheel from each axel) being controlled |
| All times are GMT -5. The time now is 12:20. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi