Search the web
Sign In
New User? Sign Up
bestinc · Best Inc.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Brain Programming, code change servo speed?   Message List  
Reply | Forward Message #558 of 1079 |
Re: Brain Programming, code change servo speed?

A couple comments ...
You are welcome to change the user libraries at your own risk. Hub personnel
and/or BEST cannot support customized libraries. Changing the define to a lower
number will result in a smaller time per tick increment, however, you'll have to
check to see if it causes other problems with the additional interrupt service
time.

I've not looked at your code but I want to comment about the use of floating
point numbers; you may have noticed that everything in the BEST library was
written using integers - that was not a random/evil choice :) First, the
floating point numbers are going to slow down the update process significantly.
Second, there are inherent resolution issues both in reading the stick position
(which I realize you're not doing) and in setting the servo position (which you
actually set by setting a pulse width). I'll look back through the code (since
I don't remember off the top of my head) but I think you are likely trying to
achieve resolution that is beyond what will actually be set and output to the
servo via the control proc.

As Joel pointed out with his example of the oscillating piano wire problem,
sometimes the fix to the control issue sits outside the controller (even though
it'd be better to eliminate the problem at the source).

Terry


--- In bestinc@yahoogroups.com, "nicholas.seward" <nicholas.seward@...> wrote:
>
> // provide clock ticks at increment: 9/450=> 0.02 sec
> #define RESET_CLK (9)
>
> This is line 41 and 42 of bestusrutil.c. I don't think BEST allows this code
to be edited but if you are not constrained by BEST rules then you can set you
tick length to what ever you want up to limit of 1/450 sec. I don't know if it
would be against the rules to place the following lines of code immediately
before the InitBrain() call. I am 99% sure that it would work but have not
tested it. I think the #undef line can be omitted but that might cause some
compilers to throw a warning.
>
> //DON'T USE SEMIS AT THE END OF THE FOLLOWING LINES
> #undef RESET_CLK
> #define RESET_CLK (1)
>
> I have also posted an example called "FineGrainClock.zip" in the file section.
I don't have a brain or even a C compiler on my computer so I am quite sure it
has many bugs. However, it should show you a way to increase the clock
resolution without modifying "bestusrutil.c." I am not a C programmer so
beware. I changed the servo_output variables to doubles. That was because if
the resolution of the clock is really fine you might get in a situation where
you are trying to change the servo position by less than one. In that situation
nothing would ever happen. You need to be able to keep track of fraction
position changes.
>





Fri May 22, 2009 11:34 am

tagrimley
Offline Offline
Send Email Send Email

Forward
Message #558 of 1079 |
Expand Messages Author Sort by Date

I'd like to have a servo slowly and gracefully change from one position to another, rather than use the existing default "as fast as possible PID". Does anyone...
joel.graber1
Offline Send Email
Apr 28, 2009
8:32 pm

... I placed an example in the files. I haven't been able to test it since we don't have a brain right now. I programmed the servo to have a constant speed...
nicholas.seward
Offline Send Email
Apr 29, 2009
3:12 pm

... Thanks, that was helpful to get me started. I don't anticipate having a long variable loop time, so I think the use of the RealTime clock is overkill for...
joel.graber1
Offline Send Email
May 18, 2009
3:54 am

... This is much simpler. I probably should go through mine and condense it but I thought I would throw you something quick that would work. Just out of...
nicholas.seward
Offline Send Email
May 18, 2009
2:45 pm

... // cc3 is just a counter from 0 .. speed3 short in_3, out_3, cc3, speed3; A ~90 degree servo swing for an input of 0-1000 is ~0.9 degree each. Changing the...
joel.graber1
Offline Send Email
May 20, 2009
2:57 pm

// provide clock ticks at increment: 9/450=> 0.02 sec #define RESET_CLK (9) This is line 41 and 42 of bestusrutil.c. I don't think BEST allows this code to be...
nicholas.seward
Offline Send Email
May 21, 2009
6:17 pm

A couple comments ... You are welcome to change the user libraries at your own risk. Hub personnel and/or BEST cannot support customized libraries. Changing...
tagrimley
Offline Send Email
May 22, 2009
11:34 am

... Terry, I agree I shouldn't have used floating point numbers. The optimal solution would probably be to use the full range of int to specify servo positions...
nicholas.seward
Offline Send Email
May 22, 2009
2:39 pm

... Make that 0.09 degrees each, so moving a servo_position by 9 would be 1 degree = 1/90th of full swing. These servos probably don't support more accuracy...
joel.graber1
Offline Send Email
May 26, 2009
6:32 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help