Several examples are contained in this directory. In addition, two experiments are also included.
The majority of these examples require PyBullet.
If you installed OpTaS without modifying setup.py
this should have been installed by default.
Otherwise, you can install PyBullet using $ pip install pybullet
.
Note, the OpTaS visualizer requires VTK.
If you installed OpTaS without modifying setup.py
this should have been installed by default.
Otherwise, you can install VTK using $ pip install vtk
.
The example.py
script showcases some of the main features of OpTaS.
This script, figure_eight_plan.py
, demonstrates how to implement a simple planner.
A hand-crafted task space trajectory is given, and the planner finds the joint space trajectory.
The script that runs the dual arm example is dual_arm.py
.
The goal of this example is to demonstrate how multiple robots can be incorporated into a single optimization formulation.
A task space trajectory is hand crafted, for a dual arm setup using two KUKA robot arms. A joint space plan is computed for both arms by solving an optimization problem in a single formulation.
This is a simple example that shows how to pass the robot model to the visualizer.
The script that implements this example is visualization.py
.
A basic task space MPC controller is demonstrated in the point_mass_mpc.py
script.
The script implements a basic MPC controller, and plots the solution in a short animation.
The demonstration first computes a task space plan. Then the robot (point mass) is tasked with tracking the plan whilst adapting to dynamic obstacles in the scene. An obstacle, at execution time, is given some motion that impedes the plan - the goal of the MPC is to avoid the obstacle. This is achieved via the MPC controller.
This example, in the script point_mass_planner.py
, demonstrates how to plan a trajectory using a task model.
The planar_ik.py
script contains a simple example of a possible full Inverse Kinematics (IK) implementation for a planar three Degrees of Freedom (DoF) robot arm.
The task-space consists of the x and y position of the end-effector and the IK computes an optimal set of joint angles, using a non-linear program formulation through the CassADiSolver and the ScipyMinimizeSolver interfaces.
The planar_idk.py
script contains a simple example of a possible Inverse Differential Kinematics (IDK) implementation for a planar three DoF robot arm.
The task-space consists of a desired displacement of the x and y position of the end-effector and the IDK computes the optimal set of joint angle displacements, using two different alternative Quadratic Program (QP) solvers.
This formulation also adds bounds to the end-effector orientation and compares the result with the solution obtained through the pseudo-inverse approach.
Assuming PyBullet is installed, this experiment should run out of the box.
This experiment requires some additional setup to run. Ultimately, it requires TracIK and EXOTica. The easiest way to install these and run the experiment is to follow these instructions.
- Install ROS Noetic (full install)
- Install catkin_tools
- Create catkin workspace and
src
directory:$ mkdir -p optas_expr_ws/src && cd optas_expr_ws
- Initialize catkin workspace:
$ catkin init
- Change directory:
$ cd src
- Clone EXOTica:
$ git clone [email protected]:ipab-slmc/exotica.git
- Clone TracIK:
$ git clone https://bitbucket.org/traclabs/trac_ik.git
- Install dependencies:
$ rosdep update ; rosdep install --from-paths ./ -iry
- Build catkin workspace:
$ catkin build
- Source catkin workspace:
$ source ../devel/setup.bash
- Change directory:
$ cd /path/to/optas/example
- Run experiment:
$ python experiment2.py
(note: since EXOTica loads URDF/SRDF files using relative filenames to where the load methods are called, you must ensure to run this script from inside theexample/
directory - this doesn't apply for the other examples)