From 5b50daf54e8844cc9b4e59953cc09753c0d9c29f Mon Sep 17 00:00:00 2001 From: Joschua Gosda <joschua.gosda@control.lth.se> Date: Mon, 25 Apr 2022 15:16:12 +0200 Subject: [PATCH] updated README --- README.md | 59 ++++++++++++++++++++++++++++++++++++---------- c++/CMakeLists.txt | 13 +++++++--- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4aff540..927ab45 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,31 @@ -# Kinematics implementation -Using the Robotics Library kinematic configuration of the robot can be specified using a xml or urdf file. At first the DH-parameters of an past project were used and implemented according to the tutorial of RL. RL uses the standard convention for specifing the dh parameter, namely: +# Project description +To come... +# Setup +## Kinematics implementation +C++ and C++ libraries are used to implement forward and inverse kinematics for the Yumi. -- d: specifies the translation along the previous z axis -- theta: is the rotation around the previous z axis to align with the new x axis -- a: defines the translation along the new x axis -- alpha: gives the rotation around the new x axis to align with the new z axis +The Robotics Library is used to parse the robotic configuration from an .urdf file and compute the forward kinematics as well as the Jacobian. + +For inverse kinematics the broccoli library of the Chair of Applied Mechanics at TUM is used to implement a gradient based projection method which takes two additional constraints - a norm for maximal joint values and a norm for the distance of any singularities - into account and projects them into the nullspace of the robot. Projecting these constraints into the nullspace helps to avoid maximal joint values and singularities without affecting the pose of the end effector. + +## Interface to robot +Communication to the IRB14000 is performed via an UDP interface using Google Protobuffres. It is aimed to use an existing Python client and calling C++ code for the kinematics from the Python program. + +## Force sensing +In order to keep the wire tensioned during the foam cutting application sensor data is needed to setup a feedback loop. Therefore a one dimensional [load cell](https://www.electrokit.com/en/product/load-cell-1kg/) is going to be mounted to the end effector of Yumi. The signal of the full bridge that meassures the gauge of the cell is amplified by an HX711 AD-Converter and conntected to an Arduino Uno. The data is then going to be send to the controller that runs on the pc over a Serial Interface. + +## Hot Wire +The wire is going to be heated by appling a voltage that results in a current, depending on the resistance of the wire. The current is going to be controlled using a dc converter. -Unfortunately the parameters are for an older version of YuMi called Frida and do not match the TCP position and orientation when comparing against RobotStudio in a given joint configuration. -Fortunately there is another option to specifies the kinematics for a robot over a urdf file and there is already a model existing in the repo of OrebroUniversity. Their urdf-description file was then edited (which is not recommended but works) in order to specify the kinematic configuration for the left and right arm of YuMi. When comparing the resulting positions and orientations of the forward kinematics there is still an offset between the manual forward kinematics and RobotStudio. This is because the TCP-reference frame is not the same, as it can be seen in picture xy. # Installation instructions ## C++ The project needs a few dependencies to be installed. These are broccoli, the robotics library as well as pybind11 in order to create bindings between Python and C++ code. To prevent any troubles while installing them in the next step make sure you have the following packages installed. Check or otherwise install them running `sudo apt install cmake python3-dev python3-distutils` in the command line. -Download the robotics library and eigen and put them into `/opt/`. +Download eigen and put them into your `/opt/` folder. ### pybind11 -There are several ways how to use pybind11. Number 1 was tested succesfully +There are several ways how to use pybind11. Number 1 was tested succesfully and is recommanded 1. Inlcude pybind11 as submodule Within the `c++` folder run @@ -43,19 +52,33 @@ cmake --install build Installation instruction for pybind11 can be also found [here](https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake) ### broccoli -Brocolli can be directly installed to the system. Therefore clone the respective repo using git. Then cd in cloned brocolli repo and run the commands to install brocolli to your system +Broccoli can be directly installed to the system (tested and works) or included as an external project. To install broccoli directly to the system clone the respective repo using git. Then cd in cloned brocolli repo and run the following commands to install brocolli to your system ``` mkdir build cd build cmake .. make install ``` +Broccoli and installation instruction can be found [here](https://gitlab.control.lth.se/gosda/broccoli-library). + +### Robotics Library +To install the whole robotics library to your system run: +``` +sudo apt-add-repository ppa:roblib/ppa +sudo apt-get update +sudo apt-get install librl librl-demos librl-examples +sudo apt-get install librl-dev +sudo apt-get install librl-extras librl-doc librl-dbg + +``` +Official installation instruction can be found [here](https://www.roboticslibrary.org/tutorials/install-ubuntu/). + ## Python Follow the steps to create a virtual environment and install the neccessary dependencies: 1. Create a directory for your virtual environment within the python folder -2. Create a virtual environment running `python3 -m venv /path/to/venv/directory` -3. Activate the virtual environment running `source /path/to/venv/directory/bin/activate` +2. Create a virtual environment running `python3 -m venv ./myvenv` +3. Activate the virtual environment running `source myvenv/bin/activate` 4. Install the dependencies for the abb-egm-client: - Install protoc from protobuf. There are prebuilt binaries available from @@ -76,5 +99,15 @@ pip install -e . 5. Install all other dependencies with `pip install -r requirements.txt` +# Troubles +Compiling the project with cmake runs without errors but when trying to import the python binding the following error appears: +`ImportError: /home/joschua/Coding/forceControl/master-project/c++/build/example.cpython-38-x86_64-linux-gnu.so: undefined symbol: _Z3gpmRN5Eigen6MatrixIdLi6ELi1ELi0ELi6ELi1EEES2_RNS0_IdLi7ELi1ELi0ELi7ELi1EEES4_S4_ddi` +The error can be demangled using an online demangler like [https://demangler.com](https://demangler.com) +The python binding code (the generated *.so file) can be imported by running `import example` within an interactive python session. An official example can be found [here](https://pybind11.readthedocs.io/en/stable/basics.html) + + + + + diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 1170182..54fff60 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -14,15 +14,22 @@ find_package (broccoli 3.0.0 COMPONENTS eigen REQUIRED) find_package(RL COMPONENTS MDL REQUIRED) # find_package(pybind11 CONFIG) +#link_directories(./) - +# Build the C++ program add_executable(myProgram gpm.cpp main.cpp gpm.hpp) - target_link_libraries ( myProgram ${RL_LIBRARIES} eat::broccoli ) +# Build the .so file to import in Python +#add_library(my_gpm SHARED gpm.cpp pybind11_example.cpp) add_subdirectory(deps/pybind11) -pybind11_add_module(example pybind11_example.cpp) \ No newline at end of file +pybind11_add_module(example pybind11_example.cpp) +#target_link_libraries( +# example PUBLIC my_gpm +# ${RL_LIBRARIES} +# eat::broccoli +#) \ No newline at end of file -- GitLab