The ROS-CODESYS Bridge π
A ROS-CODESYS shared memory bridge to map CODESYS variables to ROS topics.
This bridge is the result of the ROBIN project, a Focused Technical Project (FTP) of the ROSIN European project.
The bridge is made up of two components:
The following IEC 61131-3 data types are currently supported:
As well as arrays and custom structs. The following standard ROS message packages are already defined as CODESYS structs and available on the Robin CODESYS library:
These variables have to be defined on both the CODESYS project and the ROS package. For arrays or for structs with string or array members, because these data types are handled as non-POD (Plain Old Data) objects in C++, the mapping between the C++ variables and the ROS messages has to be explicitly defined. However, an updater application was developed to automate most of this process. The user simply needs to define its desired variables on the CODESYS project and run the updater.
Ubuntu 18.04/16.04 system (may work on other distros as well) with:
Windows system with:
Install CODESYS library:
Create catkin workspace (if non-existent):
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin_make # or 'catkin build'
source ~/catkin_ws/devel/setup.bash
Clone repository into catkin workspace (eg. ~/catkin_ws):
cd ~/catkin_ws/src
git clone https://github.com/ScalABLE40/robin
Install updater package dependencies:
rosdep install robin_updater
Compile bridge package:
cd ~/catkin_ws
catkin_make robin # or 'catkin build robin'
Create CODESYS project. You can either:
Create your own project and add the Robin library to it.
Create a new empty project and import the example project from codesys_project.xml.
Variable length arrays are only partially supported in CODESYS. To make the updater interpret a regular fixed length array as a ROS variable length array, preceed its declaration with the line: {attribute 'robin_var_len'}
.
Make sure you can establish connection with the PLC. Go to the Devices tree, double click the Device and then:
Scan Network... for your PLC device.
Or add it manually Device->Options->Manage Favourite Devices...
Go to Windows Search Bar->Services and make sure Windows OpenSSH Authentication Agent service is running (Startup type: Automatic).
Run the updater application:
Launch the robin ROS node. Will restart codesyscontrol service and then launch the node:
To avoid having to manually restart codesyscontrol after each update run:
echo "$USER ALL=(ALL:ALL) NOPASSWD: /bin/systemctl * codesyscontrol" | sudo EDITOR="tee" visudo -f /etc/sudoers.d/allow_restart_codesyscontrol
This will allow the command systemctl start/stop codesyscontrol
to be run with sudo
without having to input a password. The user must be in the sudo group.
If your system does not have systemctl:
echo "$USER ALL=(ALL:ALL) NOPASSWD: /usr/sbin/service codesyscontrol *" | sudo EDITOR="tee" visudo -f /etc/sudoers.d/allow_restart_codesyscontrol
This will allow the command service codesyscontrol start/stop
to be run with sudo
without having to input a password. The user must be in the sudo group.
roslaunch robin_bridge_generated run.launch
If you prefer not to give those permissions run the node manually:
rosrun robin_bridge_generated robin_node_generated
Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components.
More information: rosin-project.eu
This project has received funding from the European Unionβs Horizon 2020
research and innovation programme under grant agreement no. 732287.