Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,13 @@ jobs:
fail-fast: false
matrix:
env:
- DOCKER_RUN_OPTS: --network ursim_net
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
CTEST_OUTPUT_ON_FAILURE: 1
ROBOT_MODEL: 'ur5'
- ROBOT_MODEL: 'ur5'
URSIM_VERSION: '3.14.3'
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3'
- DOCKER_RUN_OPTS: --network ursim_net
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
CTEST_OUTPUT_ON_FAILURE: 1
ROBOT_MODEL: 'ur5e'
- ROBOT_MODEL: 'ur5e'
URSIM_VERSION: '5.9.4'
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
- DOCKER_RUN_OPTS: --network ursim_net
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
CTEST_OUTPUT_ON_FAILURE: 1
ROBOT_MODEL: 'ur20'
- ROBOT_MODEL: 'ur20'
URSIM_VERSION: 'latest'
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'

Expand All @@ -39,7 +30,11 @@ jobs:
- name: start ursim
run: |
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
env: ${{matrix.env}}
env:
DOCKER_RUN_OPTS: --network ursim_net
ROBOT_MODEL: ${{matrix.env.ROBOT_MODEL}}
URSIM_VERSION: ${{matrix.env.URSIM_VERSION}}
PROGRAM_FOLDER: ${{matrix.env.PROGRAM_FOLDER}}
- name: configure
run: mkdir build && cd build && cmake .. -DBUILDING_TESTS=1 -DINTEGRATION_TESTS=1 -DWITH_ASAN=ON
env:
Expand Down
48 changes: 39 additions & 9 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,52 @@ if (INTEGRATION_TESTS)
gtest_add_tests(TARGET dashboard_client_tests
)

