title: 'Guide: Get the Franka Emika Panda running with C++' author: Christoph Hinze date: \today institute: IRTG Soft Tissue Robotics (GRK2198/1) ...
-
The tutorial will run on Linux, explanations below are for Ubuntu. If you haven't already installed Ubuntu on your Computer, or enabled the Windows Sybsystem on Linux (WSL), you should install it, following the tutorial on https://docs.microsoft.com/en-us/windows/wsl/install-win10. As distribution install e.g. Ubuntu 18.04. This will enable you to run a virtual Ubuntu terminal on Windows 10.
-
Install Git on Windows (https://git-scm.com/downloads), or directly in the WSL (
sudo apt install git
) -
Install requirements for building the C++ project that we will create throughout this tutorial. We need
libfranka
(unfortunately not directly available through sources) andlibeigen3-dev
mkdir -p ~/dev && cd ~/dev libfranka_version="0.6.0" # install Eigen3 and libfranka sudo apt update && sudo apt install --yes build-essential cmake git libpoco-dev libeigen3-dev # from here: build libfranka dependency from source code and install it: git clone --recursive https://github.com/frankaemika/libfranka.git cd libfranka git checkout ${libfranka_version} git submodule update mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF .. make -j4 sudo make install
-
A manual on the Franka Emika Panda and
libfranka
is at https://frankaemika.github.io/docs/getting_started.html -
A documentation for
libfranka
can be found at https://frankaemika.github.io/libfranka/ -
We will use
Eigen3
as math library, where an introduction may be found at http://eigen.tuxfamily.org/dox/group__QuickRefPage.html
The exercises without solution are directly available on the
master
branch. The solution is under branchsolution
.
Get the tutorial from Github with
# Drive C: on Windows (with WSL) is available with /mnt/c/..., so you might want to `cd` to this directory
git clone https://github.com/chhinze/panda_tutorial
Install the requirements for building the documentation
# --no-install-recommends needed to prevent installing doxygen-latex
sudo apt install --no-install-recommends doxygen graphviz
The project can be built with cmake
with GNU make
. I.e.
cd ~/dev/panda_tutorial
mkdir build
cd build
# build the makefiles
cmake ..
# build the executables from C++ code
make -j4
# build the documentation with doxygen (needs doxygen installed)
make doc
The binaries are generated within the ./build/...
.
You can find the documentation at ./build/documentation/html/index.html
- Create two
Eigen::Vector3d
objects- One with all entries 10 and
- one with [0.1, 0.5, 0.7];
- Create two
Eigen::Matrix3d
objects:- An Identity matrix
- A Matrix with
| 1, 2, 3 | | 4, 5, 6 | | 7, 8, 9 |
- Try, how to do vector-vector matrix-vector and matrix-matrix multiplications
- Find out, how to perform element-wise operations. (E.g. find the row-wise maximum of a matrix, multiply element-wise).
- Access the first two elements of a vector. Write new values to it.
- Have a look at the MotionGenerator, which is originally provided by Franka Emika for their code samples. It is included as
"examples_common.h"
- Define a goal position as
std::array<double,7>
for the axes. The joint positions should be [0, -pi/4, 0, -3/4*pi, 0, pi/2, pi/4] (0, -M_PI_4, 0, -3 * M_PI_4, 0, M_PI_2, M_PI_4
). Create a MotionGenerator object with this goal position. - Set the robot controller to axis position control by just passing the
MotionGenerator
object. Refer to the libfranka documentation for different control modes. - Build and run the application (
make -j4 axes_motion
). Be careful, the robot will be moved. Be prepared to push the user stop button.
- Refer to the documentation to find out how to read a
franka::RobotState
. Read it once to get the sart position. O_T_EE_c
contains the homogeneous transformation matrix as array with 16 values. Convert it to a 6d vector (3 translations, 3 RPY rotations) by using the functionhomogeneousTfArray2PoseVec(std::array<doublem 16>) -> Eigen::Vector6d
- Calculate a 6d goal pose by adding 0.1 m to each of the translational coordinates.
- Create a
LinearTrajectory
between start an end pose. Usev_max = 0.05
,a_max = 0.5
andj_max = 1e-3
. - Create a
TrajectoryIteratorCartesianVelocity
object. It overloads the function call operator, such that it can directly be used infranka::Robot.control(...)
. - Specifiy the robot controller (
panda.control(...);
) - Build and run the application (
make -j4 cartesian_trajectory
). Be careful, the robot will be moved. Be prepared to push the user stop button.