|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
speed controller max speed
we were testing our robot and we realized that the mototrs are way to sensitive. how do we make the max speed on the speed controllers from 255 to around 200. what is the code for that. whenever we use the triggers the robots moves and we dont want that. HELP!!!! thanks.
|
|
#2
|
|||
|
|||
|
Re: speed controller max speed
any help plz. i kind of need the answer as quick as possible
|
|
#3
|
||||
|
||||
|
Re: speed controller max speed
yay for fellow San Jose Team. What you need to do is add a limit to the pwm values that are being sent to the speed controllers.
For instance (insert x for the pwm number) if(pwmX >= 200) { pwmX=200; } or pwmX= pwmX >=200 ? 200 : pwmX; We also added a dead band where any value +30 or the middle 127 on the joystick will not make the motors move since the joysticks are so sensitive |
|
#4
|
|||||
|
|||||
|
Re: speed controller max speed
You could one of three basic things:
You could use a formula to squish things in, which may take longer, but consume less space or you could use a lookup table, which would take less time, but consume more space. Or you could just cut everything off after 200, which is small and takes little time. Here is a an example fomula one: Code:
unsigned int Limit(unsigned int pwmin)
{
unsigned int tmppwm = 0;
tmppwm = (unsigned int)(((pwmin-127)*72)/127) + 127);
return (tmppwm+127);
}
Last edited by AIBob : 12-02-2005 at 19:06. Reason: typo |
|
#5
|
|||
|
|||
|
Re: speed controller max speed
how do u set the dead band because the joysticks are really sensitive? thanks for your help
|
|
#6
|
|||||
|
|||||
|
Re: speed controller max speed
Quote:
Code:
unsigned int DeadLimit(unsigned int pwmin)
{
if(((pwmin-127) && 0x7F) >15 ) return pwmin;
else return 127;
}
|
|
#7
|
|||
|
|||
|
Re: speed controller max speed
it comes up with an error on the line that has the " { " on it
|
|
#8
|
|||||
|
|||||
|
Re: speed controller max speed
Quote:
|
|
#9
|
|||
|
|||
|
Re: speed controller max speed
error: syntax eror c:233. it says it when i compile it. on line 233 is the " { " after:
unsigned int deadlimit (unsigned int pwmin) { <--- that is where the error is |
|
#10
|
|||||
|
|||||
|
Re: speed controller max speed
It might be because you left a bracket open from another peice of code earlier in the code..
If that is not the problem... it might be that you did not define "unsigned int DeadLimit(unsigned int pwmin);" in an h file for referring to it in anotehr piece of code. |
|
#11
|
|||
|
|||
|
Re: speed controller max speed
nvm that i figured it out but now it says pwmin has not been defined. do i just do #define or do io have to define it a different wway. thanks a lot for your help.
|
|
#12
|
|||||
|
|||||
|
Re: speed controller max speed
Quote:
you should just call it as a function like so: Code:
pwm01 = deadlimit(pwm01); The pwmin is defined by the function... be sure that you define: "unsigned int DeadLimit(unsigned int pwmin);" inside of an h file that you have included in it. Last edited by AIBob : 13-02-2005 at 13:28. |
|
#13
|
|||
|
|||
|
Re: speed controller max speed
Quote:
"{ if (((pwm-127) && 0x7f >15) return pwmin else return 127; }" into user_routines.c. where do i put the pwm01 = deadlimit(pwm01)? |
|
#14
|
|||
|
|||
|
Re: speed controller max speed
im really confused right now. so if you could right it out in a post that would be really appreciated.
|
|
#15
|
|||
|
|||
|
Re: speed controller max speed
is there an easier way to do this because it to compile but then when it gets to the 3rd stage it says : could not find definition of symbol deadlimit in file user_routines.o
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Speed controllers won't communicate w/robot controller | steven114 | Control System | 12 | 03-02-2005 21:26 |
| How to make a max speed | Team 668 | Programming | 3 | 02-02-2005 17:54 |
| PID control loops - closed loop feedback | KenWittlief | Technical Discussion | 56 | 26-04-2004 21:27 |
| not quite sure...speed controller...spike. | tophq | Programming | 8 | 26-03-2004 13:43 |
| making speed controller digital | CharlieWilken | Electrical | 4 | 01-03-2002 20:15 |