Giter Club home page Giter Club logo

quadruped_kinematics's Introduction

Readme

A python library for forward and inverse kinematic operations on a 12-DOF quadruped robot.

Animation

The forward and inverse kinematics of this library are based on the following paper:

Sen, Muhammed Arif & Bakircioglu, Veli & Kalyoncu, Mete. (2017). 
Inverse Kinematic Analysis Of A Quadruped Robot.
International Journal of Scientific & Technology Research. 6.

The figures below, taken from the paper above, show the general leg and robot geometry implemented in this library. Note, the robot geometry implemented in this library is different than that of the paper. Legs 1 and 3 are rotated 180 degrees.

Robot Geometry Leg Geometry

Installation

This package can be installed via pip install. Recommend installing into a virtual environment instead of to your system! For example, if you have a python virtual environment somewhere, you could call pip install to the path of this package: pip install /your/path/to/quadruped_kinematics/

Assumptions

This library contains various hard coded lengths of the spot micro frame as measured by me with a set of digital calipers. All dimensions are approximate at best. These lengths can be modified, they are the following properties of the QuadStickFigure class:

hip_length
upper_leg_length
lower_leg_length
body_width
body_length

Use

The library can be used by instantiating a QuadStickFigure object at a height of 0.14 meters as follows. The constructor has optional arguments to set initial body x, y, z and phi, theta, psi position and orientation values. All distances are assumed to be meters, and all angles assumed to be radians.

from quadruped_kinematics import stick_figure as sfig

sm = sfig.QuadStickFigure(x=0,y=0.14,z=0)

One recommended use case is to set the absolute coordinates of all four feet at a height of 0, and at a neutral stance (where the feet are directly below the hip and shoulder joints). This can be done as follows:

# Define absolute position for the legsfour
l = sm.body_length
w = sm.body_width
l1 = sm.hip_length
l2 = sm.upper_leg_length
l3 = sm.lower_leg_length
desired_p4_points = np.array([ [-l/2,   0,  w/2 + l1],
                               [ l/2 ,  0,  w/2 + l1],
                               [ l/2 ,  0, -w/2 - l1],
                               [-l/2 ,  0, -w/2 - l1] ])

sm.set_absolute_foot_coordinates(desired_p4_points)

Setting a body orientatation (for example a pitch angle of 10 degrees) can be set as follows:

from math import pi
sm.set_body_angles(theta=10*pi/180.0)

Leg coordinates and leg joint angles can be retreived as follows:

# Get leg coordinates
coords = sm.get_leg_coordinates()

# Get leg angles
leg_angs = sm.get_leg_angles()

Limitations

This library contains no exception handling for attempting impossible poses. For example, if a foot position is set that is impossible to achieve, a domain error will result on an underlying trigonmetric function.

Additionally, this library assumes an idealized leg geometry compared to the actual spot micro 3d print model. In the real 3d model, the the first and second joints (the hip and shoulder joints) are offset height wise by approximately 1 cm. This library neglects this offset and computes about a leg as presented in the paper referenced above.

Unit tests

This library contains some unit tests. They can be run by cloning the library, cd'ing to the root directory of the project, and then running the following command: python -m unittest discover -t ..

Plotting

Some basic plotting scripts are also provided in the tests folder. These require matplotlib. They can be executed by cd'ing to a directory one level above where this library is checked out, and running a command as folloiws if this library were checked out to a directory called smkpython: python -m smkpython.tests.plotting.plot_animation.py

A sample of the animation is shown via the gif at the top of this readme.

quadruped_kinematics's People

Contributors

chrisalbertson avatar mike4192 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.