|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Acceleration Curve
We used an acceleration curve to overcome the sensitivity of the low range of the joystick. The code looks exactly like this:
Code:
tempRight = pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
tempLeft = pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
if(p1_y >= 127){
tempRight = (tempRight - 127)(tempRight - 127)/127 + 127;
tempLeft = (tempLeft - 127)(tempLeft - 127)/127 + 127;
}
if(p1_y < 127){
tempRight = (tempRight - 127)(tempRight - 127)/-127 + 127;
tempLeft = (tempLeft - 127)(tempLeft - 127)/-127 + 127;
}
pwm13 = pwm14 = tempRight;
pwm15 = pwm16 = tempLeft;
I'm completely stumped, any help would be greatly appreciated. |
|
#2
|
|||||
|
|||||
|
Re: Acceleration Curve
I'm not entirely sure what the error is in your code i will take a look at it again but if u want here is the method i used for doind the same thing u are doing:
try adding brackets for order of operations: tempRight = (((tempRight - 127) * (tempRight - 127))/127) + 127; Quote:
Last edited by Cuog : 30-01-2006 at 19:50. |
|
#3
|
|||||
|
|||||
|
Re: Acceleration Curve
You need an asterisk (*) to multiply.
|
|
#4
|
|||||
|
|||||
|
Re: Acceleration Curve
Quote:
|
|
#5
|
|||
|
|||
|
Re: Acceleration Curve
Quote:
'Doh! Man, 3 years programming C and I still make these stupid mistakes. Yesterday I forgot to end a quotation on a string and the compiler decided to give a syntax error on a comment 20 lines down Thanks alot for the help guys, it's always nice to have the outside party take a look at your code because one of two things can happen: 1. They write it better. 2. They find your stupid mistake. |
|
#6
|
||||
|
||||
|
Re: Acceleration Curve
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| (SolidWorks) Create Sketch Points Around Curve | Yan Wang | Inventor | 6 | 04-08-2005 21:20 |
| Acceleration Sensor Connected, but values are odd.... | Leav | Electrical | 7 | 04-02-2005 15:28 |
| van door torque curve | DLyons | Motors | 1 | 13-01-2003 21:54 |
| Drill motor torque curve | thedillybar | Motors | 1 | 10-03-2002 05:19 |
| The Learning Curve Was Steep! | Mike McIntyre | OCCRA | 0 | 12-11-2001 00:23 |