Being a BRAT newbie, I have looked carefully at the posts concerning autonomous BRAT basic programs. The only one I found was the
build130 using a BOT-BOARD.
I unfortunately do not own a SSC-32 sequencer but would like my BRAT to use a microcontroller other than the BOT-BOARD mentionned in the above
build. Any suggestions as to how I build a gait? BTW, my BRAT is
equipped with an SSC-32 board. Thank you.
The tutorials for the BRAT all include information regarding gaits in one form or another. Some are stored as angles, and some are servo pulse values. You should be able to convert them to whatever microcontroller you would like to use. They gaits are very simple to develop for the BRAT.
Did I mention I was a newbie? Do you mean that I could just convert the following:
gosub movement 7.0,-20.0,-20.0, -7.0, 20.0, 20.0, 500.0]
gosub movement -7.0,-20.0,-20.0, 7.0, 20.0, 20.0, 500.0]
gosub movement -7.0, 20.0, 20.0, 7.0,-20.0,-20.0, 500.0]
gosub movement 7.0, 20.0, 20.0, -7.0,-20.0,-20.0, 500.0]
into valid pulses and feed it serially to the SSC-32 with any microcontroller?
Yes these are angles that you would need to convert to pulses with 1uS resolution for the SSC-32. 1500 is 0 degrees. Increasing is CW decreasing is CCW. The information is there to make the conversion but it’s a little complex due to the Atom Pro’s HSERVO commands very high resolution and it’s also signed.
500 uS is -90 degrees, and 2500 uS is 90 degrees, with 1500 being 0 degrees.
therefor 1000 uS is 90 degrees. Therefore 1000/90 = 11.11 us per degree is our conversion factor.
7 degrees times our conversion factor yields 77.77 uS that can be added to 1500 to get 1578, and when subtracted gives 1422 uS.
20 degrees would be worked similarly, giving 1722 and 1278.
Note that R/C servos aren’t precision servos, of course, but these numbers should give you someplace to start. don’t forget that you’ll probably want to add code to “zero out” the Null position of the servo (1500 uS) to account for what I think is mainly the spline pitch.
I use a free terminal program called “T2” that I’ve posted on before. You can make up SSC32 command strings to send, and store them in the T2 program to try out the steps of a gait.
500uS to 2500uS is sure to take a servo beyond a mechanical stop in one direction or another. The overlap is necessary to ensure the full range of any servo is achievable.
I went the other way using the Atom Pro HSERVO command and the program Nathan wrote. He calculated 166.6 steps per degree, and 0.0625uS per step.
20° x 166.6 = 3332
3332 x 0.0625 = 208.25
208.25 + 1500 = 1708.25uS
This can be simplified to (degrees x 10.4125) + 1500 = SSC-32 values.
20° x 10.4125 = 208.25
208.25 + 1500 = 1708.25uS
Our free download LynxTerm can be used to store and send commands to the SSC-32 as well. It also has the ability to set the servo offsets in the SSC-32 processors EEProm. lynxmotion.com/Product.aspx? … egoryID=15
Thank you very much for the tips. I’ll be sure to look up KM6VV’s T2 program. I was thinking about using either a BS2 from Parallax or a PICAXE microcontroller that I already own to feed the SSC-32. Unfortunately, neither of those BASIC support floating point math. I’ll need to calculate beforehand with the conversions you have supplied and program accordingly.
I agree, that’s the where the need for prior conversions come in. Thank you very much for supplying the conversion factor and the explanations concerning your code. It looked a bit cryptic at first (I’m a newbie, remember? ), but now I feel much more confident at making my BRAT walk for the first time!
What’s the 166.6 from? A BASIC Atom Pro constant for HSERVO? How is it derived? I get 166.6666 = (2500 - 500) / 12. If that means anything. Interesting that the .666 and my .111 repeat!
Yeah, don’t attempt to go the full range of the servo!
LynxTerm can save commands too? I hadn’t gone to it, as I can use SEQ on my desk machine with bluetooth. But on the notebook with bluetooth, I must resort to T2. Oh well.
Actually, your “simplified” may be closer to (degrees * 12), if that’s actually where the 166.6 came from (2000 / 12)? Or did I miss something?
I’m sure the whole numbers will be fine. Save some calcs, pre-calculate 166.6 * .0625 and get about 10.42 or something. That seems to be similar to my 11.11 number; although I don’t see why the discrepancy. Anyway, this precision isn’t required, as has been noted. No matter!
Alan KM6VV
P.S. DO add a min/max check to the calculated servo positions. This is to set the max range of movement (ROM) of each servo that your 'bot can handle.
I suspect it was derived by trial and error to find how many HSERVO command steps are needed to move a typical servo one degree of rotational movement.
You may be looking for relationships that are just not there. Nowhere does it state that the +/-12000 range is equal to 180°. I have not taken the time to actually measure the throw of this range on a servo.
All I’m doing here is reverse engineering Nathans conversion for running SEQ derived sequences on his HSERVO SSC-32 emulator. Hehe, say that three times fast. lol
Thanks for doing the conversions. Since I’ve been using straight serial commands from LynxTerm and VB to the SSC-32, I’ve been trying to convert the walk code correctly but had a little trouble. I made my own through trial and error but it’s clumsy. I’d rather get the conversions right. I just did them based on the 10.4125*deg+1500uS equation and RA, RK, RH, LA, LK, LH order resulting in the following:
From the Atom code in the BRAT tutorial, it looks like the movement subroutine is using that same servo order but there’s a remark about it which has the opposite order:
;movement [lefthippos,leftkneepos,leftanklepos,righthippos,rightkneepos,rightanklepos,speed]
movement [rightanklepos,rightkneepos,righthippos,leftanklepos,leftkneepos,lefthippos,speed]
Last night, when I used a similar set of conversions I came up with, my BRAT was dancing like Michael Jackson. It got up and balanced on its toes and everything. Pretty cool but nowhere near walking. I suspected that the servo order wasn’t right and even after seeing the new conversions, I suspect it would do something similar although less intense.
So, my only question is:
What is the correct servo order that all the BRAT Atom Code in the tutorial is sending?
Yes, that’s how I set it up. Thanks - I will try again tonight. I may have had something messed up in coding last time. Of course, I may document the Michael Jackson dance code if I can get it to do it again
I’m not sure why, but it looks like there is an inconsistency in the order of the servos, specifically right and left sides are swapped from SEQ setups and Atom Pro setups. The situation will be corrected, but it will take some time to accomplish. The SEQ code has right ankle as the first joint, but the Atom Pro uses left ankle as the first joint. This might explain some mysterious moves eh?
For now all you should have to do is change the pin assignments to make things work properly. Sorry for the confusion.
No problem. I suspected that was what was going on - especially with the commented line above the movement line. I’ll give it a shot later and reply with the results. Thanks for looking!
I wrote code using the same numbers for three scenarios:
The original order (RA, RK, RH, LA, LK, LH)
Reversing this completely (LH, LK, LA, RH, RK, RA)
And swapping the Left and Right legs (LA, LK, LH, RA, RK, RH)
I’ll try them in an hour or so and post the results.
Well, none of those worked. I’m comparing to the walk code I got working last night. It may take a while though. I might just take the code I had working and change the values to match those in the tutorial but use my own order. For instance, anything I had going to P1200, I’ll change to 1292, anything that was P2000, I’ll make P1708, etc. At the very least, it will be easier to compare the code. I will report back in a bit!