Skip to content

Commit 25846e3

Browse files
committed
Added a test to check all robot model parametrizations
1 parent 8f35234 commit 25846e3

4 files changed

Lines changed: 271 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 183 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,45 @@ on:
99
- cron: '38 2 * * *'
1010

1111
jobs:
12-
build:
12+
ubuntu_build:
13+
name: ubuntu_build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
- name: Install build-tools
18+
run: sudo apt-get update && sudo apt-get install -y build-essential cmake python3-pandas python3-lxml
19+
- name: configure
20+
run: >
21+
mkdir build &&
22+
cd build &&
23+
cmake ..
24+
-DBUILDING_TESTS=1
25+
-DINTEGRATION_TESTS=1
26+
-DWITH_ASAN=ON
27+
-DPRIMARY_CLIENT_STRICT_PARSING_=ON
28+
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
29+
-DCHECK_RTDE_DOCS_RECIPE=ON
30+
env:
31+
CXXFLAGS: -g -O2 -fprofile-arcs -ftest-coverage
32+
CFLAGS: -g -O2 -fprofile-arcs -ftest-coverage
33+
LDFLAGS: -fprofile-arcs -ftest-coverage
34+
- name: build
35+
id: build
36+
run: cmake --build build --config Debug
37+
- name: Upload CMake build directory
38+
if: steps.build.outcome == 'success'
39+
uses: actions/upload-artifact@v7
40+
with:
41+
name: cmake-build-${{ matrix.env.ROBOT_MODEL }}-${{ matrix.env.URSIM_VERSION }}
42+
path: build
43+
if-no-files-found: error
44+
retention-days: 5
45+
46+
run_tests:
1347
timeout-minutes: 60
1448
runs-on: ubuntu-latest
15-
name: build (${{matrix.env.URSIM_VERSION}}-${{matrix.env.ROBOT_MODEL}})
49+
name: run_tests (${{matrix.env.URSIM_VERSION}}-${{matrix.env.ROBOT_MODEL}})
50+
needs: ubuntu_build
1651
strategy:
1752
fail-fast: false
1853
matrix:
@@ -46,8 +81,6 @@ jobs:
4681
ROBOT_MODEL: ${{matrix.env.ROBOT_MODEL}}
4782
URSIM_VERSION: ${{matrix.env.URSIM_VERSION}}
4883
PROGRAM_FOLDER: ${{matrix.env.PROGRAM_FOLDER}}
49-
- name: install-pips
50-
run: pip install pandas lxml
5184
- id: check_polyscopex
5285
run: |
5386
if [[ "${{matrix.env.URSIM_VERSION}}" == "10."* ]]; then
@@ -57,24 +90,11 @@ jobs:
5790
fi
5891
- name: setup chrome
5992
uses: browser-actions/setup-chrome@v2
60-
- name: configure
61-
run: >
62-
mkdir build &&
63-
cd build &&
64-
cmake ..
65-
-DBUILDING_TESTS=1
66-
-DINTEGRATION_TESTS=1
67-
-DWITH_ASAN=ON
68-
-DPRIMARY_CLIENT_STRICT_PARSING=ON
69-
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
70-
-DCHECK_RTDE_DOCS_RECIPE=ON
71-
env:
72-
CXXFLAGS: -g -O2 -fprofile-arcs -ftest-coverage
73-
CFLAGS: -g -O2 -fprofile-arcs -ftest-coverage
74-
LDFLAGS: -fprofile-arcs -ftest-coverage
75-
- name: build
76-
id: build
77-
run: cmake --build build --config Debug
93+
- name: Download CMake build directory
94+
uses: actions/download-artifact@v7
95+
with:
96+
name: cmake-build-${{ matrix.env.ROBOT_MODEL }}-${{ matrix.env.URSIM_VERSION }}
97+
path: build
7898
- name: Create folder for test artifacts
7999
run: mkdir -p test_artifacts
80100
- name: Access PolyScope
@@ -96,13 +116,10 @@ jobs:
96116
- name: run examples
97117
run: ./run_examples.sh "192.168.56.101" 1
98118
- name: install gcovr
99-
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
100119
run: sudo apt-get install -y gcovr
101120
- name: gcovr
102-
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
103121
run: cd build && gcovr -r .. --xml coverage.xml --gcov-ignore-parse-errors negative_hits.warn_once_per_file --exclude "../3rdparty"
104122
- name: Upload coverage reports to Codecov with GitHub Action
105-
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
106123
uses: codecov/codecov-action@v6
107124
with:
108125
fail_ci_if_error: true
@@ -150,6 +167,147 @@ jobs:
150167
if-no-files-found: warn
151168
retention-days: 10
152169

