A new Python-based hardware Test Sequencer
Using Flojoy's Test Sequencer with a Tinymovr Servo and a Raspberry Pi 5
Flojoy is proud to announce its latest feature, a built-in test sequencer to facilitate hardware testing in Python!
A Test Sequencer (AKA Test execution engine) is a tool for testing hardware, software, or both. At it’s simplest, the sequencer imports and runs multiple tests in a row. It will then display whether these tests passed or failed.
The Test Sequencer
To upload a Python script, use the +Import test
dialogue. The sequencer will automatically recognize subtests (defined by unittest
or pytest
). The subtests will be defined by “<script name>::<class>::<method>” such as “test_board.py::TestBoard:test_a_encoder” in Figure 1.
Conditionals
An additional feature of the Test Sequencer is the ability to add conditionals. Here’s an example with an If-Else conditional (Figure 3). In this example the first test runs (test_c_calibrate
), and if that test passes, three more tests are ran.
If the first test fails, no other test is ran. If you wanted a test to run when test_c_calibrate
fails, you simply put the extra test below the ELSE. For example, you could test why the first test failed. Here the first test failed due to the powered down DC power supply. This can be useful to first check if the board/tested battery is properly connected and turned on, and then the rest of the tests will not, futilely, run.
In Figure 5, you can see test_n_velocity_ramp
test running.
Tinymovr
In this example, we are testing a Tinymovr Servo kit. The tests used are included in Tinymovr’s Python Repository. The tests include velocity control, flux braking, and position control tests. The CAN adapter necessary to control the motor is also used. The motor’s control board in connected to the CAN adapter which is connected to the Raspberry Pi control unit. Tinymovr allows daisy chaining of motors with one CAN adapter. This would allow for using (and testing of) multiple motors.
Raspberry Pi
Raspberry Pi’s are often used in the hardware testing space due to their easy to control GPIO pins. We aren’t utilizing those pins here (however, look out for those blog posts in the near future ;) ).