Skip to content

Commit 1c06ea6

Browse files
author
Felix Exner (fexner)
authored
Merge pull request #127 from urrsk/pr
Dashboard commands, Docker Image and CI step for running the examples
2 parents f365f5a + d5fa901 commit 1c06ea6

29 files changed

+1769
-321
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,29 @@ on: [push, pull_request]
33

44
jobs:
55
build:
6+
timeout-minutes: 30
67
runs-on: ubuntu-latest
78
strategy:
89
matrix:
910
env:
10-
- DOCKER_RUN_OPTS: --network static_test_net
11+
- DOCKER_RUN_OPTS: --network ursim_net
1112
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
1213
CTEST_OUTPUT_ON_FAILURE: 1
13-
URSIM_VERSION: 3.14.1.1031110
14-
- DOCKER_RUN_OPTS: --network static_test_net
14+
ROBOT_MODEL: 'ur5'
15+
URSIM_VERSION: '3.12.1'
16+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3'
17+
- DOCKER_RUN_OPTS: --network ursim_net
1518
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
1619
CTEST_OUTPUT_ON_FAILURE: 1
17-
URSIM_VERSION: 5.8.0.10253
20+
ROBOT_MODEL: 'ur5e'
21+
URSIM_VERSION: '5.5.1'
22+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
1823

1924
steps:
2025
- uses: actions/checkout@v1
2126
- name: start ursim
2227
run: |
23-
tests/resources/dockerursim/build_and_run_docker_ursim.sh $URSIM_VERSION
28+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
2429
env: ${{matrix.env}}
2530
- name: install gtest
2631
run: sudo apt-get install -y libgtest-dev
@@ -36,6 +41,8 @@ jobs:
3641
run: cmake --build build --config Debug
3742
- name: test
3843
run: cd build && ctest --output-on-failure
44+
- name: run examples
45+
run: run-parts -v --exit-on-error -a "192.168.56.101" -a "1" ./build/examples
3946
- name: install gcovr
4047
run: sudo apt-get install -y gcovr
4148
- name: gcovr
@@ -59,11 +66,11 @@ jobs:
5966
--exclude-dir=CMakeModules \
6067
--exclude=tcp_socket.cpp \
6168
--exclude-dir=debian \
62-
--exclude=real_time.md
69+
--exclude=real_time.md \
70+
--exclude=start_ursim.sh
6371
6472
rosdoc_lite_check:
6573
runs-on: ubuntu-latest
6674
steps:
6775
- uses: actions/checkout@v1
6876
- uses: ./.github/actions/rosdoc_lite_action
69-