170+
robot_model_check:
171+
timeout-minutes: 60
172+
runs-on: ubuntu-latest
173+
needs: ubuntu_build
174+
name: check_model (${{matrix.env.URSIM_VERSION}}-${{matrix.env.ROBOT_MODEL}})
175+
strategy:
176+
fail-fast: false
177+
matrix:
178+
env:
179+
- ROBOT_MODEL: 'ur3'
180+
URSIM_VERSION: '3.14.3'
181+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3'
182+
- ROBOT_MODEL: 'ur5'
183+
URSIM_VERSION: '3.15.8'
184+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3'
185+
- ROBOT_MODEL: 'ur10'
186+
URSIM_VERSION: '3.15.8'
187+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3'
188+
- ROBOT_MODEL: 'ur3e'
189+
URSIM_VERSION: '5.9.4'
190+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
191+
- ROBOT_MODEL: 'ur5e'
192+
URSIM_VERSION: '5.12.8'
193+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
194+
- ROBOT_MODEL: 'ur7e'
195+
URSIM_VERSION: '5.15.2'
196+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
197+
- ROBOT_MODEL: 'ur10e'
198+
URSIM_VERSION: '5.22.2'
199+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
200+
- ROBOT_MODEL: 'ur12e'
201+
URSIM_VERSION: '5.25.1'
202+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
203+
- ROBOT_MODEL: 'ur16e'
204+
URSIM_VERSION: '5.25.1'
205+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
206+
- ROBOT_MODEL: 'ur8long'
207+
URSIM_VERSION: '5.25.1'
208+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
209+
- ROBOT_MODEL: 'ur15'
210+
URSIM_VERSION: '5.25.1'
211+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
212+
- ROBOT_MODEL: 'ur18'
213+
URSIM_VERSION: '5.25.1'
214+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
215+
- ROBOT_MODEL: 'ur20'
216+
URSIM_VERSION: '5.25.1'
217+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
218+
- ROBOT_MODEL: 'ur30'
219+
URSIM_VERSION: '5.25.1'
220+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
221+
- ROBOT_MODEL: 'ur3e'
222+
URSIM_VERSION: '10.11.0'
223+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
224+
- ROBOT_MODEL: 'ur5e'
225+
URSIM_VERSION: '10.11.0'
226+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
227+
- ROBOT_MODEL: 'ur7e'
228+
URSIM_VERSION: '10.11.0'
229+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
230+
- ROBOT_MODEL: 'ur10e'
231+
URSIM_VERSION: '10.11.0'
232+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
233+
- ROBOT_MODEL: 'ur12e'
234+
URSIM_VERSION: '10.12.1'
235+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
236+
- ROBOT_MODEL: 'ur16e'
237+
URSIM_VERSION: '10.12.1'
238+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
239+
- ROBOT_MODEL: 'ur8long'
240+
URSIM_VERSION: '10.12.1'
241+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
242+
- ROBOT_MODEL: 'ur15'
243+
URSIM_VERSION: '10.12.1'
244+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
245+
- ROBOT_MODEL: 'ur18'
246+
URSIM_VERSION: '10.12.1'
247+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
248+
- ROBOT_MODEL: 'ur20'
249+
URSIM_VERSION: '10.12.1'
250+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
251+
- ROBOT_MODEL: 'ur30'
252+
URSIM_VERSION: '10.12.1'
253+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex'
254+
255+
steps:
256+
- uses: actions/checkout@v6
257+
- name: start ursim
258+
run: |
259+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d -f DISABLED
260+
- name: Download CMake build directory
261+
uses: actions/download-artifact@v7
262+
with:
263+
name: cmake-build-${{ matrix.env.ROBOT_MODEL }}-${{ matrix.env.URSIM_VERSION }}
264+
path: build
265+
env:
266+
DOCKER_RUN_OPTS: --network ursim_net
267+
ROBOT_MODEL: ${{matrix.env.ROBOT_MODEL}}
268+
URSIM_VERSION: ${{matrix.env.URSIM_VERSION}}
269+
PROGRAM_FOLDER: ${{matrix.env.PROGRAM_FOLDER}}
270+
- name: test robot type
271+
run: cd build && ctest -R PrimaryClientTest.test_robot_type --verbose --output-junit junit.xml
272+
env:
273+
URSIM_VERSION: ${{matrix.env.URSIM_VERSION}}
274+
ROBOT_MODEL: ${{matrix.env.ROBOT_MODEL}}
275+
- name: install gcovr
276+
run: sudo apt-get install -y gcovr
277+
- name: gcovr
278+
run: cd build && gcovr -r .. --xml coverage.xml --gcov-ignore-parse-errors negative_hits.warn_once_per_file --exclude "../3rdparty"
279+
- name: Upload coverage reports to Codecov with GitHub Action
280+
uses: codecov/codecov-action@v6
281+
with:
282+
fail_ci_if_error: true
283+
files: build/coverage.xml
284+
flags: check_version_${{ matrix.env.ROBOT_MODEL }}-${{ matrix.env.URSIM_VERSION }}
285+
env:
286+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
287+
- name: Generate URSim log files
288+
if: ${{ always() && steps.check_polyscopex.outputs.is_polyscopex == 'false' }}
289+
run: |
290+
nc -q 1 192.168.56.101 29999 <<END
291+
saveLog
292+
END
293+
mkdir -p ursim_logs
294+
docker cp ursim:/ursim/URControl.log ursim_logs/URControl.log
295+
docker cp ursim:/ursim/polyscope.log ursim_logs/polyscope.log
296+
docker cp ursim:/ursim/log_history.txt ursim_logs/log_history.txt
297+
- name: Copy flight reports
298+
if: ${{ failure() && steps.check_polyscopex.outputs.is_polyscopex == 'false' }}
299+
run: |
300+
mkdir -p ursim_logs/flightreports
301+
docker cp ursim:/ursim/flightreports/. ursim_logs/flightreports/
302+
- name: Upload logfiles
303+
uses: actions/upload-artifact@v7
304+
if: ${{ always() && steps.check_polyscopex.outputs.is_polyscopex == 'false' }}
305+
with:
306+
name: ${{matrix.env.ROBOT_MODEL}}_${{matrix.env.URSIM_VERSION}}_model_check_URSim_Logs
307+
path: ursim_logs
308+
if-no-files-found: error
309+
retention-days: 10
310+
153311
test_start_ursim:
154312
runs-on: ubuntu-latest
155313
steps:

include/ur_client_library/helpers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,7 @@ void clampToUnitRange(std::array<T, N>& values)
169169
*/
170170
RobotSeries robotSeriesFromTypeAndVersion(const RobotType type, const VersionInformation& version);
171171

172+
RobotType robotTypeFromString(const std::string& robot_type_str);
173+
172174
} // namespace urcl
173175
#endif // ifndef UR_CLIENT_LIBRARY_HELPERS_H_INCLUDED

src/helpers.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,69 @@ RobotSeries robotSeriesFromTypeAndVersion(const RobotType type, const VersionInf
203203
return RobotSeries::UNDEFINED;
204204
}
205205

206+
RobotType robotTypeFromString(const std::string& robot_type_str)
207+
{
208+
if (robot_type_str == "ur3")
209+
{
210+
return RobotType::UR3;
211+
}
212+
else if (robot_type_str == "ur3e")
213+
{
214+
return RobotType::UR3;
215+
}
216+
else if (robot_type_str == "ur5")
217+
{
218+
return RobotType::UR5;
219+
}
220+
else if (robot_type_str == "ur5e")
221+
{
222+
return RobotType::UR5;
223+
}
224+
else if (robot_type_str == "ur7e")
225+
{ // UR7e reports as UR5
226+
return RobotType::UR5;
227+
}
228+
else if (robot_type_str == "ur10")
229+
{
230+
return RobotType::UR10;
231+
}
232+
else if (robot_type_str == "ur10e")
233+
{
234+
return RobotType::UR10;
235+
}
236+
else if (robot_type_str == "ur12e")
237+
{ // UR12e reports as UR10
238+
return RobotType::UR10;
239+
}
240+
else if (robot_type_str == "ur16e")
241+
{
242+
return RobotType::UR16;
243+
}
244+
else if (robot_type_str == "ur15")
245+
{
246+
return RobotType::UR15;
247+
}
248+
else if (robot_type_str == "ur18")
249+
{
250+
return RobotType::UR18;
251+
}
252+
else if (robot_type_str == "ur20")
253+
{
254+
return RobotType::UR20;
255+
}
256+
else if (robot_type_str == "ur30")
257+
{
258+
return RobotType::UR30;
259+
}
260+
else if (robot_type_str == "ur8long")
261+
{
262+
return RobotType::UR8LONG;
263+
}
264+
else
265+
{
266+
return RobotType::UR5;
267+
throw std::invalid_argument("Unknown robot type: " + robot_type_str);
268+
}
269+
}
270+
206271
} // namespace urcl

tests/test_primary_client.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,27 @@ TEST_F(PrimaryClientTest, test_configuration_data)
267267
EXPECT_NE(client_->getRobotType(), RobotType::UNDEFINED);
268268
}
269269

270+
TEST_F(PrimaryClientTest, test_robot_type)
271+
{
272+
if (std::getenv("ROBOT_MODEL") == nullptr)
273+
{
274+
GTEST_SKIP() << "ROBOT_MODEL environment variable not set. Skipping test.";
275+
}
276+
EXPECT_NO_THROW(client_->start());
277+
278+
// Wait until we have received configuration data so that the robot type is known.
279+
auto start_time = std::chrono::system_clock::now();
280+
const auto timeout = std::chrono::seconds(10);
281+
while (client_->getConfigurationData() == nullptr && std::chrono::system_clock::now() - start_time < timeout)
282+
{
283+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
284+
}
285+
ASSERT_NE(client_->getConfigurationData(), nullptr);
286+
const std::string robot_model_env = std::getenv("ROBOT_MODEL");
287+
const RobotType expected_series_from_env = robotTypeFromString(robot_model_env);
288+
EXPECT_EQ(client_->getRobotType(), expected_series_from_env);
289+
}
290+
270291
TEST_F(PrimaryClientTest, test_kinematics_info)
271292
{
272293
EXPECT_NO_THROW(client_->start());

0 commit comments

Comments
 (0)