add_executable(spline_tests test_spline_interpolation.cpp)
target_link_libraries(spline_tests PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET spline_tests
# Spline tests
add_executable(spline_tests_urcap test_spline_interpolation.cpp)
target_link_libraries(spline_tests_urcap PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET spline_tests_urcap
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
EXTRA_ARGS --headless false
TEST_SUFFIX _urcap
)
add_executable(spline_tests_headless test_spline_interpolation.cpp)
target_link_libraries(spline_tests_headless PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET spline_tests_headless
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
EXTRA_ARGS --headless true
TEST_SUFFIX _headless
)

add_executable(ur_driver_tests test_ur_driver.cpp)
target_link_libraries(ur_driver_tests PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET ur_driver_tests
# UrDriver tests
add_executable(ur_driver_tests_urcap test_ur_driver.cpp)
target_link_libraries(ur_driver_tests_urcap PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET ur_driver_tests_urcap
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
EXTRA_ARGS --headless false
TEST_SUFFIX _urcap
)
add_executable(ur_driver_tests_headless test_ur_driver.cpp)
target_link_libraries(ur_driver_tests_headless PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET ur_driver_tests_headless
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
EXTRA_ARGS --headless true
TEST_SUFFIX _headless
)

add_executable(instruction_executor_test test_instruction_executor.cpp)
target_link_libraries(instruction_executor_test PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET instruction_executor_test
# InstructionExecutor tests
add_executable(instruction_executor_test_urcap test_instruction_executor.cpp)
target_link_libraries(instruction_executor_test_urcap PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET instruction_executor_test_urcap
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
EXTRA_ARGS --headless false
TEST_SUFFIX _urcap
)
add_executable(instruction_executor_test_headless test_instruction_executor.cpp)
target_link_libraries(instruction_executor_test_headless PRIVATE ur_client_library::urcl GTest::gtest_main)
gtest_add_tests(TARGET instruction_executor_test_headless
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
EXTRA_ARGS --headless true
TEST_SUFFIX _headless
)
else()
message(STATUS "Skipping integration tests.")
Expand Down
Binary file not shown.
Binary file not shown.
11 changes: 9 additions & 2 deletions tests/test_instruction_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// -- END LICENSE BLOCK ------------------------------------------------

#include <gtest/gtest.h>
#include <iostream>
#include <thread>
#include "ur_client_library/ur/instruction_executor.h"
#include "ur_client_library/control/motion_primitives.h"
Expand All @@ -43,6 +44,7 @@ const std::string OUTPUT_RECIPE = "resources/rtde_output_recipe.txt";
const std::string INPUT_RECIPE = "resources/rtde_input_recipe.txt";
const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542";
std::string ROBOT_IP = "192.168.56.101";
bool g_HEADLESS = true;

std::unique_ptr<ExampleRobotWrapper> g_my_robot;

Expand All @@ -54,8 +56,7 @@ class InstructionExecutorTest : public ::testing::Test
static void SetUpTestSuite()
{
// Setup driver
bool headless_mode = false;
g_my_robot = std::make_unique<ExampleRobotWrapper>(ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, headless_mode,
g_my_robot = std::make_unique<ExampleRobotWrapper>(ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, g_HEADLESS,
"external_control.urp", SCRIPT_FILE);
}
void SetUp() override
Expand Down Expand Up @@ -279,6 +280,12 @@ int main(int argc, char* argv[])
ROBOT_IP = argv[i + 1];
break;
}
if (std::string(argv[i]) == "--headless" && i + 1 < argc)
{
std::string headless = argv[i + 1];
g_HEADLESS = headless == "true" || headless == "1" || headless == "True" || headless == "TRUE";
break;
}
}

return RUN_ALL_TESTS();
Expand Down
10 changes: 8 additions & 2 deletions tests/test_spline_interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const std::string OUTPUT_RECIPE = "resources/rtde_output_recipe_spline.txt";
const std::string INPUT_RECIPE = "resources/rtde_input_recipe.txt";
const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542";
std::string g_ROBOT_IP = "192.168.56.101";
bool g_HEADLESS = true;

std::unique_ptr<ExampleRobotWrapper> g_my_robot;

Expand Down Expand Up @@ -96,8 +97,7 @@ class SplineInterpolationTest : public ::testing::Test
out_file.close();

// Setup driver
bool headless_mode = false;
g_my_robot = std::make_unique<ExampleRobotWrapper>(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, headless_mode,
g_my_robot = std::make_unique<ExampleRobotWrapper>(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, g_HEADLESS,
"external_control.urp", SPLINE_SCRIPT_FILE);

g_my_robot->startRTDECommununication(true);
Expand Down Expand Up @@ -1105,6 +1105,12 @@ int main(int argc, char* argv[])
g_ROBOT_IP = argv[i + 1];
break;
}
if (std::string(argv[i]) == "--headless" && i + 1 < argc)
{
std::string headless = argv[i + 1];
g_HEADLESS = headless == "true" || headless == "1" || headless == "True" || headless == "TRUE";
break;
}
}

return RUN_ALL_TESTS();
Expand Down
19 changes: 13 additions & 6 deletions tests/test_ur_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <gtest/gtest.h>

#include <ur_client_library/ur/dashboard_client.h>
#include <thread>
#define private public
#include <ur_client_library/ur/ur_driver.h>
#include <ur_client_library/example_robot_wrapper.h>
Expand All @@ -42,6 +43,7 @@ const std::string OUTPUT_RECIPE = "resources/rtde_output_recipe.txt";
const std::string INPUT_RECIPE = "resources/rtde_input_recipe.txt";
const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542";
std::string g_ROBOT_IP = "192.168.56.101";
bool g_HEADLESS = true;

std::unique_ptr<ExampleRobotWrapper> g_my_robot;

Expand All @@ -51,8 +53,7 @@ class UrDriverTest : public ::testing::Test
static void SetUpTestSuite()
{
// Setup driver
bool headless_mode = false;
g_my_robot = std::make_unique<ExampleRobotWrapper>(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, headless_mode,
g_my_robot = std::make_unique<ExampleRobotWrapper>(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, g_HEADLESS,
"external_control.urp", SCRIPT_FILE);

g_my_robot->startRTDECommununication(true);
Expand Down Expand Up @@ -225,15 +226,15 @@ TEST_F(UrDriverTest, target_outside_limits_pose)

TEST_F(UrDriverTest, send_robot_program_retry_on_failure)
{
// Start robot program
g_my_robot->resendRobotProgram();
EXPECT_TRUE(g_my_robot->waitForProgramRunning(1000));

// Check that sendRobotProgram is robust to the secondary stream being disconnected. This is what happens when
// switching from Remote to Local and back to Remote mode for example.
g_my_robot->ur_driver_->secondary_stream_->close();

std::this_thread::sleep_for(std::chrono::milliseconds(100));

EXPECT_TRUE(g_my_robot->resendRobotProgram());

EXPECT_TRUE(g_my_robot->waitForProgramRunning());
}

TEST_F(UrDriverTest, reset_rtde_client)
Expand All @@ -257,6 +258,12 @@ int main(int argc, char* argv[])
g_ROBOT_IP = argv[i + 1];
break;
}
if (std::string(argv[i]) == "--headless" && i + 1 < argc)
{
std::string headless = argv[i + 1];
g_HEADLESS = headless == "true" || headless == "1" || headless == "True" || headless == "TRUE";
break;
}
}

return RUN_ALL_TESTS();
Expand Down