Required setup : Ubuntu 22.04 LTS
The proposed development builds upon the IgH EtherCAT Master. Installation steps are summarized here:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git autoconf libtool pkg-config make build-essential net-tools
$ git clone https://gitlab.com/etherlab.org/ethercat.git
$ cd ethercat
$ git checkout stable-1.5
$ sudo rm /usr/bin/ethercat
$ sudo rm /etc/init.d/ethercat
$ ./bootstrap # to create the configure script, if downloaded from the repository
$ ./configure --prefix=/usr/local/etherlab --disable-8139too --enable-generic
$ make all modules
$ sudo make modules_install install
$ sudo depmod
$ sudo ln -s /usr/local/etherlab/bin/ethercat /usr/bin/
$ sudo ln -s /usr/local/etherlab/etc/init.d/ethercat /etc/init.d/ethercat
$ sudo mkdir -p /etc/sysconfig
$ sudo cp /usr/local/etherlab/etc/sysconfig/ethercat /etc/sysconfig/ethercat
$ sudo groupadd ecusers
$ sudo usermod -a -G ecusers ${USER}
$ sudo bash -c "echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\", GROUP=\"ecusers\" > /etc/udev/rules.d/99-EtherCAT.rules"
$ sudo vi /etc/sysconfig/ethercat
or
$ sudo gedit /etc/sysconfig/ethercat # If using ubuntu desktop
In the configuration file specify the mac address of the network card to be used and its driver
MASTER0_DEVICE="ff:ff:ff:ff:ff:ff" # mac address
DEVICE_MODULES="generic"
Now you can start the EtherCAT master:
$ sudo /etc/init.d/ethercat start
it should print
Starting EtherCAT master 1.5.2 done
Make sure your current user is member of ecusers
and check connected slaves:
$ ethercat slaves
It should print information of connected slave device. Example,
0 2:0 PREOP + NX-ECC201 EtherCAT coupler V1.2
- Install
ros2
packages. The current developpment is based ofros2 humble
. Installation steps are decribed here. - Source your
ros2
environment:NOTE: The ros2 environment needs to be sources in every used terminal. If only one distribution of ros2 is used, it can be added to thesource /opt/ros/humble/setup.bash
~/.bashrc
file. - Install
colcon
and its extensions :sudo apt install python3-colcon-common-extensions
- Create a new ros2 workspace:
mkdir ~/ros2_ws/src
- Pull relevant packages, install dependencies, compile, and source the workspace by using:
cd ~/ros2_ws git clone https://github.com/ICube-Robotics/ethercat_driver_ros2.git src/ethercat_driver_ros2 rosdep install --ignore-src --from-paths . -y -r colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install source install/setup.bash