Skip to content

Commit

Permalink
Merge pull request #8 from SINTEFMedtek/0.0.7
Browse files Browse the repository at this point in the history
0.0.7
  • Loading branch information
androst authored Feb 1, 2024
2 parents 65a1084 + 4868a8f commit 2ae242a
Show file tree
Hide file tree
Showing 47 changed files with 6,076 additions and 2,701 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build Ubuntu

on:
push:
branches:
- master
- develop
workflow_dispatch:

env:
BUILD_TYPE: Release

jobs:
build:
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-20.04 ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libeigen3-dev \
python3 \
libpython3-dev \
python3-pip \
python3-setuptools
pip install --upgrade pip
pip install patchelf
pip install wheel
pip install auditwheel
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DROMOCC_BUILD_TESTS=ON \
-DROMOCC_BUILD_EXAMPLES=ON \
-DROMOCC_BUILD_PYTHON_BINDINGS=ON \
- name: Build libromocc
run: cmake --build build --config ${{env.BUILD_TYPE}} -j 4

- name: Build pyromocc python wheel
run: cmake --build build --config ${{env.BUILD_TYPE}} --target create_python_wheel

- name: Determine platform
id: determine_platform
run: |
echo platform=$(python3 -c "import distutils.util; print(distutils.util.get_platform().replace('-', '_').replace('.', '_'))") >> $GITHUB_OUTPUT
- name: Auditwheel repair
run: |
auditwheel repair ${{github.workspace}}/build/pyromocc/dist/pyromocc-*.whl --plat ${{ steps.determine_platform.outputs.platform }} -w ${{github.workspace}}/build/pyromocc/dist/wheelhouse
- name: Upload Python wheel
uses: actions/upload-artifact@v4
with:
name: Python wheel
path: ${{github.workspace}}/build/pyromocc/dist/wheelhouse/pyromocc-*.whl
if-no-files-found: error
54 changes: 54 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Windows

on:
push:
branches:
- master
- develop
workflow_dispatch:

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: windows-2019

strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install --upgrade pip
pip install wheel
- name: Configure CMake
run: |
cmake ${{github.workspace}} -B ${{github.workspace}}/build `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DROMOCC_BUILD_TESTS=OFF `
-DROMOCC_BUILD_EXAMPLES=OFF `
-DROMOCC_BUILD_PYTHON_BINDINGS=ON `
- name: Build libromocc
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4

- name: Build pyromocc python wheel
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target create_python_wheel

- name: Upload Python wheel
uses: actions/upload-artifact@v4
with:
name: Python wheel
path: ${{github.workspace}}/build/pyromocc/dist/pyromocc-*.whl
if-no-files-found: error
21 changes: 0 additions & 21 deletions .github/workflows/cmake_build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project(romocc)
# Current version
set (VERSION_MAJOR 0)
set (VERSION_MINOR 0)
set (VERSION_PATCH 3)
set (VERSION_PATCH 7)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

include(cmake/Macros.cmake)
Expand Down
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
libromocc
=========

