Results 1 to 9 of 9

Thread: Py4bot - a Python Framework for Multi-Legs Robots

  1. #1
    Join Date
    Sep 2015
    Location
    Grenoble, France
    Posts
    29
    Rep Power
    7

    Py4bot - a Python Framework for Multi-Legs Robots

    Hi!

    2 years ago, I started to develop Py4bot (http://www.py4bot.org), a Python Framework for Multi-Legs Robots.

    This framework is used to drive Cronos, a 4 DoF hexapod (http://forums.trossenrobotics.com/ro...project_id=104). There are still some bugs and issues I have to fix, but it is useable.

    It is able to drive robots with any number of legs, and any number of DoF (I only implemented 3 and 4 DoF). It should even be possible to mix legs with different DoF (I didn't test this feature yet).

    Gaits are freely defined.

    It supports a few servos drivers, but additional drivers are easy to add.

    For now, I run Py4bot on a BeagleBone Black, with a custom cape (and assmbly PRU code) as servos driver.

    For future devs, I need to fix the remote control management, which has some little bugs (it is possible to use modifier keys to change keys/joystick behaviour, but command without the modifier is also triggered when the modifier is active).

    The gait sequencer is clocked by the speed of the robot. Trajectories are simple triangles (leg down rear, leg up, leg down front), and Python code only recomputes positions at each point of the triangle. So, if one changes the speed of the robot between 2 points, the new speed is only taken into account at the next point. This is not a problem when the speed is high, but when moving slowly, it is not intuitive, as the speed does not change as soon as you push the joystick...

    To fix that, I have to use a fixed clock for the gait sequencer, fast enough to be smooth when changing speed, and compute more points for the trajectory (at each top of the clock). The problem is I don't think that the BBB will be fast enough for that. I think to switch to a RPi3...

    I'm also wondering if ROS could help me, or if it will only add some complexity...

    So, as you see, I have a lot of things to explore, which is fun!

    Any feedback welcome.
    Last edited by fma; 2 Weeks Ago at 02:24 AM.

  2. #2
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    254
    Images
    11
    Rep Power
    22

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    The gait sequencer I wrote uses half sine waves to create an arching step and uses many update points along the step trajectory. It runs at a fixed "frame rate", 30Hz or 50Hz work well. So every 20ms it calculates the entire hexapod's body and leg IK and it runs fine on the ARM microcontrollers. The BBB should handle it no problem.

    I actually have a cleaner version from when I redid it all about a year ago but never commited it to github. I'll see if I can dig up that SDcard and post it. Same trajectory concept though.

    You can read about it on my blog: http://www.projectsofdan.com/?cat=4

    And the code is here: https://github.com/TXBDan/BETH_Raspi

    I'm currently working to redo it all yet again on a RPi3 and it's looking like I might switch over to python. I'll try to keep my blog and posts here updated.

  3. #3
    Join Date
    Sep 2015
    Location
    Grenoble, France
    Posts
    29
    Rep Power
    7

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    Looks like I missed your answer! Sorry for that (I don't receive notifications from the forum; don't know why).

    I dropped Py4bot dev last year, as I was thinking to build a BB-8 robot. But I realized it is too much work, and, more important, too much money... So, I decided to go back to my hexapod, and restart Py4bot dev.

    I'm currently helping a user to deploy Py4bot on his hexapod, which forced my to improve the RPi support trough PCA9685. We also made a quick test with auto-leveling feature, which work fine.

    My next move is to improve the gait sequencer, as explained in my first post. I'm currently looking at your code, which is nice and clean.

    I have a question: how do you handle the direction change, when switching from forward to backward translation, or from left to right rotation? This requires to revert the gait sequence, but I don't see that in your code...

    Thanks

  4. #4
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    254
    Images
    11
    Rep Power
    22

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    I forget exactly, but basically the step magnitude is in X and Y directions and positive and negative. That defines where the foot is going relative to the "zero" home position forward/back/left/right.

    However, i have shifted gears to a new algorithm that a Professor i have has figured it out. This paper covers everything from the hexapod IK, to gait sequencing, to trajectory, to foot-force stability for uneven terrain. I have it some of it working in Matlab and I plan to implement on my robot sooner or later.
    https://web.wpi.edu/Pubs/ETD/Availab...ed/magheli.pdf

    Using the "beta" method for gait generation is actually much simpler, more robust, and can be tied into dynamically switching gaits.

  5. #5
    Join Date
    Sep 2015
    Location
    Grenoble, France
    Posts
    29
    Rep Power
    7

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    Thanks for you answer.

    I made a quick test and implemented your BETH gait generator: it is very responsive, but not accurate in all situations: the legs slip on the floor, I think because of the lack of start/stop sequences (the feet switch from neutral position to walking positions without swinging).

    I was about to merge your code and mine, but I will definitely have a look at this paper. Is it your thesis?

  6. #6
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    254
    Images
    11
    Rep Power
    22

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    Hrmm shouldn't do that. the approach from stopped to stepping is simply a scaling of tiny steps. So each step should shrink in height and length from zero to some max size. stopped is actually continuously doing the same math, just with zero magnitude height/length. Or maybe there is a bug that i fixed later. I lost my lastest clean up of that code. Or maybe its on a SDcard somewhere.

    No, the paper is by a professor of mine. I'm chipping away at a MSRBE at WPI part time. It's a great all-encompassing paper though. I'll try to dig up some matlab code implementing it. It's actually quite elegant and clean in code. Maybe 1/10th the lines of all my code. hah I've switched to Python and using NumPy for matrix math makes the translation from Matlab to Raspberry Pi even easier.

  7. #7
    Join Date
    Sep 2015
    Location
    Grenoble, France
    Posts
    29
    Rep Power
    7

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    Even if you scale with tiny steps, legs on the floor will slip. It works fine for tripod, because there is only 1 group of legs stancing, all at the same relative position. But all other gaits will have the issue, as there are different groups stancing, at different relative positions.

    About Python, yes, using matrix is great, and make the code easy to maintain/understand.

  8. #8
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    254
    Images
    11
    Rep Power
    22

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    Nope, there should be no slipping for any of the gaits if its working properly. Believe me, i've been spent hours with my head on the floor watching the feet move. hah.

    There was once a bug in the rotation matrices when the robot rotated causing the feet to slip. I think the feet were being rotated about the coxa instead of the center of the robot. Maybe look into that.

    To be honest, I don't feel very motivated to look into it. I'm too pumped about this new algorithm. I'll put some of it in python up on github in the next few weeks.

  9. #9
    Join Date
    Sep 2015
    Location
    Grenoble, France
    Posts
    29
    Rep Power
    7

    Re: Py4bot - a Python Framework for Multi-Legs Robots

    I wrote something explaining the problem of start/stop sequences:

    http://www.py4bot.org/wiki/Tutorial6AddGait

    As long as you don't implement such sequences, it can't be accurate. I agree, it is not that bad if you slowly increase the amplitude (but feet *do* sleep a little), but if you suddenly start full speed, or stop from full speed, things go wrong.

    All gaits above 2-steps cycle suffer from that problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Interesting RPI3 with the HROS1-Framework.
    By LloydF in forum HR-OS1 Development and Discussion
    Replies: 6
    Last Post: 12-09-2016, 02:58 AM
  2. Camera / Vision Processing (within the HR-OS1 Framework)
    By r3n33 in forum HR-OS1 Development and Discussion
    Replies: 54
    Last Post: 03-20-2016, 09:00 AM
  3. Why using Python to control robots?
    By Snoopy in forum Software and Programming
    Replies: 2
    Last Post: 01-01-2015, 11:48 PM
  4. framework for robotics
    By iacoposk8 in forum Robotics General Discussion
    Replies: 2
    Last Post: 10-11-2013, 07:52 PM
  5. Question(s) PhantomX Code 6 legs in to 8 legs
    By Kar in forum Software and Programming
    Replies: 2
    Last Post: 05-09-2011, 09:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •