1 of 44

CI/CD in Robots Testing

KYIV 2018

Aliaksei Boole, Head of QA

2 of 44

KYIV 2018

Engineer.

Worked in:

  • Bel. Railway
  • Synesis
  • Wargaming
  • Juno

I test robots in Rozum

3 of 44

Today we are talking only about software

4 of 44

5 of 44

Today we are talking only about software

6 of 44

KYIV 2018

Safety Board

C/C++

(emergency stop, power control,

LEDS, etc.)

PC with Linux

REST API

Java App

(trajectory builders, inverse kinematics etc.)

UI

x 6

+ wrist

C/С++

(build trajectories, protective systems, etc.)

CAN adapters

7 of 44

CI/CD

Code

Build

Test

Release

Deploy

Operate

Plan

CI

CD

8 of 44

Our CI/CD

Code

Build

Test

Release

Deploy

Operate

Plan

CI

CD

9 of 44

Deploy

Operate

What's the problem?

  • Robots is not our property
  • Factories have no internet
  • Changes can break integrator’s crutches
  • A robot can kill people

10 of 44

Deploy

Operate

What solutions do we have?

  • Flash drive update
  • Ability to download diagnostic information
  • Update in manual mode only

11 of 44

Deploy

How does it work?

Release

12 of 44

Code

+

+

13 of 44

Code

14 of 44

Build

+

15 of 44

Build

16 of 44

Build

Use firmware collected only from the master

17 of 44

Why?

  • Different release cycles
  • Different teams
  • Different products

Build

18 of 44

Build

Build result is DEB packages with dependencies

19 of 44

Unit test

20 of 44

Unit test

C/C++ should be compatible with x86-64

21 of 44

Why?

  • Ability to run tests on regular computers
  • Convenient to use stubs

Unit test

22 of 44

Our testing stack:

Test

23 of 44

Our best friends:

Test

24 of 44

Docker

Component test

REST API

Java App

(trajectory builders, inverse kinematics etc.)

UI

Tests

Robot simulation

25 of 44

Component test

public interface Robot extends … {

void setPose(...) throws IOException, RobotException;

void setPosition(...) throws IOException, RobotException;

void relax() throws IOException;

void freeze() throws IOException;

void softFreeze() throws IOException;

...

void initializationCompleted() throws IOException;

}

26 of 44

Component test

POINT_1 = pose([20, -100, 80, 20, 70, 0])

@fixture(params=[POINT_1, POINT_2, POINT_3])

def position(request):

return request.param

def set_pose(robot, position):

robot.set_pose(pose(position.angles), SPEED)

robot.await_stop()

return robot.get_pose().angles

def test_run_pose(robot, position):

assert_that(set_pose(robot, position),

pose_close_to(position.angles))

27 of 44

Component test

28 of 44

Component test

29 of 44

Our HIL today:

  • Control Box I/O emulation
  • CAN-USB, CAN-ETH hard reboot emulation

+

Component test

30 of 44

USB-CAN-ETH testing stand

31 of 44

Component test

...

EMCY_FRAME = 0x09

@fixture

def interface_with_emcy():

interface = API.init_interface(ETH_INTERFACE_ADDRESS)

interface.emcy_log_clear()

with SerialInterface(USB_INTERFACE) as usb_interface:

payload = pack("<BBHBBBBBB", EMCY_FRAME, )

usb_interface.write(payload)

yield interface

interface.emcy_log_clear()

API.deinit_interface(ETH_INTERFACE_ADDRESS)

def test_emcy_code(interface_with_emcy):

emcy = interface_with_emcy.emcy_log_pop()

assert_that(emcy.code, equal_to(EMCY_ERROR_CODE))

32 of 44

Control box testing stand

33 of 44

Simulation is best friend of robotics

34 of 44

Integration test

Stands!

Stands!

Stands!

Stands!

Stands!

+

35 of 44

Servomotors testing stand

36 of 44

Integration test

def test_add_motion_point(servo_in_0_pos_with_interface):

servo, interface = servo_in_0_pos_with_interface

servo.add_motion_point(30, 0, 1000)

interface.start_motion(0)

wait_that(servo.position, position_equals(30))

37 of 44

Integration test

38 of 44

Robot testing stand

39 of 44

Integration test

40 of 44

Test

All these stands are available on CI as gitlab-runners

41 of 44

Test

...

test:

stage: test

tags:

- servo-testbench

...

42 of 44

We have manual tests too :)

43 of 44

Code

Build

Test

Review

&

Code check

Unit Tests

Simulation

Integration

HIL

Build

Manual testing

.gitlab-ci.yml + Multi-project pipelines

44 of 44

KYIV 2018

Questions?

Алексей Буль (Aliaksei Boole)

Email: aliaksei.boole@gmail.com

Slack: qaguild-slack.herokuapp.com

Twitter: @Alex_Koul