go_away

Author Topic: Webbotlib and servo questions...  (Read 1245 times)

0 Members and 1 Guest are viewing this topic.

Offline KurtEckTopic starter

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Webbotlib and servo questions...
« on: December 17, 2009, 02:25:50 PM »
I think it would be fun to try out my new Axon2 on one of my Lynxmotion brats.  So as a starting point I have looked at SOR: Biped engine which looks like a nice version, but I also think it would be fun to generate my own version.   

What I would like to do is to do is to is to generate sequences for each gate that is something like: for step 1, the servo angles are a11, a12, ... for step 2 the angles are a21, a22, ... and I want to take N milliseconds to get there.

I would then like my own engine calculate the delta values for each of the servos and try to move all of the servos in a fluid motion to the next location.  Some questions I have include:

With the default webotlib the servo values have a range of -127 to 127 and the data type of DRIVE_SPEED is 8 bits in size.  It will be interesting to see if the that will give enough resolution to make it fluid (probably will), but if not would it hurt very many things to redefine DRIVE_SPEED to be a word?  Obviously would need to change min/max and any other motors that are used.

Now suppose I hook up the six leg servos to the IO pins associated with T3 and T4, does it make sense to setup a new timer with my own callback that for example suppose I know that over 500ms I want  the Left Ankle to go from 0 to -20 and the Right Ankle to go from 0 to 60 (in Drive_speed values).  Would it be possible to setup this timer that it is called every N ms and we move the change each servo value (act_setspeed), depending on how far each needs to move.  I will play around on should this be some fixed interval of time like 20ms or 50ms  and we deal with partial units or if I should calculate some best time version per the different deltas.  Does this make sense?

Thanks
Kurt

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Webbotlib and servo questions...
« Reply #1 on: December 18, 2009, 02:58:39 AM »
Quote
With the default webotlib the servo values have a range of -127 to 127 and the data type of DRIVE_SPEED is 8 bits in size.  It will be interesting to see if the that will give enough resolution to make it fluid (probably will)
Your typical 180 degree servo will have a resolution of around 90. 8 bits will give you a resolution of 256 - much higher than your servos can do.

I find the 8 bit resolution more than fine for my bots ;D

You aren't the first to ask me to add a time between each gait position. There are several reasons I didn't do it:
- It doubles the array size of your gait array
- Complicates gait programming (not only angle must be right, but now timing too)
- Just because you tell the servo to do something, doesn't mean it will
- For a robot, you don't care that the knee joint traveled 20 deg in 213 ms, only that it walks
- Same for robot arm, you only care about end effector motion

In Biped Engine v3, there are two modes. In single position mode, meaning the robot goes from one position to another, you can control the time between. For full engine mode (which v2 also has), meaning it goes through a whole set of motions, you control timing when you program each position in.

Offline KurtEckTopic starter

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: Webbotlib and servo questions...
« Reply #2 on: December 18, 2009, 12:57:29 PM »
Thanks, as I mentioned I thought 8 bit will probably work just fine.  I know that the servos go from a range of about 500-2500us give or take, but the actual number of distinct servo positions would probably not be even close to that high.

Actually what I was thinking is not really that different than what you are doing in your version 3.0.  That is it says you want to move all of the servos from their current location to a new location in some amount of time (versus how many loops).  You calculate the differences for each servo, you then take the requested time for the move divide it by the clock tick resolution you wish and, which is how many clock ticks the moves will take, then divide the delta for each servos by that number of loops and add that delta each time the tick happens.  This could be done in floating point, but I would probably instead convert these values into tenths of a unit and add that on per cycle and on the last cycle through simply used the desired value to handle any rounding up/down issues.

The more interesting question is should I move all of this delta stuff off to a timer processor and simply have my main loop process inputs and influence the engine or should I keep it in the main loop and after I check my input devices like a PS2 or an xbee could do a ClockHasElapsed call to see if it is time to do the
next change.  Maybe this would be the easier method.  May have answered my own question for now.  But I still wonder if putting it on a timer would make it look cleaner and maybe a bit better, but that I can try on pass two. 
Thanks
Kurt
P.S. - When I type a message that is more than the text input window size in lines, it keeps scrolling back and forth as I try to type in the data which is frustrating as a lot of the time I can not see what I am actually typing in.  Does this only heppen with IE?  Any way to resolve?  Thanks again

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Webbotlib and servo questions...
« Reply #3 on: December 18, 2009, 07:53:08 PM »
Yea, there is no problem in using the timer in that manner, I guess. You can even have it calculate the number of cycles based on an input'ed amount of time.

v3.0 has one other feature - it will automatically modify your gait in real-time based on IMU data to balance your robot. Its not finished in the alpha version, but I plan to have it done soon for the beta release.

Quote
P.S. - When I type a message that is more than the text input window size in lines, it keeps scrolling back and forth as I try to type in the data which is frustrating as a lot of the time I can not see what I am actually typing in.  Does this only heppen with IE?  Any way to resolve?

Never seen that before, but I mostly use Chrome and occasionally Firefox. The last good IE browser was v6, so you really should get something better :P

http://www.google.com/chrome/eula.html

Offline KurtEckTopic starter

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: Webbotlib and servo questions...
« Reply #4 on: December 18, 2009, 08:39:25 PM »
Thanks hopefully over this next week I will get enough of my version put together to see how well it will work.

thanks again.

P.S - I got annoyed enough to see if there is something I can do to fix that stupid scroll issue.  I found a posting up on a social Microsoft website: http://social.answers.microsoft.com/Forums/en/InternetExplorer/thread/3fdd2b51-4efa-4495-be03-17b647dc61b2

It said in cases like this try: clicking on the Page menu item and click on the compatibility view menu item, which will run the browser the same way as in previous versions.  That fixed the problem for me.

 


Get Your Ad Here

data_list