|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Software Speed Fix
Where in the default code do we slow the full speed of the robot. I know this is simple but I just can not seem to find it. Thanks
|
|
#2
|
|||
|
|||
|
Re: Software Speed Fix
You have to create your own code. You either have to add some code to defaultroutine() (in userroutines.c) or from Processdatafrommasterup() (in the same file). Basically, you can do a few things. You can get creative with your code and kind of scale it so that it ignores the first 10 'ticks' of the joystick feedback, but you scale it so that you don't lose range of motion. If you're really in a crunch, you can just flat out ignore some of the feedback. [code]if (pwm15 < 145 && pwm15 > 100) {pwm15 = 127;}[code] Something like this would just ignore whatever values in the joystick output you want. There's a lot of room for creativity. That depends on how creative/timley your coders are. Best of luck to you.
~BStem |
|
#3
|
||||
|
||||
|
Re: Software Speed Fix
Quote:
For as far as I know our team has been scaling back the speed of the robot by 50% unless the 'turbo' button is pressed on the drive stick. This makes the robot more controlable, but still allows the driver to go full speed. So here's how we do it, and generally how you'd scale any motor down: <beginner mistake> If I want to scale the motor speed down by 50% all I have to do is divide the speed by 2 </beginner mistake> This won't work because the 'zero' point where the motor doesn't move is 127, not 0. So if you divide 127 (motor not moving) by 2 you get 63 which means your motor is moving half speed backwards. In order for your motor to stop running you must add back 64. Now my equation is motor_speed / 2 + 64. Seems to work fine. If you want to scale by 1/3 you divide your motor speed by 3 and add 85. The general formula is: (motor_speed * (1 / scaling_factor)) + (127 * (1 - (1 / scaling factor))) Or you could approach it another way. Instead of fooling around with adding the (1 - 1/scaling) factor, you can re-center your math around 0: First thing you do is subtract 127 from your motor speed, then divide by your scaling factor, then add 127 again to get back to pwm values. Quite simple, but remember to cast the calculation to an integer because an unsigned char can't handle negative numbers. ((motor_speed - 127) / scaling_factor) + 127 Both work. One is probably more efficient than the other. It's a matter of personal preference. I hope this helps. Someone please check what I wrote for typos, I've been known to make them. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Joining 2 dif. motors | K.Shaw | Motors | 32 | 14-10-2004 19:40 |
| SCRRF Design Classes | Redhead Jokes | Southern California Regional Robotics Forum | 0 | 10-07-2003 17:29 |
| which software | Ryan Foley | 3D Animation and Competition | 5 | 01-03-2003 23:39 |
| Power, speed, and torque... AGH | Gui Cavalcanti | Technical Discussion | 5 | 10-11-2002 19:02 |
| software software software | archiver | 2001 | 5 | 24-06-2002 00:21 |