Git Product home page Git Product logo

robotic's Introduction

Robotic Control Interface & Manipulation Planning Library

A python library to operate a real or simulated robot, work with robot/world configurations, compute differentiable features, formulate and solve constrained optimization problems (for inverse kinematics, path optimization, and manipulation planning), and interfacing to various physical simulation engines.

These python bindings were developed for easier access to the uderlying C++ code base, esp. for teaching and students. This code base is how we (in the Learning & Intelligent Systems Lab) operate our robots.

Installation via pip (simulation only, no real Franka & realsense support)

  • The pip package was compiled for python3.6 .. 3.11, and most of the dependencies statically linked. A few are still loaded dynamically, which requires installing on Ubuntu:
sudo apt install liblapack3 freeglut3 libglew-dev python3 python3-pip
  • pip-install robotic
pip install robotic
  • Tests:
ry-info
python3 -c 'import robotic as ry; ry.test.RndScene()'
ry-view `python3 -m site --user-site`/robotic/rai-robotModels/scenarios/pandaSingle.g
  • Run all tutorial notebooks as a test and showcase (takes long):
pip install jupyter nbconvert matplotlib
git clone https://github.com/MarcToussaint/rai-tutorials.git
cd rai-tutorials
make run -j1
``


## Installation from source with real Franka & realsense support

This assumes a standard Ubuntu 22.04 (or 20.04, 18.04) machine.

* Install Ubuntu and python packages:

      sudo apt install --yes \
        g++ clang make gnupg cmake git wget \
        liblapack-dev libf2c2-dev libqhull-dev libeigen3-dev libann-dev libccd-dev \
        libjsoncpp-dev libyaml-cpp-dev libhdf5-dev libpoco-dev libboost-system-dev portaudio19-dev libusb-1.0-0-dev \
        libx11-dev libglu1-mesa-dev libglfw3-dev libglew-dev freeglut3-dev libpng-dev libassimp-dev \
        python3-dev python3 python3-pip
      
      python3 -m pip install --user numpy pybind11 pybind11-stubgen