.github/workflows/industrial-ci.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,55 +23,67 @@ jobs:
2323
ROS_REPO: main
2424
IMMEDIATE_TEST_OUTPUT: true
2525
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS_Driver#master https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS_Driver/master/.melodic.rosinstall"
26-
DOCKER_RUN_OPTS: --network static_test_net
26+
DOCKER_RUN_OPTS: --network ursim_net
2727
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
28-
URSIM_VERSION: 5.8.0.10253
28+
URSIM_VERSION: '5.5.1'
29+
ROBOT_MODEL: 'ur5e'
30+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
2931
- ROS_DISTRO: noetic
3032
ROS_REPO: main
3133
IMMEDIATE_TEST_OUTPUT: true
3234
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS_Driver#master https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS_Driver/master/.noetic.rosinstall"
3335
BUILDER: catkin_tools
34-
DOCKER_RUN_OPTS: --network static_test_net
36+
DOCKER_RUN_OPTS: --network ursim_net
3537
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
36-
URSIM_VERSION: 5.8.0.10253
38+
URSIM_VERSION: '5.5.1'
39+
ROBOT_MODEL: 'ur5e'
40+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
3741
- ROS_DISTRO: foxy
3842
ROS_REPO: main
3943
IMMEDIATE_TEST_OUTPUT: true
4044
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#foxy"
41-
DOCKER_RUN_OPTS: --network static_test_net
45+
DOCKER_RUN_OPTS: --network ursim_net
4246
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
43-
URSIM_VERSION: 5.8.0.10253
47+
URSIM_VERSION: '5.5.1'
48+
ROBOT_MODEL: 'ur5e'
49+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
4450
NOT_TEST_DOWNSTREAM: true
4551
- ROS_DISTRO: galactic
4652
ROS_REPO: main
4753
IMMEDIATE_TEST_OUTPUT: true
4854
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#galactic"
49-
DOCKER_RUN_OPTS: --network static_test_net
55+
DOCKER_RUN_OPTS: --network ursim_net
5056
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
51-
URSIM_VERSION: 5.8.0.10253
57+
URSIM_VERSION: '5.5.1'
58+
ROBOT_MODEL: 'ur5e'
59+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
5260
NOT_TEST_DOWNSTREAM: true
5361
- ROS_DISTRO: humble
5462
ROS_REPO: main
5563
IMMEDIATE_TEST_OUTPUT: true
5664
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#main https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS2_Driver/main/Universal_Robots_ROS2_Driver-not-released.humble.repos"
57-
DOCKER_RUN_OPTS: --network static_test_net
65+
DOCKER_RUN_OPTS: --network ursim_net
5866
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
59-
URSIM_VERSION: 5.8.0.10253
67+
URSIM_VERSION: '5.5.1'
68+
ROBOT_MODEL: 'ur5e'
69+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
6070
NOT_TEST_DOWNSTREAM: true
6171
- ROS_DISTRO: rolling
6272
ROS_REPO: main
6373
IMMEDIATE_TEST_OUTPUT: true
6474
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#main https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS2_Driver/main/Universal_Robots_ROS2_Driver-not-released.rolling.repos"
65-
DOCKER_RUN_OPTS: --network static_test_net
75+
DOCKER_RUN_OPTS: --network ursim_net
6676
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
67-
URSIM_VERSION: 5.8.0.10253
77+
URSIM_VERSION: '5.5.1'
78+
ROBOT_MODEL: 'ur5e'
79+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
6880
NOT_TEST_DOWNSTREAM: true
6981

