ihmcrobotics / ihmc-ethercat-master

Java EtherCAT master based on the SOEM EtherCAT master
Apache License 2.0
21 stars 14 forks source link

IHMC EtherCAT Master

ihmc-ethercat-master buildstatus buildstatus buildstatus

This package provides a lightweight java wrapper around SOEM (https://github.com/OpenEtherCATsociety/SOEM) and provides an Object Orientated interface to the EtherCAT master.

Extra functionality built on top of SOEM includes

Usage

Supported operating systems

The IHMC EtherCAT master has a native component that is currently compiled for Linux only.

Gradle

Add the IHMC EtherCAT Master as dependency

repositories {
    maven {
        url  "http://dl.bintray.com/ihmcrobotics/maven-release"
    }
}

dependencies {
    compile group: 'us.ihmc', name: 'ihmc-ethercat-master', version: '0.11.2'
}

Examples

Example code is provided in us.ihmc.etherCAT.examples.

Supported slaves

All conforming EtherCAT slaves should work with this wrapper. Slave code has been provided for several devices, including

General slave code provided

Custom slave code is straightforward to implement based on provided slave examples.

Slave information

To show the slaves available on the bus the provided class us.ihmc.etherCAT.master.SlaveInfo can be used.

License

Copyright 2021 Florida Institute for Human and Machine Cognition (IHMC)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Compiling

This library is split up in two parts, the C library with SWIG wrapper and the actual Java library. They need to be compiled independently. SOEM needs to be compiled with position independent code enabled, otherwise a shared JNI library cannot be build.

Installing SOEM

The Halodi Robotics PPA has a debian package of SOEM that is compatible with this library. Install it using

sudo add-apt-repository ppa:halodirobotics/ppa
sudo apt update
sudo apt install soem

(Optional, not recommended) Compiling SOEM

~Clone SOEM from https://github.com/OpenEtherCATsociety/SOEM~

~Optionally, use switch to the same version as used to compile the maven libraries~

Note that in order to build a shared JNI library, you have to enable position independent code for SOEM. Use the following commands to build and install the SOEM library

cd SOEM
mkdir build
cd build
cmake -DHOST_INSTALL="" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_POSITION_INDEPENDENT_CODE=true -DCMAKE_BUILD_TYPE=Release ..
make
make install

Compiling C library and SWIG wrapper

Requirements

A gradle wrapper is provided, optionally you can use your system gradle by replacing "./gradlew" with gradle.

The gradle build files for the SOEM wrapper and native libraries are created by cmake, based on the input files in swig/build.gradle.kts.in and swig/settings.gradle.kts.in. After running cmake and make, the gradle build is exectud from the build directory. This is done to split the GPL+linking exception licenced SOEM from the Apache 2.0 licensed IHMC-ethercat-master.

To build and publish run the following commands. Note that the gradle commands are ran from within the build directory.

Note that if you want to publish multiple platform libraries you only have to run target=JAVA on a single platform

Compiling Java library

Compiling with Docker

Run ./buildWithDocker.sh

The Docker image is hosted at [https://hub.docker.com/r/ihmcrobotics/ethercat-master]().

If changes to the Dockerfile are needed, build it with the following command, incrementing the version. Then, increment the version in the buildWithDocker.sh file before running.

# docker build --tag ihmcrobotics/ethercat-master:0.X .
# docker rm ethercat-master

For more about IHMC Robotics's usage of Docker, see [https://github.com/ihmcrobotics/ihmc-open-robotics-software/tree/develop/docker]().