* Install some external libs by source. You can skip librealsense and
  libfranka if you disable below. (To speed up compilation, e.g., set

      export MAKEFLAGS="-j $(command nproc --ignore 2)"
  
  To standardize installations, I use a basic script:

      wget https://github.com/MarcToussaint/rai-extern/raw/main/install.sh; chmod a+x install.sh
      ./install.sh fcl
      ./install.sh physx
      ./install.sh librealsense
      ./install.sh libfranka  ## for OLD frankas instead:   ./install.sh -v 0.7.1 libfranka

* Clone, compile and install this repo (note the USE_REALSENSE and USE_LIBFRANKA options!):

      cd $HOME/git
      git clone --recursive https://github.com/MarcToussaint/robotic.git
      cd robotic
      cp _build_utils/CMakeLists-ubuntu.txt CMakeLists.txt
      export PY_VERSION=`python3 -c "import sys; print(str(sys.version_info[0])+'.'+str(sys.version_info[1]))"`
      cmake -DPY_VERSION=$PY_VERSION -DUSE_REALSENSE=ON -DUSE_LIBFRANKA=ON . -B build
      make -C build _robotic install

  (Docstrings could be made with `make docstrings`, but this is not yet robust across distributions.)

* This should install everything in .local/lib/python*/site-packages/robotic. Test:

      cd $HOME
      python3 -c 'import robotic as ry; print("ry version:", ry.__version__, ry.compiled());'
      python3 -c 'import robotic as ry; ry.test.RndScene()'

* Recall that the user needs to be part of the `realtime` and `dialout` unix group:

      sudo usermod -a -G realtime <username>
      sudo usermod -a -G dialout <username>

  You need to log out and back in (or even reboot) for this to take
  effect. Check with `groups` in a terminal.

* Follow the [Real Robot Operation Tutorial](https://marctoussaint.github.io/robotic/tutorials/botop_2_real_robot.html) on the [tutorials page](https://marctoussaint.github.io/robotic/tutorials.html) to test and debug first steps with the real franka.

## Building the wheels within a manylinux docker

* Build the docker

_build_utils/build-docker.sh


* Compile wheels (this runs `local/_build_utils/build-wheels.sh`
inside the docker -- see `Makefile`)

make wheels


* Outside of docker, install locally with pip or push wheels to pypi

python3.8 -m pip install --user dist/robotic-cp38.whl --force-reinstall python3.10 -m pip install --user dist/robotic-cp310.whl --force-reinstall

or

twine upload dist/*.whl --repository robotic



<!--
## Use of the wheel binary in C++

* Get the binary lib by installing the pip package:

python3 -m pip install --user robotic

* Get the sources by cloning this repo recursively:

cd $HOME/git; git clone --recursive https://github.com/MarcToussaint/robotic.git

* Copy things into an include and link folder (like 'make install') CHANGE PYTHON VERSION:

mkdir -p $HOME/opt/include/rai $HOME/opt/lib cp $HOME/.local/lib/python3.6/site-packages/robotic/_robotic.so -f $HOME/opt/lib/libry.cpython-36m-x86_64-linux-gnu.so cp $HOME/git/robotic/rai/rai/* -Rf $HOME/opt/include/rai cp $HOME/git/robotic/botop/src/* -Rf $HOME/opt/include/rai

* Compile your main

gcc script2-IK.cpp -I$HOME/opt/include/rai -L$HOME/opt/lib -lry.cpython-36m-x86_64-linux-gnu -lstdc++ python3-config --ldflags

-->

robotic's People

Contributors

marctoussaint avatar whoenig avatar

Stargazers

Kwangki Kim avatar Ahmed Zermane avatar Makoto Sato avatar  avatar Baby Commando (JP) avatar Chen Yiting avatar  avatar  avatar Yujeong Jeong avatar  avatar Jeff Carpenter avatar Shirokuma (k tanaka) avatar Akash Jinandra avatar zzh avatar  avatar Hirokazu Ishida avatar Koki Shinjo avatar Shingo Kitagawa avatar  avatar Young avatar TangYu avatar Rosa avatar Wen_Youpeng avatar Juzhan avatar  avatar GE YAN avatar Neil Wang avatar Jung Yeon Lee avatar Lara Brudermüller avatar  avatar tkp153 avatar Damian Robert avatar Blackbird avatar  avatar Dongyu Yan avatar Rodrigo Pérez Dattari avatar robert kovacs avatar  avatar Schortenger avatar Tri Bien avatar taegyun ahn avatar  avatar Karan Muvvala avatar Trevor Ablett avatar Yulei Qiu avatar Yipai Du avatar Davide Torielli avatar  avatar Alex Mitrevski avatar Hongwei Fan avatar Ruolin Ye avatar Cornelius V. Braun avatar Ceren Erkut avatar  avatar Deniz Aydemir avatar Hiroto avatar Hejia Zhang avatar  avatar  avatar  avatar Yichen Li avatar Andrew Messing avatar Min-Sung Yoon avatar Joseph Zhou avatar Belal Hmedan avatar Jad Abou-Chakra avatar Suhan Park avatar Lei Xu avatar  avatar Wenqiang Xu avatar Ben Agro avatar Paarth Shah avatar An Thai Le avatar AlbertMiao avatar Taicheng Huang avatar Hao Chen avatar Michael avatar Sui Libin avatar danfei avatar  avatar Brandon Amos avatar Hany Hamed avatar Zhiao Huang avatar  avatar Natalia Díaz Rodríguez avatar Jerry Zhi-Yang He avatar  avatar Laura Oberländer avatar Kyungjae Lee avatar David Jablonski avatar  avatar Andreas Doering avatar Mohit Shridhar avatar Philipp Kratzer avatar Andrew Melnik avatar Konstantinos Chatzilygeroudis avatar Caelan Garrett avatar

Watchers

 avatar James Cloos avatar Igor Brylyov avatar Ratnesh Madaan avatar  avatar Ruolin Ye avatar Philipp Kratzer avatar Andrew Melnik avatar  avatar

robotic's Issues

Creating a setup.py for rai

Is there a way that this python package installation can be done via a 'setup.py' file?
I faced too many issues which I solved using sourcing too many things in the .bashrc file.

PR2 demos?

Hi Marc,

I looked at your rai stack(s) a few years back and was really impressed back then by a LGP demonstration where a PR2 was tasked to move a number of objects from one table to a different table area, carrying at most one object in each gripper.
I remember a number of visualization windows popped up for the different considered task skeletons.
I looked for the same code again today, but could not find it anymore.
Am I looking in the wrong place?

bindinds for creating KOMO instances are missing

The notebooks do not run as expected as attributes such as ry.Config.komo_path cannot be found. The corresponding bindings have been removed in commit 7d9ac of rai which is only present on the (stale) branches marc and torch_integration. However, rai-python references commit 7d1fe of RAI which includes said commit removing the komo*-bindinds.

This causes shared objects built from this branch to not have those methods. Is it possible to add them back in and/or to synchronize the Python bindinds with RAI's master again?

3-IK-optimization

I encountered a problem in 3-IK-optimization module in jupyet-notebook where it calls the command IK.optimize(). The error message says 'libry.KOMO' object has no attribute 'optimize', and it also doesn't seem to be included in rai python API. It would be great if you can provide me with any solution to this.

Simulated camera crashes when config contains markers

Hello,

during our code upgrade to robotic v0.1.3 we encoutered a bug when using the robot's camera in the simulated mode. When we add a custom marker to the config and try to get an image with bot.getImageAndDepth(), the program crashes with a segmentation fault.

Minimal example:

import robotic
assert robotic.__version__ == '0.1.3'

config = robotic.Config()
config.addFile(robotic.raiPath("../rai-robotModels/scenarios/pandaSingle.g"))

frame = config.addFrame('myTestFrame')
frame.setShape(type=robotic.ST.marker, size=[0.3]) # <-- Marker

bot = robotic.BotOp(config, useRealRobot=False)
bot.getImageAndDepth('cameraWrist')

If we set the shape to a cylinder instead with frame.setShape(type=robotic.ST.cylinder, size=[0.3, 0.05]), the program does't crash.

We replicated the problem at the lab pc using the simulation and had the same outcome. However, the program works when we use the real robot. Also, we tested this once with and without a rai.cfg present in the workspace directory, but this also didn't change anything either. I suspect it is a bug in the C++ rai implementation.

LGP support is retired?

Hi,

It seems current version of code does not support LGP? related code is either annotated or in retired directory. Is there any plan to add it back? or how can we use the LGP? with C++ only?

Thanks!

Installation issues

First of all, thanks a lot for providing this library which seems quite sophisticated according to the related videos.
Unfortunately, I run into issues when installing rai-python on Ubuntu 18.04.

This is what I did.
First, I installed OpenCV, Bullet and PhysX from source according to:
https://github.com/MarcToussaint/rai-maintenance/blob/master/help/localSourceInstalls.md

The rai-python installation failed related to ceres-solver, so in addition, I installed GLOG from source according to:
https://github.com/google/glog#building-glog-with-cmake

The output of the sudo make install is:

[sudo] password for ndehio:
[ 36%] Built target glog
[ 45%] Built target signalhandler_unittest
[ 54%] Built target stl_logging_unittest
[ 63%] Built target stacktrace_unittest
[ 72%] Built target demangle_unittest
[ 81%] Built target logging_unittest
[ 90%] Built target symbolize_unittest
[100%] Built target utilities_unittest
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libglog.a
-- Installing: /usr/local/include/glog/logging.h
-- Installing: /usr/local/include/glog/raw_logging.h
-- Installing: /usr/local/include/glog/stl_logging.h
-- Installing: /usr/local/include/glog/vlog_is_on.h
-- Installing: /usr/local/include/glog/log_severity.h
-- Installing: /usr/local/lib/pkgconfig/libglog.pc
-- Installing: /usr/local/lib/cmake/glog/glog-modules.cmake
-- Installing: /usr/local/lib/cmake/glog/glog-config.cmake
-- Installing: /usr/local/lib/cmake/glog/glog-config-version.cmake
-- Installing: /usr/local/lib/cmake/glog/glog-targets.cmake
-- Installing: /usr/local/lib/cmake/glog/glog-targets-noconfig.cmake

Next, I installed Ceres-Solver from source according to:
http://ceres-solver.org/installation.html

Then, I downloaded rai-python again, set ROS_VERSION = melodic in config.mk and followed the installation instructions.
Unfortunately, make still fails.

g++: error: /usr/lib/x86_64-linux-gnu/libgflags.so.2.2.1: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libglog.so: No such file or directory

The ceres-solver website mentions an issue related to gflag. Do I need to take care of this?
Or should I install gflags, glog and ceres like this?

sudo apt-get install libgflags-dev
sudo apt-get install libgoogle-glog-dev
sudo apt-get install libceres-dev

I also encountered similar problems for
https://github.com/MarcToussaint/20-IROS-ForceBased
and
https://github.com/MarcToussaint/18-RSS-PhysicalManipulation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.