7082
steps:
7183
- uses: actions/checkout@v1
7284
- name: start ursim
7385
run: |
74-
tests/resources/dockerursim/build_and_run_docker_ursim.sh $URSIM_VERSION
86+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
7587
env: ${{matrix.env}}
7688
- uses: 'ros-industrial/industrial_ci@master'
7789
env: ${{matrix.env}}

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ add_library(urcl SHARED
4242
src/ur/calibration_checker.cpp
4343
src/ur/dashboard_client.cpp
4444
src/ur/tool_communication.cpp
45+
src/ur/version_information.cpp
4546
src/rtde/rtde_writer.cpp
4647
src/default_log_handler.cpp
4748
src/log.cpp

examples/CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
cmake_minimum_required(VERSION 3.0.2)
22
project(ur_driver_examples)
33

4-
#find_package(ur_client_library REQUIRED)
4+
# find_package(ur_client_library REQUIRED)
55

6-
##
7-
## Check C++11 support / enable global pedantic and Wall
8-
##
6+
# #
7+
# # Check C++11 support / enable global pedantic and Wall
8+
# #
99
include(DefineCXX17CompilerFlag)
1010
DEFINE_CXX_17_COMPILER_FLAG(CXX17_FLAG)
1111
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
@@ -20,7 +20,17 @@ add_executable(primary_pipeline_example
2020
target_compile_options(primary_pipeline_example PUBLIC ${CXX17_FLAG})
2121
target_link_libraries(primary_pipeline_example ur_client_library::urcl)
2222

23+
add_executable(primary_pipeline_calibration_example
24+
primary_pipeline_calibration.cpp)
25+
target_compile_options(primary_pipeline_calibration_example PUBLIC ${CXX17_FLAG})
26+
target_link_libraries(primary_pipeline_calibration_example ur_client_library::urcl)
27+
2328
add_executable(rtde_client_example
2429
rtde_client.cpp)
2530
target_compile_options(rtde_client_example PUBLIC ${CXX17_FLAG})
2631
target_link_libraries(rtde_client_example ur_client_library::urcl)
32+
33+
add_executable(dashboard_example
34+
dashboard_example.cpp)
35+
target_compile_options(dashboard_example PUBLIC ${CXX17_FLAG})
36+
target_link_libraries(dashboard_example ur_client_library::urcl)

examples/dashboard_example.cpp

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2+
3+
// -- BEGIN LICENSE BLOCK ----------------------------------------------
4+
// Copyright 2022 Universal Robots A/S
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// -- END LICENSE BLOCK ------------------------------------------------
19+
20+
#include <ur_client_library/log.h>
21+
#include <ur_client_library/ur/dashboard_client.h>
22+
23+
#include <iostream>
24+
#include <memory>
25+
#include <thread>
26+
27+
using namespace urcl;
28+
29+
// In a real-world example it would be better to get those values from command line parameters / a
30+
// better configuration system such as Boost.Program_options
31+
const std::string DEFAULT_ROBOT_IP = "192.168.56.101";
32+
33+
// We need a callback function to register. See UrDriver's parameters for details.
34+
35+
int main(int argc, char* argv[])
36+
{
37+
urcl::setLogLevel(urcl::LogLevel::DEBUG);
38+
39+
// Parse the ip arguments if given
40+
std::string robot_ip = DEFAULT_ROBOT_IP;
41+
if (argc > 1)
42+
{
43+
robot_ip = std::string(argv[1]);
44+
}
45+
46+
// Making the robot ready for the program by:
47+
// Connect the the robot Dashboard
48+
std::unique_ptr<DashboardClient> my_dashboard;
49+
my_dashboard.reset(new DashboardClient(robot_ip));
50+
if (!my_dashboard->connect())
51+
{
52+
URCL_LOG_ERROR("Could not connect to dashboard");
53+
return 1;
54+
}
55+
56+
if (!my_dashboard->commandPowerOff())
57+
{
58+
URCL_LOG_ERROR("Could not send power off");
59+
return 1;
60+
}
61+
62+
my_dashboard->commandCloseSafetyPopup();
63+
64+
// Power it on
65+
if (!my_dashboard->commandPowerOn())
66+
{
67+
URCL_LOG_ERROR("Could not send Power on command");
68+
return 1;
69+
}
70+
71+
// Release the brakes
72+
if (!my_dashboard->commandBrakeRelease())
73+
{
74+
URCL_LOG_ERROR("Could not send BrakeRelease command");
75+
return 1;
76+
}
77+
78+
// Load existing program
79+
const std::string program_file_name_to_be_loaded("wait_program.urp");
80+
if (!my_dashboard->commandLoadProgram(program_file_name_to_be_loaded))
81+
{
82+
URCL_LOG_ERROR("Could not load %s program", program_file_name_to_be_loaded.c_str());
83+
return 1;
84+
}
85+
86+
// Play loaded program
87+
if (!my_dashboard->commandPlay())
88+
{
89+
URCL_LOG_ERROR("Could not play program");
90+
return 1;
91+
}
92+
93+
// Pause running program
94+
if (!my_dashboard->commandPause())
95+
{
96+
URCL_LOG_ERROR("Could not pause program");
97+
return 1;
98+
}
99+
100+
// Play loaded program
101+
if (!my_dashboard->commandPlay())
102+
{
103+
URCL_LOG_ERROR("Could not play program");
104+
return 1;
105+
}
106+
107+
// Stop program
108+
if (!my_dashboard->commandStop())
109+
{
110+
URCL_LOG_ERROR("Could not stop program");
111+
return 1;
112+
}
113+
114+
// Power it off
115+
if (!my_dashboard->commandPowerOff())
116+
{
117+
URCL_LOG_ERROR("Could not send Power off command");
118+
return 1;
119+
}
120+
121+
// Now the robot is ready to receive a program
122+
123+
return 0;
124+
}

0 commit comments

Comments
 (0)