Here you will find a library for control of Franka Emika Panda robot. The library is a specialization of o80 templates and is based on libfranka. It includes both C++
headers and Python
bindings.
- Welcome to Franka_o80
- Contents
- Structure
- Requirements
- Building
- Installation
- Documentation
- Notes
- Contributors
Then simplest C++
example is:
#include <franka_o80/front_end.hpp>
int main()
{
franka_o80::FrontEnd frontend("ID"); //ID is a placeholder for shared memory identifier, it needs to be the same for front- and backend
frontend.add_command(franka_o80::robot_mode, franka_o80::RobotMode::intelligent_position, o80::Mode::QUEUE);
frontend.add_command(franka_o80::joint_position[0], 1.0, o80::Duration_us::seconds(5), o80::Mode::QUEUE);
frontend.pulse_and_wait();
}
It can be built with the following CMakeLists.txt
:
project(example)
cmake_minimum_required(VERSION 3.14.0)
find_package(Franka_o80 1.0.0 REQUIRED)
add_executable(example example.cpp)
target_link_libraries(example PRIVATE franka_o80)
Also, the program requires a running backend, which can be started with the command:
franka_o80_backend ID IP & #ID is same identifier as above, IP is the robot IP address
Correspondent Python
example follows:
import o80
import franka_o80
frontend = franka_o80.FrontEnd("ID")
frontend.add_command(franka_o80.robot_mode(), franka_o80.State(franka_o80.RobotMode.intelligent_position), o80.Mode.QUEUE)
frontend.add_command(franka_o80.joint_position(0), franka_o80.State(1.0), o80.Duration_us.seconds(5), o80.Mode.QUEUE)
frontend.pulse_and_wait()
Some important files and directories:
include
- include directory forC++
programmerssrc
- directory containingC++
sourcesexample
- directory containing finishedFranka_o80
projects in form ofC++
sources orPython
filesbuild
- default name forcmake
build directorybuild/libfranka_o80.so
- shared library forC++
programmers (could be linked withlink_libraries(Franka_o80)
)build/franka_o80.cpython-*-*.so
- shared library forPython
programmers (could be imported withimport franka_o80
)build/franka_o80_backend
- executable for backend controlbuild/franka_o80_selftest
- executable for testing the library with Google Testbuild/franka_o80_control
- example executable for robot controlbuild/franka_o80_control.py
- examplePython
script for robot controlbuild/franka_o80_control_trajectory
- example of commands that can be executed withfranka_o80_control
Franka_o80
requires:
- o80
- libfranka (set with
-DFranka_DIR=/absolute_path_to_libfranka/build
or as part ofROS
) - pinocchio (set with
-Dpinocchio_DIR=/absolute_path_to_pinocchio
as part ofROS
) - Eigen
- Boost (
system
andthread
) - Google Test (optionally)
- pybind11 (optionally)
- Doxygen (optionally)
- CMake >=
3.14.0
- Fully preemptable Linux kernel
- C++17 compatible compiler
root
privileges
Franka_o80
can be built with CMake using following commands:
mkdir build
cd build
cmake ..
cmake --build .
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .
sudo ldconfig
#Further steps are required only if you plan to use pybind'ded classes from Franka_o80 in your pybind'ded library
cmake .. -DFranka_o80_omit_include_directories=yes
sudo cmake --build .
cmake --install .
Python
docstrings are provided. C++
code is documented with comments. Doxygen documentation may be generated with doxygen
command. Example projects print human-readable help messages.
Franka_o80
may sometimes be non-intuitive. So here are some important notes:
- CAUTION! To make
Python
bindings work properly, it is required to install o80 from source and add-Do80_DIR=/absolute_path_to_o80_source/install
. It is an issue of o80 and will be fixed in it's future releases. Franka_o80
is a specialization of some o80 templates. Some vital general functions may be implemented and documented in o80, notFranka_o80
.- The project consists of frontend and backend. Frontend is responsible for sending commands and receiving observations from backend.
FrontEnd
class is the main class to be used by programmers inC++
orPython
. Backend is responsible for communication with the libfranka and needs to be started on the machine in order to use frontends. This could be done withfranka_o80_backend
executable or with some functions, likestart_standalone
. - All variables in
Franka_o80
are implemented as actuators in terms of o80, even control mode, reset signal, error, velocities, torques, etc., and they are controlled withFrontEnd::add_command
like real actuators. When reading observations, all actuators are defined. But some of them (likejoint_position
andcartesian_position
) obviously contradict each other, and which of them will be used to control the robot, is decided byrobot_mode
andgripper_mode
actuators. - All actuators, like
robot_mode
orjoint_position
, are just constant numbers. They are only useful inFrontEnd::add_command
,States::get
andStates::set
functions. - FrontEnd does not throw exceptions when an error in backend occurs. The only way to know about backend errors is to read
control_error
actuator. - All
FrontEnd::add_command
functions acceptState
. This is why the class encapsulates both real numbers, quaternions, mode and error enumerations, and some dynamic typization is done in the class (even inC++
). Backend will, for example, expect the state applied torobot_mode
actuator to containRobotMode
value, but frontend does not check state types and does not throw exceptions. The only way to know thatFrontend::add_command
was called with wrong state type is to readcontrol_error
actuator. - The gripper is controlled in non-o80 style. The gripper is moved with the velocity specified in
gripper_velocity
, duration given toFrontEnd::add_command
has no influence on it.
- Kyrylo Sovailo
- Original o80 is authored by Vincent Berenz, Max Planck Institute for Intelligent Systems, Empirical Inference Department
- Models from
model
directory were generated with MoveIt Setup Assistant fromROS
packagefranka_description