Skip to content

Commit

Permalink
v25 - big cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcToussaint committed Oct 25, 2023
1 parent 529d2ee commit b1c6761
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 67 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ dist/
robotic.egg-info/
rai-robotModels
ry.pyi
build_wheel/

%% compile temporaries
/build
build/
*.o
*.a
*.so
Expand Down
43 changes: 41 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
default: docs

docs:
cd rai-docs && sphinx-build doc ../html

clean:
rm -Rf build
docs-clean:
rm -Rf html

install:
ln -f -s _build_utils/CMakeLists-ubuntu.txt CMakeLists.txt
cmake -B build .
+cmake --install build

install-clean:
rm -R ${HOME}/.local/lib/python3.8/site-packages/robotic*
rm ${HOME}/.local/lib/*rai*
rm ${HOME}/.local/bin/*ry*

wheels:
$(eval id = $(shell _build_utils/run-docker.sh -d))
@echo "started docker " ${id}
docker exec -it ${id} /bin/bash -C local/_build_utils/build-wheels.sh
docker stop ${id}
# _build_utils/run-docker.sh local/_build_utils/build-wheels.sh

wheels-push:
twine upload dist/*.whl --repository robotic

wheels-local:
python3.8 -m pip install --user dist/robotic-*cp38*.whl --force-reinstall

test:
cd ${HOME} && python3 -c 'from robotic import ry; print("ry version:", ry.__version__, ry.compiled());'

pull:
cd rai && git pull
cd rai-robotModels && git pull
cd rai-docs && git pull
cd botop && git pull

docker-clean:
$(shell docker container kill "$(docker container ls -q)")
docker system prune

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Lab](https://argmin.lis.tu-berlin.de/), operate our robots.

## Documentation

Please follow the documentation and tutorials here: https://marctoussaint.github.io/robotics-course/
Please follow the documentation and tutorials here: https://marctoussaint.github.io/robotic/

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

Expand All @@ -24,11 +24,13 @@ sudo apt install liblapack3 freeglut3 libglew-dev python3 python3-pip
```
* pip-install robotic and dependencies (numpy, scipy)
```
python3 -m pip install --user robotic numpy scipy
pip install robotic
```
* Test:
* Tests:
```
python3 -c 'from robotic import ry; print("ry version:", ry.__version__, ry.compiled());'
```
```
python3 -c 'from robotic import ry; ry.test.RndScene()'
```
<!--
Expand Down Expand Up @@ -90,7 +92,6 @@ python3 -c 'from robotic import ry; print("ry version:", ry.__version__, ry.comp
python3 -c 'from robotic import ry; ry.test.RndScene()'
```


## Building a wheel within a manylinux docker

* Build the docker
Expand All @@ -102,7 +103,7 @@ _build_utils/build-docker.sh
```
_build_utils/run-docker.sh
## inside docker:
cd local #this mounts rai-python/
cd local #this mounts robotic/
_build_utils/build-wheels.sh
exit
```
Expand Down
34 changes: 17 additions & 17 deletions _build_utils/CMakeLists-docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ add_definitions(
################################################################################

include_directories(
rai/rai
rai/src
botop/src
/usr/local/include/eigen3
/usr/include/eigen3
Expand All @@ -58,10 +58,10 @@ link_directories(
$ENV{HOME}/.local/lib
)

file(GLOB SRC_GeoGJK rai/rai/Geo/GJK/*.c)
file(GLOB SRC_GeoPly rai/rai/Geo/ply/*.c)
file(GLOB SRC_GeoCcd rai/rai/Geo/ccd_rai/*.c)
file(GLOB SRC_GeoLewiner rai/rai/Geo/Lewiner/*.cpp)
file(GLOB SRC_GeoGJK rai/src/Geo/GJK/*.c)
file(GLOB SRC_GeoPly rai/src/Geo/ply/*.c)
file(GLOB SRC_GeoCcd rai/src/Geo/ccd_rai/*.c)
file(GLOB SRC_GeoLewiner rai/src/Geo/Lewiner/*.cpp)

file(GLOB SRC_BotOp botop/src/BotOp/*.cpp)
file(GLOB SRC_Franka botop/src/Franka/*.cpp)
Expand All @@ -71,21 +71,21 @@ file(GLOB SRC_Robotiq botop/src/Robotiq/*.cpp)
file(GLOB SRC_Audio botop/src/Audio/*.cpp)

add_library(rai STATIC
rai/rai/Core/unity.cxx
rai/rai/Optim/unity.cxx
rai/rai/Geo/unity.cxx
rai/src/Core/unity.cxx
rai/src/Optim/unity.cxx
rai/src/Geo/unity.cxx
${SRC_GeoGJK}
${SRC_GeoPly}
${SRC_GeoCcd}
${SRC_GeoLewiner}
rai/rai/Algo/unity.cxx
rai/rai/Search/unity.cxx
rai/rai/PathAlgos/unity.cxx
rai/rai/Gui/unity.cxx
rai/rai/Kin/unity.cxx
rai/rai/KOMO/unity.cxx
rai/rai/Logic/unity.cxx
rai/rai/Control/unity.cxx
rai/src/Algo/unity.cxx
rai/src/Search/unity.cxx
rai/src/PathAlgos/unity.cxx
rai/src/Gui/unity.cxx
rai/src/Kin/unity.cxx
rai/src/KOMO/unity.cxx
rai/src/Logic/unity.cxx
rai/src/Control/unity.cxx
${SRC_BotOp}
${SRC_Franka}
${SRC_OptiTrack}
Expand Down Expand Up @@ -151,7 +151,7 @@ if(USE_PYBIND)
add_definitions(-DRAI_PYBIND)

pybind11_add_module(ry SHARED
rai/rai/ry/unity.cxx
rai/src/ry/unity.cxx
botop/src/BotOp/pyBot.cxx
)

Expand Down
41 changes: 21 additions & 20 deletions _build_utils/CMakeLists-ubuntu.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)

project(RaiPython)
project(RoboticPython)

## first time call: generate unity sources
if(NOT DEFINED CMAKE_CACHE_MAJOR_VERSION)
Expand Down Expand Up @@ -46,7 +46,7 @@ add_definitions(
################################################################################

include_directories(
rai/rai
rai/src
botop/src
/usr/include/eigen3
$ENV{HOME}/.local/include
Expand All @@ -57,10 +57,10 @@ link_directories(
$ENV{HOME}/.local/lib/PhysX
)

file(GLOB SRC_GeoGJK rai/rai/Geo/GJK/*.c)
file(GLOB SRC_GeoPly rai/rai/Geo/ply/*.c)
file(GLOB SRC_GeoCcd rai/rai/Geo/ccd_rai/*.c)
file(GLOB SRC_GeoLewiner rai/rai/Geo/Lewiner/*.cpp)
file(GLOB SRC_GeoGJK rai/src/Geo/GJK/*.c)
file(GLOB SRC_GeoPly rai/src/Geo/ply/*.c)
file(GLOB SRC_GeoCcd rai/src/Geo/ccd_rai/*.c)
file(GLOB SRC_GeoLewiner rai/src/Geo/Lewiner/*.cpp)

file(GLOB SRC_BotOp botop/src/BotOp/*.cpp)
file(GLOB SRC_Franka botop/src/Franka/*.cpp)
Expand All @@ -70,21 +70,21 @@ file(GLOB SRC_Robotiq botop/src/Robotiq/*.cpp)
file(GLOB SRC_Audio botop/src/Audio/*.cpp)

add_library(rai SHARED
rai/rai/Core/unity.cxx
rai/rai/Optim/unity.cxx
rai/rai/Geo/unity.cxx
rai/src/Core/unity.cxx
rai/src/Optim/unity.cxx
rai/src/Geo/unity.cxx
${SRC_GeoGJK}
${SRC_GeoPly}
${SRC_GeoCcd}
${SRC_GeoLewiner}
rai/rai/Algo/unity.cxx
rai/rai/Search/unity.cxx
rai/rai/PathAlgos/unity.cxx
rai/rai/Gui/unity.cxx
rai/rai/Kin/unity.cxx
rai/rai/KOMO/unity.cxx
rai/rai/Logic/unity.cxx
rai/rai/Control/unity.cxx
rai/src/Algo/unity.cxx
rai/src/Search/unity.cxx
rai/src/PathAlgos/unity.cxx
rai/src/Gui/unity.cxx
rai/src/Kin/unity.cxx
rai/src/KOMO/unity.cxx
rai/src/Logic/unity.cxx
rai/src/Control/unity.cxx
${SRC_BotOp}
${SRC_Franka}
${SRC_OptiTrack}
Expand Down Expand Up @@ -163,7 +163,7 @@ if(USE_PYBIND)
include_directories(${pybind11_INCLUDE_DIRS})

pybind11_add_module(ry SHARED
rai/rai/ry/unity.cxx
rai/src/ry/unity.cxx
botop/src/BotOp/pyBot.cxx
)

Expand Down Expand Up @@ -206,7 +206,7 @@ target_link_libraries(bot rai)

set(PYTHON_SITE "lib/python${PYBIND11_PYTHON_VERSION}/site-packages")

message(STATUS "[rai] installing in python path " ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE}/robotic )
message(STATUS "[rai] installing python packages in " ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE}/robotic )

install(
TARGETS ry
Expand All @@ -222,7 +222,8 @@ install(

install(
TARGETS rai
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
COMPONENT pkgconfig)

install(
TARGETS kinEdit meshTool bot
Expand Down
1 change: 1 addition & 0 deletions _build_utils/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN python3.7 -m pip install pybind11 pybind11-stubgen==0.16.2 numpy
RUN python3.8 -m pip install pybind11 pybind11-stubgen==0.16.2 numpy
RUN python3.9 -m pip install pybind11 pybind11-stubgen==0.16.2 numpy
RUN python3.10 -m pip install pybind11 pybind11-stubgen==0.16.2 numpy
RUN python3.11 -m pip install pybind11 pybind11-stubgen==0.16.2 numpy

##########################################################

Expand Down
27 changes: 14 additions & 13 deletions _build_utils/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#/bin/sh

rm -f CMakeLists.txt
ln -s _build_utils/CMakeLists-docker.txt CMakeLists.txt
mkdir -p build
cd $HOME/local
ln -f -s _build_utils/CMakeLists-docker.txt CMakeLists.txt

### delete old
rm -Rf robotic/*ry.* robotic/*~ robotic/__pycache__ dist/ build/bdist* build/lib robotic.egg-info
### delete setup temp files
rm -Rf robotic/*ry.* robotic/__pycache__ dist/ build/bdist* build/lib robotic.egg-info

### copy robotModels files
cd robotic
Expand All @@ -15,7 +14,7 @@ cd rai-robotModels
mkdir -p objects; cp ../../rai-robotModels/objects/*.g objects
mkdir -p panda; cp ../../rai-robotModels/panda/*.g panda; cp -R ../../rai-robotModels/panda/*_description panda
mkdir -p ur10; cp ../../rai-robotModels/ur10/*.g ur10; cp -R ../../rai-robotModels/ur10/*_description ur10
mkdir -p pr2; cp ../../rai-robotModels/pr2/*.g pr2; cp -R ../../rai-robotModels/pr2/meshes pr2
mkdir -p pr2; cp ../../rai-robotModels/pr2/*.g pr2; cp -R ../../rai-robotModels/pr2/*_description pr2
mkdir -p baxter; cp ../../rai-robotModels/baxter/*.g baxter; cp -R ../../rai-robotModels/baxter/*_description baxter
mkdir -p robotiq; cp ../../rai-robotModels/robotiq/*.g robotiq; cp -R ../../rai-robotModels/robotiq/meshes robotiq
mkdir -p scenarios; cp ../../rai-robotModels/scenarios/*.g scenarios
Expand All @@ -25,24 +24,26 @@ cd ../..
export PYTHONPATH=.

### build each version
for ver in 8 9 10 6 7; do
for ver in 8 9 10 11 6 7; do
echo -e "\n\n======== compiling (python version " $ver ") ========"
cd build
cmake -DPYBIND11_PYTHON_VERSION=3.$ver .. && make ry
cmake -B build_wheel -DPYBIND11_PYTHON_VERSION=3.$ver .
cd build_wheel
make ry
strip --strip-unneeded ry.*3$ver*.so
echo -e "\n\n======== documenting (python version " $ver ") ========"
/opt/_internal/cpython-3.$ver.*/bin/pybind11-stubgen ry
cd ..
echo -e "\n\n======== build wheel (python version " $ver ") ========"
cp -f build/ry.*3$ver*.so robotic/ry.so
cp -f build/stubs/ry*/__init__.pyi robotic/ry.pyi
cp -f build_wheel/ry.*3$ver*.so robotic/ry.so
cp -f build_wheel/stubs/ry*/__init__.pyi robotic/ry.pyi
python3.$ver setup.py bdist_wheel
#break
done

