Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Kinematic simulator in python?

  1. #11
    Join Date
    Apr 2013
    Location
    San Francisco, CA
    Posts
    14
    Images
    3
    Rep Power
    27

    Re: Kinematic simulator in python?

    Yes, the trig seems very fast. I had to add a whole extra IK routine in to back-calculate the foot position from the wheel-on-ground position for skating, so I can ensure that the wheel is always touching the ground whatever angle the leg is at (since the leg angle affects the vertical distance between foot and wheel). I was going to roll the resultant IK into a separate routine for skating, but it's fast enough that I can run the back-calculate and then run the full IK for the foot (which contains some redundant calcs) without any apparent slow down...

    I updated the code at http://www.gotrobots.com/grinder/sim...r_simulator.py with the latest code showing wheel-contact IK working in a skating algorithm...

  2. #12
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    260
    Images
    11
    Rep Power
    34

    Re: Kinematic simulator in python?

    This is cool, i got your project up and running yesterday. I've never used Python before so i'm trying to wrap my head around it, but i'd like to build a simple 3DOF hex model that everyone can use. I'll post it up if/when i get there.

    Great tool!

  3. #13
    Join Date
    Apr 2013
    Location
    San Francisco, CA
    Posts
    14
    Images
    3
    Rep Power
    27

    Re: Kinematic simulator in python?

    Quote Originally Posted by TXBDan View Post
    This is cool, i got your project up and running yesterday. I've never used Python before so i'm trying to wrap my head around it, but i'd like to build a simple 3DOF hex model that everyone can use. I'll post it up if/when i get there.

    Great tool!
    Great, can't wait to see it... The technique is actually pretty straightforward and extensible. The idea is that you build all linkages initially along a line, naming each end. Each leg is placed within a frame. Then you calculate the x,y coords of each point and move the end points to these coords. As a final step each leg frame is rotated by the leg angle.

    This works great for my linkage assembly; for a more general motor chain assembly each motor will need to be in its own frame but frames can be nested to achieve the desired results.

  4. #14
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    260
    Images
    11
    Rep Power
    34

    Re: Kinematic simulator in python?

    I got it almost done, but got distracted when my hex kit arrived!

    I wanted to be able to test my IK code so my method is pretty convoluted. I'm basically running the leg IK function and then running that servo angle output into a FK function so that i can get the X,Y,Z coords for all of the joints. Then i use those XYZs to update the link cyclinder and sphere positions. It mostly works but my leg frames are messed up and there's a bug in my IK or FK somewhere.

    I'm really annoyed by the vpython default XYZ orientation. It's screwing up everything i have in my head. Is there a way to redefine the default orientation behavior?

    I'll try to fix it, but for now i'm pretty obsessed with my hex kit

  5. Re: Kinematic simulator in python?

    Quote Originally Posted by TXBDan View Post
    I'm really annoyed by the vpython default XYZ orientation. It's screwing up everything i have in my head. Is there a way to redefine the default orientation behavior?
    You can try setting a different value of scene.up:
    Code:
    scene.up=(0,0,1)
    It might be enough, it might not be... I had a hard time adjusting to the way VPython orients stuff too. This made it better for me.

    And BTW you can use this to show the orientation of stuff (I have one in the main scene, then another one in each frame to have a better understanding of what's happening).

    Code:
    class vect_base:
        def __init__(self, pos=(0,0,0), size=10, number='', parent_frame=None):
            if parent_frame == None:
                self.coord = frame()
            else:    
                self.coord = frame(frame=parent_frame)
            coordinate_pos = vector(pos)
            ref_x = arrow(frame=self.coord, pos = coordinate_pos, axis=(size,0,0), shaftwidth=3, color=color.red)
            label(frame=self.coord, pos = coordinate_pos+(size*0.8,0,0), text='x'+str(number), box=false, opacity=0.1, height=size)
            ref_y = arrow(frame=self.coord, pos = coordinate_pos, axis=(0,size,0), shaftwidth=3, color=color.green)
            label(frame=self.coord, pos = coordinate_pos+(0,size*0.8,0), text='y'+str(number), box=false, opacity=0.1, height=size)
            ref_z = arrow(frame=self.coord, pos = coordinate_pos, axis=(0,0,size), shaftwidth=3, color=color.blue)
            label(frame=self.coord, pos = coordinate_pos+(0,0,size*0.8), text='z'+str(number), box=false, opacity=0.1, height=size)
    ---
    Personal blog: http://xevel.org
    USB2AX documentation: http://xevelabs.com

  6. #16
    Join Date
    Apr 2013
    Location
    Boston, MA
    Posts
    260
    Images
    11
    Rep Power
    34

    Re: Kinematic simulator in python?

    Thanks, that is very helpful.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Bioloid Simulator
    By MattD in forum Software and Programming
    Replies: 2
    Last Post: 09-02-2014, 11:00 AM
  2. simulator robot
    By light86 in forum Software and Programming
    Replies: 4
    Last Post: 06-06-2013, 05:25 PM
  3. Question(s) choosing platform for project (biped, torque control servo, advanced kinematic)
    By sergeyko in forum Robotics General Discussion
    Replies: 7
    Last Post: 05-16-2011, 02:02 AM
  4. Project My Inverse kinematic software for controlling robot arms.
    By Pinter75 in forum Project Showcase
    Replies: 1
    Last Post: 09-10-2010, 11:01 PM
  5. Contest Entry My flight simulator
    By gokhotit in forum Project Showcase
    Replies: 1
    Last Post: 08-22-2007, 11:18 AM

Posting Permissions

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