3. Unit test - Zeren-Zhao/parcel_sorting_car GitHub Wiki
Control part test
- Assembling the trolley
- Open terminal
cd
to the test folder
g++ control_test.cpp -o control_test -lwiringPi
./control_test
After running the code, you should see your car make a left turn, a forward turn, a right turn and a backward turn in sequence, eventually returning to the same place and stopping.
QR code detect and decode test
- Open terminal
cd
to the test folder
g++ test_qr.cpp -o test_qr -lzbar -usr/local/include/opencv2 -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lopencv_video -lopencv_videoio
./test_qr
After this, you should be able to see from the Raspberry Pi's graphical interface that the camera is on and there is a window for live image transmission back. When you scan the QR code, you will see the Scanned QR code printed out in terminal: + the information in your QR code. And you can find a qrcode.txt in this folder which contains the information of your QR code.
State machine and decision maker, navigation function test
- Open terminal
cd
to the test folder
g++ test_state_machine.cpp -o test_state_machine
./test_state_machine
You should see a constant printout of the current status in terminal, along with the value of the string location
and the values of current_1
,current_2
. You can check that stat_machine is running correctly by checking these processes. For decisions and navigation, the actions taken are also printed out in the terminal. In addition, you can change the value of location
in the main program to test if you get the desired result.