[![Build badge](https://github.com/SINTEFMedtek/libromocc/workflows/cmake_build.yml/badge.svg?branch=master&event=push)](https://github.com/SINTEFMedtek/libromocc/actions)
[![Build Ubuntu](https://github.com/SINTEFMedtek/libromocc/actions/workflows/build_ubuntu.yml/badge.svg)](https://github.com/SINTEFMedtek/libromocc/actions/workflows/build_ubuntu.yml)
[![Build Windows](https://github.com/SINTEFMedtek/libromocc/actions/workflows/build_windows.yml/badge.svg)](https://github.com/SINTEFMedtek/libromocc/actions/workflows/build_windows.yml)

libromocc is a lightweight C++ library for **ro**bot **mo**delling, **c**ontrol and **c**ommunication. It
also contains Python wrappers with a corresponding PyPI distribution.

### Setup and build
### Core features ###
* **Lightweight inferface**: Simple control of robots from Universal Robots.
* **Robot modelling**: Forward and inverse kinematics, Jacobians, etc.
* **Support for old client interfaces**: Supports the real-time interfaces of Universal Robots, but not the new RTDE interface.
* **Python wrappers**: Python wrappers for core functionality.

### Getting started with Python ###
[![pypi](https://badgen.net/pypi/v/pyromocc)](https://pypi.org/project/pyromocc/)

Pre-built packages are available for Linux and Windows on PyPI. Supports Ubuntu 20.04, 22.04 and Windows 10+(64-bit).
To install the current release:

```bash
pip install pyromocc
```

Once installed, the following shows a simple sample of use:
```python
from pyromocc import Robot

# Connect to robot
robot = Robot(ip="192.168.153.131", port=30003, manipulator="UR5")
robot.connect()

# Print current operational configuration
print(robot.operational_config)

# Move 50 mm upwards
robot.z += 50

# Print current operational configuration
print(robot.operational_config)
```

### Setup and build ###

```bash
git clone https://github.com/SINTEFMedtek/libromocc.git
Expand All @@ -17,7 +52,7 @@ cmake ..
make -j8
```

### Usage
### Usage ###

If you use libromocc in your research and would like to cite the library, we suggest you cite the following conference paper:

Expand All @@ -37,6 +72,6 @@ use under a BSD-2 license. See included licence for more information.
The code base is currently undergoing large changes, thus there is no guarantee that internal interfaces will be stable.


### Contributors
### Contributors ###

libromocc is developed at [SINTEF Digital](http://www.sintef.no), and the work has been partially funded by the Research Council of Norway under grant number 270941.
19 changes: 19 additions & 0 deletions cmake/ExternalCxxOpts.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Download and set up Eigen

include(cmake/Externals.cmake)

ExternalProject_Add(cxxopts
PREFIX ${ROMOCC_EXTERNAL_BUILD_DIR}/cxxopts
BINARY_DIR ${ROMOCC_EXTERNAL_BUILD_DIR}/cxxopts/build
URL "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.1.1.tar.gz"
INSTALL_DIR ${ROMOCC_EXTERNAL_INSTALL_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
-DCMAKE_INSTALL_MESSAGE:BOOL=LAZY
-DCMAKE_INSTALL_PREFIX:STRING=${ROMOCC_EXTERNAL_INSTALL_DIR}
-DBUILD_TESTING:BOOL=OFF
)

list(APPEND ROMOCC_INCLUDE_DIRS ${ROMOCC_EXTERNAL_INSTALL_DIR}/include/cxxopts/)
list(APPEND ROMOCC_EXTERNAL_DEPENDENCIES cxxopts)
2 changes: 1 addition & 1 deletion cmake/ExternalPybind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ExternalProject_Add(
pybind11
PREFIX .
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
GIT_TAG "v2.6.2" # v2.6.2
GIT_TAG "v2.11.1" # v2.11.1
SOURCE_DIR "${CMAKE_BINARY_DIR}/third-party/pybind11"
# Override default steps with no action, we just want the clone step.
CONFIGURE_COMMAND ""
Expand Down
17 changes: 14 additions & 3 deletions cmake/ExternalZeroMQ.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# Download and set up ZeroMQ

include(cmake/Externals.cmake)
set(ZMQ_VERSION "4.3.2")

ExternalProject_Add(zeromq
PREFIX ${ROMOCC_EXTERNAL_BUILD_DIR}/zeromq
BINARY_DIR ${ROMOCC_EXTERNAL_BUILD_DIR}/zeromq
GIT_REPOSITORY "https://github.com/zeromq/libzmq.git"
GIT_TAG "v4.3.2"
GIT_TAG "v${ZMQ_VERSION}"
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_INSTALL_PREFIX:PATH=${ROMOCC_EXTERNAL_INSTALL_DIR}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_STATIC_LIBS=ON
-DBUILD_PACKAGING=OFF
-DBUILD_TESTING=OFF
-DBUILD_TESTS=OFF
-DBUILD_NC_TESTS=OFF
-DBUILD_CONFIG_TESTS=OFF
-DINSTALL_HEADERS=ON
)

list(APPEND ROMOCC_INCLUDE_DIRS ${ROMOCC_EXTERNAL_INSTALL_DIR}/include/)
list(APPEND LIBRARIES zmq)

if(WIN32)
string(REPLACE "." "_" ZMQ_VERSION_US ${ZMQ_VERSION})
set(ZMQ_LIBRARY
"libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-${ZMQ_VERSION_US}"
"libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-s-${ZMQ_VERSION_US}")
else(WIN32)
set(ZMQ_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}zmq${CMAKE_SHARED_LIBRARY_SUFFIX})
endif(WIN32)

list(APPEND LIBRARIES ${ZMQ_LIBRARY})
list(APPEND ROMOCC_EXTERNAL_DEPENDENCIES zeromq)
36 changes: 21 additions & 15 deletions cmake/InstallRomocc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,44 @@
# Install romocc library
if(WIN32)
# DLL should be in binary folder
install(TARGETS romocc
DESTINATION libromocc/bin
)
install(TARGETS romocc
DESTINATION libromocc/bin
COMPONENT romocc
)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION libromocc/bin)
include(InstallRequiredSystemLibraries) # Install vcruntime dlls
else()
install(TARGETS romocc
DESTINATION libromocc/lib
)
install(TARGETS romocc
DESTINATION libromocc/lib
COMPONENT romocc
)
endif()

if(ROMOCC_BUILD_TESTS)
# Install test executable
install(TARGETS testROMOCC
DESTINATION libromocc/bin
)
COMPONENT romocc
)
endif()

# Examples are installed in the macro project_add_example

# Install dependency libraries
install(FILES ${PROJECT_BINARY_DIR}/romoccExport.hpp
DESTINATION libromocc/include
COMPONENT romocc
)

if(WIN32)
file(GLOB DLLs ${PROJECT_BINARY_DIR}/bin/*.dll)
install(FILES ${DLLs}
DESTINATION libromocc/bin
)
file(GLOB DLLs ${PROJECT_BINARY_DIR}/lib/*.lib)
install(FILES ${DLLs}
DESTINATION libromocc/lib
)
install(DIRECTORY ${PROJECT_BINARY_DIR}/bin/
DESTINATION libromocc/bin/
COMPONENT romocc
FILES_MATCHING PATTERN "*.dll")
install(DIRECTORY ${PROJECT_BINARY_DIR}/lib/
DESTINATION libromocc/lib/
COMPONENT romocc
FILES_MATCHING PATTERN "*.lib")
elseif(APPLE)
file(GLOB SOs ${PROJECT_BINARY_DIR}/lib/*.dylib)
install(FILES ${SOs}
Expand Down
7 changes: 6 additions & 1 deletion cmake/Requirements.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# Setup all dependencies, both internal (have to be installed on the system)
# and external (downloaded and built automatically)

list(APPEND SYSTEM_LIBRARIES pthread)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
find_package(Threads REQUIRED)
list(APPEND SYSTEM_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif()

## External depedencies
include(cmake/ExternalEigen.cmake)
include(cmake/ExternalOrocos.cmake)
include(cmake/ExternalZeroMQ.cmake)
include(cmake/ExternalCxxOpts.cmake)

if(ROMOCC_BUILD_URSIMULATOR)
include(cmake/ExternalURSimulator.cmake)
endif()

if(ROMOCC_BUILD_PYTHON_BINDINGS)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
endif()

Expand Down
5 changes: 5 additions & 0 deletions cmake/RomoccConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ set(ROMOCC_LIBRARIES
zmq
${X11_LIBRARIES}
)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
list(APPEND ROMOCC_LIBRARIES pthread)
endif()

set(ROMOCC_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/RomoccUse.cmake")

message("----------------------------------------")
Expand Down
Loading

0 comments on commit 2ae242a

Please sign in to comment.