![]() |
Question about Mecanum code
I was looking at a few sets of mecanum code and was wondering about a few things.
Whats the best way to make sure there is no under/overflow in the code? Is it necessary to have the wheels perfectly square? i found some code that uses the distance to the XY center point of the axels to the center of the bot in the code, and that tells me that its only to tell where the axis of rotation is for Z. Thanks for the help. ~Burmeister |
Re: Question about Mecanum code
Most of the time the precise positioning of the wheels isn't needed, but they should be reasonably close. In general if normal wheels would work then so will Mecanums.
To prevent overflow issues you can use a larger data type to store the intermediate calculation. For example if your inputs and outputs are in the range of -100 to 100, then if your variable can handle values from -300 to 300 you shouldn't experience any overflows, and since the next step up from a char is a 16 bit integer, which holds -32768 to 32767, then you won't experience any overflows unless you input data is incorrect. You should also confirm that the output values are in an acceptable range. As for exact code most of the time something like this is all you need to get a reasonable output. You can add additional logic, like a PID loop for encoders, but its not needed for a simple robot. This code is from memory, but it should be correct. Code:
//This is just some generic C-like syntax, but you should be able to |
| All times are GMT -5. The time now is 00:12. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi