View Full Version : Programming full "holonomic" for mecanums
Hello all.
I need some help programming full holonomic control for a 4 wheeled mecanum drive robot, wheels being in X formation...
We have had sideways, forwards, and twist movements for a long time now, and just recently I figured out how to get diagonal motion (shame to not have it last year)
Anyways, we are using Java, how can we program a full holonomic control to one joystick?
I'd like to point out we basically got diagonals at a 45 degree or so angle at GOOD speed, faster than going sideways but not quite as fast as forward or back, sudden changes in movement speed if you go from forward to diagonal to sideways isn't a problem or anything... Just getting a full 360 control is difficult.
As it is we tried to just get 8 direction on one joystick, and we could only get the forward/back/left/right, the diagonals wouldn't work...
But that won't matter if you help us get a 360 control :)
Thanks in advance...
Hello all.
I need some help programming full holonomic control for a 4 wheeled mecanum drive robot, wheels being in X formation...
We have had sideways, forwards, and twist movements for a long time now, and just recently I figured out how to get diagonal motion (shame to not have it last year)
Anyways, we are using Java, how can we program a full holonomic control to one joystick?
I'd like to point out we basically got diagonals at a 45 degree or so angle at GOOD speed, faster than going sideways but not quite as fast as forward or back, sudden changes in movement speed if you go from forward to diagonal to sideways isn't a problem or anything... Just getting a full 360 control is difficult.
As it is we tried to just get 8 direction on one joystick, and we could only get the forward/back/left/right, the diagonals wouldn't work...
But that won't matter if you help us get a 360 control :)
Thanks in advance...
This (http://www.chiefdelphi.com/media/papers/download/2883) might help.
This (http://www.chiefdelphi.com/media/papers/download/2880) might help.
...
Thank.
You.
SOOOO much...
EXACTLY what I needed... :D
nealpatel
18-01-2011, 08:42
// finally, normalize the wheel speed commands
// so that no wheel speed command exceeds magnitude of 1:
max = abs(front_left);
if (abs(front_right)>max) max = abs(front_right);
if (abs(rear_left)>max) max=abs(rear_left);
if (abs(rear_right)>max) max=abs(rear_right);
if (max>1)
{front_left/=max; front_right/=max; rear_left/=max; rear_right/=max;}
So what is the value of max? It seems you forgot a couple lines of code there.
I am assuming 1.0 but just want to make sure.
And thanks that that pdf, it was really helpful.
So what is the value of max?
max = abs(front_left);
if (abs(front_right)>max) max = abs(front_right);
if (abs(rear_left)>max) max=abs(rear_left);
if (abs(rear_right)>max) max=abs(rear_right);
Front_left, front_right, rear_left, and rear_right can each exceed 1.0.
When all the above code has been executed, max will contain the largest absolute value of [front_left, front_right, rear_left, rear_right].
If max exceeds 1.0, then all the wheel speeds are divided by max in order to force the largest one to have a magnitude of 1.0:
if (max>1)
{front_left/=max; front_right/=max; rear_left/=max; rear_right/=max;}
It seems you forgot a couple lines of code there.
I don't think so.
I am assuming 1.0 but just want to make sure.
That assumption would be wrong in general. Max equals 1.0 only if the largest absolute value is 1.0.
And thanks that that pdf, it was really helpful.
I'm glad it helped. Feel free to ask questions.
Dfontana
19-01-2011, 00:57
Correct me if I'm wrong, but shouldn't this already be fully implemented in an encapsulated method (likely Holonomic Drive)? This is the case with LabView, and has been since about midway through the 2010 season.
All you should have to do is feed in the x, y, and z-axis of your joystick as parameters to the Holonomic Drive method.
I haven't personally seen the Java WPI so I can't say for sure. Check?
davidthefat
19-01-2011, 01:12
Correct me if I'm wrong, but shouldn't this already be fully implemented in an encapsulated method (likely Holonomic Drive)? This is the case with LabView, and has been since about midway through the 2010 season.
All you should have to do is feed in the x, y, and z-axis of your joystick as parameters to the Holonomic Drive method.
I haven't personally seen the Java WPI so I can't say for sure. Check?
Now what is the fun in that? :rolleyes:
I can argue that making the function yourself is 10x better. First, you learn how it works; its not a black box to you. Second, you have FULL control over the code. Now this year, our code is getting ramped up; it has actual structure:p Last year I just did spaghetti code, because of my laziness. You really can't have structure with a black box in the middle of it.
There is no challenge when using the driver class; its like putting together a kitbot. Sure it works and its easy, but where is the accomplishment in that?
Dfontana
19-01-2011, 01:22
It's funny that you say that, because I and a collaborating programmer spent the better part of a week writing a custom VI for Holonomic Drive last year, only to be given the "black box" - which was almost the exact same code - in the LabView update a week later.
I will admit that an understanding of the underlying code and concept was very beneficial. However, for novice programmers or those just looking to get a drive system working at the moment, there's really no need to reinvent the wheel, so to speak.
davidthefat
19-01-2011, 01:53
It's funny that you say that, because I and a collaborating programmer spent the better part of a week writing a custom VI for Holonomic Drive last year, only to be given the "black box" - which was almost the exact same code - in the LabView update a week later.
I will admit that an understanding of the underlying code and concept was very beneficial. However, for novice programmers or those just looking to get a drive system working at the moment, there's really no need to reinvent the wheel, so to speak.
Well I can argue that you will never get better if you do not push yourself. Oh and BTW I can get the drive working in 5 lines; its quick and easy. The road to the top is always uphill, there is no easy way out. That is how I see it as. Just like "never put stuff into your body that you don't know".
Correct me if I'm wrong, but shouldn't this already be fully implemented in an encapsulated method (likely Holonomic Drive)?
Yes*. I inferred from the OP's post that he already knew that, but was trying to home-brew something.
What I posted had commenting that explained what was being done and why. The RobotDrive::HolonomicDrive is not well documented in the C++ help file and library reference file. If you are familiar with it, would you please visit this thread (http://www.chiefdelphi.com/forums/showthread.php?t=89469) and share what you know?
*well, not "fully". it doesn't appear to support the gyro like the LabVIEW version does.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.