Skip to main content

Primitive robot kinematics and collision checking.

Project description

Build Status codecov PyPI version

Acrobotics

Quickly test motion planning ideas is the goal, and Python seems like a great language for rapid prototyping. There are great libraries for robot simulation and related task, but installing them is can be a hassle and very dependent on operating system and python version. The drawback is that I have to write a lot of stuff myself. I'm not sure if it is useful to do this. But it will be fun and I will learn a bunch.

This library provides robot kinematics and collision checking for serial kinematic chains. The idea is that this library can be easily swapped by another one providing the same functionality.

The acro part comes from ACRO a robotics research group at KU Leuven in Belgium.

Installation

pip install acrobotics

Or for development

git clone https://github.com/JeroenDM/acrobotics.git
cd acrobotics
python setup.py develop

No Windows support for the moment because python-fcl is not supported. :( In the future I will possibly switch to pybullet. In the meantime, use windows subsystem for linux. MacOS is not tested yet.

Gettings started

(Code for example below: examples/getting_started.py)

This library has three main tricks.

Robot kinematics

T = robot.fk(joint_values) IKSolution = robot.ik(T)

Forward kinematics are implemented in a generic RobotKinematics class.

import acrobotics as ab

robot = ab.Kuka()

joint_values = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
T_fk = robot.fk(joint_values)

Analytical inverse kinematics only for specific robots:

ik_solution = robot.ik(T_fk)  # T_fk is a numpy 4x4 array

print(f"Inverse kinematics successful? {ik_solution.success}")
for q in ik_solution.solutions:
    print(q)
Inverse kinematics successful? True
[ 0.1        -1.0949727   2.84159265  2.87778828  0.79803563 -1.99992985]
[ 0.1        -1.0949727   2.84159265 -0.26380438 -0.79803563  1.1416628 ]
[0.1 0.2 0.3 0.4 0.5 0.6]
[ 0.1         0.2         0.3        -2.74159265 -0.5        -2.54159265]

Collision checking

bool = robot.is_in_collision(joint_values, planning_scene)

First create a planning scene with obstacles the robot can collide with.

from acrolib.geometry import translation

table = ab.Box(2, 2, 0.1)
T_table = translation(0, 0, -0.2)

obstacle = ab.Box(0.2, 0.2, 1.5)
T_obs = translation(0, 0.5, 0.55)

scene = ab.Scene([table, obstacle], [T_table, T_obs])

Then create a list of robot configurations for wich you want to check collision with the planning scene.

import numpy as np

q_start = np.array([0.5, 1.5, -0.3, 0, 0, 0])
q_goal = np.array([2.5, 1.5, 0.3, 0, 0, 0])
q_path = np.linspace(q_start, q_goal, 10)

And then you could do:

print([robot.is_in_collision(q, scene) for q in q_path])
[False, False, False, False, True, True, True, True, False, False]

Visualization

robot.plot(axes_handle, joint_values) robot.animate_path(figure_handle, axes_handle, joint_path)

from acrolib.plotting import get_default_axes3d

fig, ax = get_default_axes3d()

scene.plot(ax, c="green")
robot.animate_path(fig, ax, q_path)

animation

More details

There's a more in depth explanation in the jupyter-notebooks in the examples folder.

Most of the usefull stuff can be imported similar to common numpy usage:

import acrobotics as ab

For more advanced classes, such as Robot to create a custom robot, you have to explicitly import them:

from acrobotics.robot import Robot
from acrobotics.link import DHLink, JointType, Link

And motion planning?

The package implements a basic sampling-based and optimization-based planner. Examples on how to use them can be found in the test folder, in test_planning_sampling_based.py and test_planning_optimization_based.py. However, there is a non-trivial amount of setting types you have to supply to get it working. These appeared after a major refactor in an attempt to make to code more maintainable, but we went a bit overboard in the settings department...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acrobotics-0.0.6.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

acrobotics-0.0.6-py3.7.egg (98.5 kB view details)

Uploaded Source

File details

Details for the file acrobotics-0.0.6.tar.gz.

File metadata

  • Download URL: acrobotics-0.0.6.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for acrobotics-0.0.6.tar.gz
Algorithm Hash digest
SHA256 df133c87d51fb85e8a0d44cde161383bfe9b06ed6ab40aefd5b126aaff51f07a
MD5 35500a480f5350554c407fb7a55a8152
BLAKE2b-256 d7a69b9326ce9349f71f7026d6b6809dc708ae922c5f98a4bf3f2663359b96ad

See more details on using hashes here.

File details

Details for the file acrobotics-0.0.6-py3.7.egg.

File metadata

  • Download URL: acrobotics-0.0.6-py3.7.egg
  • Upload date:
  • Size: 98.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for acrobotics-0.0.6-py3.7.egg
Algorithm Hash digest
SHA256 ddfd04cea39c4c3e19edf7d89de285eb7df7568c090a6188ef3cec767f0dc58b
MD5 71e5a699ccf14bdffc176460be177eca
BLAKE2b-256 c20cdebc4f39de9f5473c04d5a05bcdb0d7eb2f8189a64f2c6f53cf72e50ae25

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page