### delete setup temp files
rm -Rf robotic/*ry.* robotic/__pycache__ build/bdist* build/lib robotic.egg-info

echo -e "\n\n======== renaming wheels ========"
for wheel in $(find dist -iname "*.whl") ; do
mv $wheel $(echo $wheel | sed 's/-linux_/-manylinux2014_/')
done

#twine upload dist/*.whl
12 changes: 6 additions & 6 deletions _build_utils/run-docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#/bin/sh

thispath=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)
thispath="$(dirname "$(realpath "$0")")"

# #see http://wiki.ros.org/docker/Tutorials/GUI
# #https://stackoverflow.com/questions/16296753/can-you-run-gui-apps-in-a-docker-container
Expand All @@ -11,22 +11,22 @@ thispath=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)
# xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH # # nmerge -
# chmod 755 $XAUTH

xhost +local:root
xhost +local:root > /dev/null

docker run -it \
docker run -it $1 \
--volume="$thispath/..:/root/local" \
--volume="$HOME/:/root/home" \
--volume="$HOME:/root/home" \
--volume="$thispath/docker.bashrc:/root/.bash_aliases" \
--volume="$HOME/.gitconfig:/root/.gitconfig:ro" \
--volume="$HOME/.ssh:/root/.ssh:ro" \
--env="DISPLAY" \
--network host \
--device /dev/input \
--device /dev/dri \
rai-manylinux /bin/bash -C $1
rai-manylinux /bin/bash

# -v $XSOCK:$XSOCK \
# -v $XAUTH:$XAUTH \
# -e XAUTHORITY=$XAUTH \

xhost -local:root
xhost -local:root > /dev/null
2 changes: 1 addition & 1 deletion rai
Submodule rai updated 726 files
2 changes: 1 addition & 1 deletion robotic/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.24'
__version__ = '0.0.25'
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ def has_ext_modules(foo):
long_description=long_description,
long_description_content_type="text/markdown",

install_requires=[ 'numpy' ],

distclass=BinaryDistribution,
version=myversion['__version__'],
url='https://github.com/MarcToussaint/rai-python/',
url='https://github.com/MarcToussaint/robotic/',
author='Marc Toussaint',
author_email='[email protected]',
)

0 comments on commit b1c6761

Please sign in to comment.