Home

Awesome

kone_opc_controller

This repo provides a ROS 2 package that provides a pub/sub mecanism to control Kone lifts through a Kone OPC server and publish the status of the lifts.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. We will guide you step by step to install this kone_opc_controller package as well as the OpenOPC gateway and an optional Matrikon OPC Server Simulation.

Installing

Matrikon OPC Simulation Server (Windows)(Optional)

If you want to test the gateway without the actual OPC server but with a simulation tool, you can follow the instruction here.

OpenOPC Gateway (Windows)

You will need to install the OpenOPC Gateway on the same machine as your OPC Server. To install the Gateway, follow the instuction here.

Client (Linux)

The client has only been tested on Ubuntu 18.04, using ROS 2 Dashing. It might work on Windows 10 but haven't tested it yet.
To install ROS 2 Dashing, follow the instructions here.
You can now install Pyro4:

pip install Pyro4

You'll need 3 packages, the rmf_msgs, the open_opc_gateway_client and the kone_opc_controller packages.
First, get the rmf_msgs folder from the rmf repo. You can install the whole thing but we really just need the rmf_msgs folder for now.

Then, install the open_opc_gateway_client following the instructions here.

Once done, you can clone this repo to your src folder in your ROS 2 workspace:

cd ~/my_ros2_ws/src
git clone https://github.com/RMFHOPE/kone_opc_controller.git

Then build the package :

source /opt/ros/dashing/setup.bash
cd ~/my_ros2_ws
colcon build --symlink-install --packages-select kone_opc_controller

or build everything :

cd ~/my_ros2_ws
colcon build --symlink-install

then source :

source ~/my_ros2_ws/install/setup.bash

Parameters

Before running the package, you'll need to update the YAML file containing the parameters for this node. The parameters in the file kone_client_params.yaml are an example using the file for the Matrikon Simulation. The basic node parameters available are as follow:

Parameter NameTypeDescription
simuBooleanWhether to use the simulation file to simulate the control of a kone lift
connection_timeoutIntegerTimeout in seconds after which we give up if we can't connect to the gateway
read_timeoutIntegerTimeout in seconds after which we give up waiting for the lift to do an action (move, open door, etc...)
lift_request_topicStringThe topic we subscribe to listen to request
lift_state_topicStringThe topic where we publish the lifts states

You also need to provide the lifts info, to do so, we prefix the lift info with lift_info_X_, X being the index of the lift (1, 2, 3...):

Parameter NameTypeDescription
lift_info_X_idStringThe id of the lift (should be unique)
lift_info_X_gateway_ipStringThe IP of the machine where you installed the Gateway
lift_info_X_gateway_portIntegerThe port to use to access the Gateway
lift_info_X_opc_serv_ipStringThe IP of the OPC server the Gateway will use. The Gateway will most likely be on the same machine as the OPC server so then it would be 'localhost'
lift_info_X_opc_serv_typeStringThe type of the OPC server, for example if you use the simulation : 'Matrikon.OPC.Simulation'
lift_info_X_opc_groupStringThe OPC group where the aliases are contained
lift_info_X_siteStringThe OPC site name
lift_info_X_locationStringThe OPC location name
lift_info_X_groupStringThe OPC sub group name
lift_info_X_liftStringThe OPC lift name
lift_info_X_available_floorsString ArrayThe list of available floors for this lift
lift_info_X_available_door_sidesInteger ArrayThe list of available door side to open at each floors
lift_info_X_available_modesInteger ArrayThe list of available modes, the value is based on the rmf_msgs/LiftRequest.msg values
lift_info_X_default_modeIntegerThe default mode to put the lift into when releasing it

Run

Once the OPC Server (or the Matrikon Simulation) has been launched, the OpenOPC Gateway has been installed and all the required packages have been installed, you can finally run the kone_opc_controller node :

ros2 run kone_opc_controller kone_client __params:=~/my_ros2_ws/src/kone_opc_controller/params/kone_client_params.yaml

How to make a request

You can now publish messages on the given topic to make car calls, for example:

ros2 topic pub -1 /lift_request rmf_msgs/LiftRequest "{
    lift_name: 'KoneLift1', 
    session_id: 'some_session_id_1', 
    request_type: 1, 
    destination_floor: '5', 
    door_state: 2}"

The parameters of the LiftRequest are as follow:

Parameter NameTypeDescription
lift_nameStringThe lift ID used in the YAML parameter file
session_idStringA unique session ID (a UUID) to identify who currently have a hold of the lift
request_typeIntegerThe type of the request (calling the lift to a floor or releasing it ?)
destination_floorStringThe destination floor where to send the lift
door_stateIntegerWhether to hold the door open, unused here as we don't have control over the door

For more information on the message, check the rmf_msgs folder and the LiftRequest.msg file.

To release the lift, simply change the request_type to 0.

How to see the status of the lifts

You can subscribe to the topic given in the YAML file to receive a LiftState message. For example:

ros2 topic echo /lift_state

For more information on the message, check the rmf_msgs folder and the LiftState.msg file.

Limitations

If you lose the connection to the OPC Gateway, the lift state will only be published every 15 seconds (or X times the connection timeout, X being the number of lifts). Python being single threaded, the timer to check the lift info somehow make the timer to publish hang, therefore not publishing until the first timer was finished (in our case, after trying to get all lifts info).

Useful links

open_opc_gateway_client repo here.
open_opc_gateway repo here.
kone_opc_interfaces repo here.
kone_matrikon_simu_cfg repo here.
For more informations about the Kone interface, you can directly contact Kone here.
Original OpenOPC (v1.3 for Python 2) website here.
OpenOPC 1.2 for Python 3.4 here.
OpenOPC 1.3 for Python 3.6 from which this work is inspired here.
Pyro4 tutorials and documentations here.
Matrikon tools here.
OPC DA Specifications 2.0 here.
You can find specifications 3.0 here but you'll have to register.