Package: acrobotics
AcroboticsQuickly 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 fromACROa robotics research group at KU Leuven in Belgium.InstallationpipinstallacroboticsOr for developmentgitclonehttps://github.com/JeroenDM/acrobotics.gitcdacrobotics
pythonsetup.pydevelopNo Windows support for the moment becausepython-fclis not supported. :(
In the future I will possibly switch topybullet. In the meantime, usewindows 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 kinematicsT = robot.fk(joint_values)IKSolution = robot.ik(T)Forward kinematics are implemented in a genericRobotKinematicsclass.importacroboticsasabrobot=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 arrayprint(f"Inverse kinematics successful?{ik_solution.success}")forqinik_solution.solutions:print(q)Inversekinematicssuccessful?True[0.1-1.09497272.841592652.877788280.79803563-1.99992985][0.1-1.09497272.84159265-0.26380438-0.798035631.1416628][0.10.20.30.40.50.6][0.10.20.3-2.74159265-0.5-2.54159265]Collision checkingbool = robot.is_in_collision(joint_values, planning_scene)First create a planning scene with obstacles the robot can collide with.fromacrolib.geometryimporttranslationtable=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.importnumpyasnpq_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)forqinq_path])[False,False,False,False,True,True,True,True,False,False]Visualizationrobot.plot(axes_handle, joint_values)robot.animate_path(figure_handle, axes_handle, joint_path)fromacrolib.plottingimportget_default_axes3dfig,ax=get_default_axes3d()scene.plot(ax,c="green")robot.animate_path(fig,ax,q_path)More detailsThere'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:importacroboticsasabFor more advanced classes, such asRobotto create a custom robot, you have to explicitly import them:fromacrobotics.robotimportRobotfromacrobotics.linkimportDHLink,JointType,LinkAnd 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, intest_planning_sampling_based.pyandtest_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...