![]() |
Banebots/Cim motor programming question
On our robot,we are using 2 wheel drive with one CIM motor per side and mounted back to back (non-shaft ends towards each other).
In this configuration, the polarity of the victor outputs are positive to red lead and negative to black lead on one motor and positive to black lead and negative to red lead on the other motor. This seems elementary due to the orientation of the motor and its relative rotation to one another.... What causes some issues is that I am finding that these motors are not linear in regards to direction, where as for example, a PWM of 200 will spin the motor at a different speed while connected with the polarity for forward than it will with the polarity in reverse... I understand how the PWM works where values greater than 127 is forward and less than 127 is reverse but I am talking about the motor speed relative to how the polarity of the motor is connected as these motors seem to move faster forward than backwards with the same relative PWM output and the polarity set for each case.... And thus the dilemna where one motor spins ever so slightly faster causing the robot to track towards one side.. Is anyone else experiencing this? Can this be overcome with programming or can the motor speeds change in time and at different rates due to heat and friction? The default code treats the PWM values the same per the 2 joystick control values with the assumption that one of the motors (at least in our configuration) must have its polarity set opposite of the other motor. With the two joystick control, we can make the robot track straight with a little technique but I would like to take as much of the need for technique out of the equation as the students will most likely be in a high level of excitement during the competition. (yes we are rookies this year...) Any suggesions on how to normalize the effects of the motors so that these track straight? Thanks in advance. |
Re: Banebots/Cim motor programming question
You will find plenty of discussion on Chief Delphi related to making your robot drive straight. This thread has been active lately.
http://www.chiefdelphi.com/forums/sh...t=cim+straight To get a robot that always tracks perfectly straight is one of the fine arts of robotics. Typically you need some form of feedback, either encoders on the drive shafts or perhaps a gyro. In my experience, though, if your robot isn't tracking reasonably straight it is as likely to be a mechanical problem of binding or unequal friction in the drive train as much as anything. In any case, you will see many other helpful suggestions if you search a bit. There may also be assistance on the FIRST Curriculum pages and the CD White Papers. Jason |
Re: Banebots/Cim motor programming question
There are several more complex ways of solving this problem, you can use encoders and monitor velocity ... then match the two sides, but this is complicated to do.
Another way to do it would be to scale down the faster motor |
Re: Banebots/Cim motor programming question
I have checked for binding and we had this issue on one motor but then resolved it...
I also tried to scale up the slower motor and was not as successful at this and was wondering if there are any programming gurus out there that have mastered this technique that wouldn't mind sharing their secrets on how to do this... |
Re: Banebots/Cim motor programming question
Quote:
So how to fix? BEST way is to use your sensors. In this case the gyro can be your best friend. The gyroscope can tell you what direction your robot is pointing (relative to starting position) AND how fast it is turning (because the gyro is ACTUALLY a turn rate sensor, not a compass). So, if your robot is driving in a straight line, your gyro will provide feedback to your program: "driving in a straight line, don't need to change a thing". However, if it starts to veer off of the straight line: "turning at x rate" You take this information and adjust power to your motors to turn it back the other way. Simplified code: error = gyroTurnRate*0.3; leftMotor = joyYval - error; rightMotor = joyYval +error; Those 3 lines of code (implemented correctly for YOUR robot) will keep you driving straight. Now if you AREN'T going to use sensors, your idea of scaling the slow motor is ok. The problems you have with making it work, though, is that the difference in speeds between the left and right sides might not necessarily be linear. In this case, the scaling factor will only work at one pwm value. To be very thorough, you can use a strobe light to get the speed of each wheel at all PWM inputs (0-255). Then adjust accordingly. If you use this method a lookup table can come in handy, or figure out an equation that approximates your data. Keep in mind, however, that as you drive your robot, this values will change significantly due to wear, or damage, or just breaking in. That is why I strongly encourage using sensor data, because even if the differences between the motors change over time, it can still be fixed easily with the software. Hope this helps a little! |
| All times are GMT -5. The time now is 04:50. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi