|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
Quote:
Baisically what my code does is it compares two numbers and if the pos_in(position the feedback tells you you are in) is greater than pos_to(Position to go to) then it sets the speed to -1 and 1 if it is the other way around. I also have a lot of safeties built in such as: If the feedback isn't counting, if it is turning the wrong way, etc. You may have a few questions because I really haven't commented any of it and it even confused my dad at first, so I will be willing to answer any other questions you have. |
|
#2
|
|||||
|
|||||
|
Re: Swerve vs. Mecanum Programming
Quote:
it's called proportional control. p from pid. Basically, you say; Code:
error = setpoint - process_variable output = error * Kp Edit: Forgot to talk about I and D: Integral (I): Basically you integrate the error and add it to the output: Code:
integral += error output += integral * kI Derivative (D): You calculate the derivative of the previous action to determine how momentum will affect the stopping ability. Basically, it works against P and I to slow it down when it nears the end, allowing a higher P gain. You will almost certainly not need this with crab steering, as the friction of turning the pods will probably slow their rotation very quickly (D would be useful for, say, a 6' arm that has a lot of mass at the end). Last edited by apalrd : 23-05-2010 at 00:10. |
|
#3
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
Quote:
|
|
#4
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
Ok I have attached my code for the swerve drive. I will answer any questions.
|
|
#5
|
|||||
|
|||||
|
Re: Swerve vs. Mecanum Programming
While I can't look at your code since I don't have LV on this computer, I can say a few things in general:
1. P should be good for steering, unless you have a lot of friction. 2. You should rely on the sensor. Not too much, but don't program all kinds of safeties like it going in the wrong direction. good limits are out of bounds, lost sensor (0 volts), and not moving if you are really worried about it. We have no mechanical limits on our swerve, except the wiring, and we leave a lot of extra wire. Using window and globe motors (especially the window motors), it doesn't have enough power to damage much in our application. 3. Use the same code in auto as teleop - best to put it in a new thread. 4. Make kP (gain) a front-panel control or global to tune it. If you are using four identical motors (e.g. window motors), you would probably be fine with one gain and volts/deg, and x centerpoints (where x is the number of controllers), if you mix motors (e.g. window+555 or window+globe), then you would need a different gain for each motor and volts/deg for each different sensor (e.g. when sensor gearing or # of turns is different). 5. Pots never completely fall off. We have had many problems with set screws coming loose and pots loosing connection, but never completely fall off. 6. Don't be scared of code changes. We change our code quite frequently, and generally try to test it before playing, depending on how major the change was (we don't generally test autonomous kick distance changes, for instance). |
|
#6
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
Quote:
|
|
#7
|
|||
|
|||
|
Re: Swerve vs. Mecanum Programming
Ok some questions on your example what are you using in your robot to know the position in which the wheel is, are you using limit switches, gyro or any thing else, also on the example it does not show the motors or joystick is that an additional program or how are you runing this program.
Thanks ![]() |
|
#8
|
|||||
|
|||||
|
Re: Swerve vs. Mecanum Programming
He is using analog potentiometers.
This is a subVI. He calls it from his other code when he needs it. I would highly, highly, highly (I can't say this enough) recommend organizing code this way, especially separating mechanism control code from user interface code in separate threads. Since he has a potentiometer, he has no need for limit switches. It tells him everything he needs to know. I would generally not use his method of "check greater/equal/lesser and set output based on case" and instead use proportional control, LabVIEW has a nice PID block you can use for PID or you can write your own, its just a subtract, multiply, and check range. |
|
#9
|
|||||
|
|||||
|
Re: Swerve vs. Mecanum Programming
Quote:
On the other hand, if you're moving a massive mechanism around, you definitely want to slow it down on its way to the target position. Stopping it abruptly can lead to extreme stress on the gears (as demonstrated well by the teeth being stripped off a large sector of a heavy gear on the TechnoKats 2004 robot's arm by the team's programming mentor a few minutes before the pre-ship open house was to begin). |
|
#10
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
Quote:
|
|
#11
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
Quote:
|
|
#12
|
|||
|
|||
|
Re: Swerve vs. Mecanum Programming
Ok I do undersand what your program does and its a really simple program, but what I am looking for is an even simple example, I am a senor so I am leaving this year and i am trainig some one for next year and I need something that is simple to explain.
Thanks |
|
#13
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
I can try to write a simpler program. You could do something along the lines of finding the difference between the sensor and the control and set that as your speed.
|
|
#14
|
||||
|
||||
|
Re: Swerve vs. Mecanum Programming
I have attached a simpler VI that could be used as a swerve drive. This one is commented so all your questions should be answered but I can still answer and other questions you have.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mecanum or Swerve? | buildmaster5000 | Technical Discussion | 73 | 18-04-2010 11:19 |
| Programming Mecanum | Zrob | Java | 22 | 04-04-2010 23:00 |
| Mecanum Programming Help | Mars | Programming | 8 | 27-02-2008 15:41 |
| mecanum programming | mrmummert | Programming | 27 | 28-01-2007 13:45 |
| Need help programming our swerve with feedback? | activemx | Programming | 25 | 13-04-2004 07:29 |